windowscodecs: Avoid extra conversion step BGR->RGB when converting 32bpp BGRA to 24bpp RGB.
Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e5ffb180c4
commit
7431380e38
@ -953,6 +953,7 @@ static HRESULT copypixels_to_24bppRGB(struct FormatConverter *This, const WICRec
|
||||
const BYTE *srcpixel;
|
||||
BYTE *dstrow;
|
||||
BYTE *dstpixel;
|
||||
BYTE tmppixel[3];
|
||||
|
||||
srcstride = 4 * prc->Width;
|
||||
srcdatasize = srcstride * prc->Height;
|
||||
@ -970,16 +971,18 @@ static HRESULT copypixels_to_24bppRGB(struct FormatConverter *This, const WICRec
|
||||
srcpixel=srcrow;
|
||||
dstpixel=dstrow;
|
||||
for (x=0; x<prc->Width; x++) {
|
||||
*dstpixel++=*srcpixel++; /* blue */
|
||||
*dstpixel++=*srcpixel++; /* green */
|
||||
*dstpixel++=*srcpixel++; /* red */
|
||||
tmppixel[0]=*srcpixel++; /* blue */
|
||||
tmppixel[1]=*srcpixel++; /* green */
|
||||
tmppixel[2]=*srcpixel++; /* red */
|
||||
srcpixel++; /* alpha */
|
||||
|
||||
*dstpixel++=tmppixel[2]; /* red */
|
||||
*dstpixel++=tmppixel[1]; /* green */
|
||||
*dstpixel++=tmppixel[0]; /* blue */
|
||||
}
|
||||
srcrow += srcstride;
|
||||
dstrow += cbStride;
|
||||
}
|
||||
|
||||
reverse_bgr8(3, pbBuffer, prc->Width, prc->Height, cbStride);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, srcdata);
|
||||
|
@ -733,6 +733,7 @@ START_TEST(converter)
|
||||
|
||||
test_conversion(&testdata_32bppBGR, &testdata_24bppRGB, "32bppBGR -> 24bppRGB", FALSE);
|
||||
test_conversion(&testdata_24bppRGB, &testdata_32bppBGR, "24bppRGB -> 32bppBGR", FALSE);
|
||||
test_conversion(&testdata_32bppBGRA, &testdata_24bppRGB, "32bppBGRA -> 24bppRGB", FALSE);
|
||||
|
||||
test_invalid_conversion();
|
||||
test_default_converter();
|
||||
|
Loading…
x
Reference in New Issue
Block a user