Commit 7431380e authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

windowscodecs: Avoid extra conversion step BGR->RGB when converting 32bpp BGRA to 24bpp RGB.

parent e5ffb180
...@@ -953,6 +953,7 @@ static HRESULT copypixels_to_24bppRGB(struct FormatConverter *This, const WICRec ...@@ -953,6 +953,7 @@ static HRESULT copypixels_to_24bppRGB(struct FormatConverter *This, const WICRec
const BYTE *srcpixel; const BYTE *srcpixel;
BYTE *dstrow; BYTE *dstrow;
BYTE *dstpixel; BYTE *dstpixel;
BYTE tmppixel[3];
srcstride = 4 * prc->Width; srcstride = 4 * prc->Width;
srcdatasize = srcstride * prc->Height; srcdatasize = srcstride * prc->Height;
...@@ -970,16 +971,18 @@ static HRESULT copypixels_to_24bppRGB(struct FormatConverter *This, const WICRec ...@@ -970,16 +971,18 @@ static HRESULT copypixels_to_24bppRGB(struct FormatConverter *This, const WICRec
srcpixel=srcrow; srcpixel=srcrow;
dstpixel=dstrow; dstpixel=dstrow;
for (x=0; x<prc->Width; x++) { for (x=0; x<prc->Width; x++) {
*dstpixel++=*srcpixel++; /* blue */ tmppixel[0]=*srcpixel++; /* blue */
*dstpixel++=*srcpixel++; /* green */ tmppixel[1]=*srcpixel++; /* green */
*dstpixel++=*srcpixel++; /* red */ tmppixel[2]=*srcpixel++; /* red */
srcpixel++; /* alpha */ srcpixel++; /* alpha */
*dstpixel++=tmppixel[2]; /* red */
*dstpixel++=tmppixel[1]; /* green */
*dstpixel++=tmppixel[0]; /* blue */
} }
srcrow += srcstride; srcrow += srcstride;
dstrow += cbStride; dstrow += cbStride;
} }
reverse_bgr8(3, pbBuffer, prc->Width, prc->Height, cbStride);
} }
HeapFree(GetProcessHeap(), 0, srcdata); HeapFree(GetProcessHeap(), 0, srcdata);
......
...@@ -733,6 +733,7 @@ START_TEST(converter) ...@@ -733,6 +733,7 @@ START_TEST(converter)
test_conversion(&testdata_32bppBGR, &testdata_24bppRGB, "32bppBGR -> 24bppRGB", FALSE); test_conversion(&testdata_32bppBGR, &testdata_24bppRGB, "32bppBGR -> 24bppRGB", FALSE);
test_conversion(&testdata_24bppRGB, &testdata_32bppBGR, "24bppRGB -> 32bppBGR", FALSE); test_conversion(&testdata_24bppRGB, &testdata_32bppBGR, "24bppRGB -> 32bppBGR", FALSE);
test_conversion(&testdata_32bppBGRA, &testdata_24bppRGB, "32bppBGRA -> 24bppRGB", FALSE);
test_invalid_conversion(); test_invalid_conversion();
test_default_converter(); test_default_converter();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment