mirror of
https://github.com/microsoft/DirectXTex.git
synced 2025-07-12 05:00:14 +02:00
Fixed FlipRotate bug with 180 degree rotation
This commit is contained in:
parent
b1f6b50a99
commit
908869c96e
@ -210,7 +210,9 @@ HRESULT DirectX::FlipRotate(
|
|||||||
static_assert(static_cast<int>(TEX_FR_FLIP_VERTICAL) == static_cast<int>(WICBitmapTransformFlipVertical), "TEX_FR_FLIP_VERTICAL no longer matches WIC");
|
static_assert(static_cast<int>(TEX_FR_FLIP_VERTICAL) == static_cast<int>(WICBitmapTransformFlipVertical), "TEX_FR_FLIP_VERTICAL no longer matches WIC");
|
||||||
|
|
||||||
// Only supports 90, 180, 270, or no rotation flags... not a combination of rotation flags
|
// Only supports 90, 180, 270, or no rotation flags... not a combination of rotation flags
|
||||||
switch (flags & (TEX_FR_ROTATE90 | TEX_FR_ROTATE180 | TEX_FR_ROTATE270))
|
int rotateMode = static_cast<int>(flags & (TEX_FR_ROTATE0 | TEX_FR_ROTATE90 | TEX_FR_ROTATE180 | TEX_FR_ROTATE270));
|
||||||
|
|
||||||
|
switch (rotateMode)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
case TEX_FR_ROTATE90:
|
case TEX_FR_ROTATE90:
|
||||||
@ -225,7 +227,7 @@ HRESULT DirectX::FlipRotate(
|
|||||||
size_t nwidth = srcImage.width;
|
size_t nwidth = srcImage.width;
|
||||||
size_t nheight = srcImage.height;
|
size_t nheight = srcImage.height;
|
||||||
|
|
||||||
if (flags & (TEX_FR_ROTATE90 | TEX_FR_ROTATE270))
|
if ((rotateMode == TEX_FR_ROTATE90) || (rotateMode == TEX_FR_ROTATE270))
|
||||||
{
|
{
|
||||||
nwidth = srcImage.height;
|
nwidth = srcImage.height;
|
||||||
nheight = srcImage.width;
|
nheight = srcImage.width;
|
||||||
@ -301,7 +303,9 @@ HRESULT DirectX::FlipRotate(
|
|||||||
static_assert(static_cast<int>(TEX_FR_FLIP_VERTICAL) == static_cast<int>(WICBitmapTransformFlipVertical), "TEX_FR_FLIP_VERTICAL no longer matches WIC");
|
static_assert(static_cast<int>(TEX_FR_FLIP_VERTICAL) == static_cast<int>(WICBitmapTransformFlipVertical), "TEX_FR_FLIP_VERTICAL no longer matches WIC");
|
||||||
|
|
||||||
// Only supports 90, 180, 270, or no rotation flags... not a combination of rotation flags
|
// Only supports 90, 180, 270, or no rotation flags... not a combination of rotation flags
|
||||||
switch (flags & (TEX_FR_ROTATE90 | TEX_FR_ROTATE180 | TEX_FR_ROTATE270))
|
int rotateMode = static_cast<int>(flags & (TEX_FR_ROTATE0 | TEX_FR_ROTATE90 | TEX_FR_ROTATE180 | TEX_FR_ROTATE270));
|
||||||
|
|
||||||
|
switch (rotateMode)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
case TEX_FR_ROTATE90:
|
case TEX_FR_ROTATE90:
|
||||||
@ -316,7 +320,7 @@ HRESULT DirectX::FlipRotate(
|
|||||||
TexMetadata mdata2 = metadata;
|
TexMetadata mdata2 = metadata;
|
||||||
|
|
||||||
bool flipwh = false;
|
bool flipwh = false;
|
||||||
if (flags & (TEX_FR_ROTATE90 | TEX_FR_ROTATE270))
|
if ((rotateMode == TEX_FR_ROTATE90) || (rotateMode == TEX_FR_ROTATE270))
|
||||||
{
|
{
|
||||||
flipwh = true;
|
flipwh = true;
|
||||||
mdata2.width = metadata.height;
|
mdata2.width = metadata.height;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user