Dmitry Timoshkov : gdiplus: Pass complete palette info to convert_pixels().
Alexandre Julliard
julliard at winehq.org
Tue Jul 17 11:05:34 CDT 2012
Module: wine
Branch: master
Commit: 87f8e560c2fac142075fd17f1dd452eda68243cc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=87f8e560c2fac142075fd17f1dd452eda68243cc
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Tue Jul 17 15:00:21 2012 +0900
gdiplus: Pass complete palette info to convert_pixels().
---
dlls/gdiplus/gdiplus_private.h | 2 +-
dlls/gdiplus/graphics.c | 2 +-
dlls/gdiplus/image.c | 10 ++++++----
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index b7c808d..03942c0 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -120,7 +120,7 @@ extern void convert_32bppARGB_to_32bppPARGB(UINT width, UINT height,
extern GpStatus convert_pixels(INT width, INT height,
INT dst_stride, BYTE *dst_bits, PixelFormat dst_format,
- INT src_stride, const BYTE *src_bits, PixelFormat src_format, ARGB *src_palette) DECLSPEC_HIDDEN;
+ INT src_stride, const BYTE *src_bits, PixelFormat src_format, ColorPalette *palette) DECLSPEC_HIDDEN;
struct GpPen{
UINT style;
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 577824e..59dd77b 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -3274,7 +3274,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
convert_pixels(bitmap->width, bitmap->height,
bitmap->width*4, temp_bits, dst_format,
bitmap->stride, bitmap->bits, bitmap->format,
- bitmap->image.palette ? bitmap->image.palette->Entries : NULL);
+ bitmap->image.palette);
}
else
{
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 464de94..f9781ef 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -501,7 +501,8 @@ GpStatus WINGDIPAPI GdipBitmapSetPixel(GpBitmap* bitmap, INT x, INT y,
GpStatus convert_pixels(INT width, INT height,
INT dst_stride, BYTE *dst_bits, PixelFormat dst_format,
- INT src_stride, const BYTE *src_bits, PixelFormat src_format, ARGB *src_palette)
+ INT src_stride, const BYTE *src_bits, PixelFormat src_format,
+ ColorPalette *palette)
{
INT x, y;
@@ -518,9 +519,10 @@ GpStatus convert_pixels(INT width, INT height,
for (x=0; x<width; x++) \
for (y=0; y<height; y++) { \
BYTE index; \
- BYTE *color; \
+ ARGB argb; \
+ BYTE *color = (BYTE *)&argb; \
getpixel_function(&index, src_bits+src_stride*y, x); \
- color = (BYTE*)(&src_palette[index]); \
+ argb = (palette && index < palette->Count) ? palette->Entries[index] : 0; \
setpixel_function(color[2], color[1], color[0], color[3], dst_bits+dst_stride*y, x); \
} \
return Ok; \
@@ -1012,7 +1014,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
lockeddata->Stride, lockeddata->Scan0, format,
bitmap->stride,
bitmap->bits + bitmap->stride * act_rect.Y + PIXELFORMATBPP(bitmap->format) * act_rect.X / 8,
- bitmap->format, bitmap->image.palette ? bitmap->image.palette->Entries : NULL);
+ bitmap->format, bitmap->image.palette);
if (stat != Ok)
{
More information about the wine-cvs
mailing list