Alexandre Julliard : winex11: Add support for bottom-up format in PutImage.
Alexandre Julliard
julliard at winehq.org
Thu Jul 14 13:08:12 CDT 2011
Module: wine
Branch: master
Commit: eeb3625dce04836fb33dcaad32cb2d843e09c685
URL: http://source.winehq.org/git/wine.git/?a=commit;h=eeb3625dce04836fb33dcaad32cb2d843e09c685
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Jul 14 13:09:38 2011 +0200
winex11: Add support for bottom-up format in PutImage.
---
dlls/winex11.drv/bitblt.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c
index d76ceba..f252e42 100644
--- a/dlls/winex11.drv/bitblt.c
+++ b/dlls/winex11.drv/bitblt.c
@@ -1641,8 +1641,8 @@ static DWORD copy_image_bits( BITMAPINFO *info, const ColorShifts *color_shifts,
const struct gdi_image_bits *src_bits, struct gdi_image_bits *dst_bits )
{
BOOL need_byteswap;
- int x, y, height = -info->bmiHeader.biHeight;
- unsigned int width_bytes = image->bytes_per_line;
+ int x, y, height = abs(info->bmiHeader.biHeight);
+ int width_bytes = image->bytes_per_line;
unsigned char *src, *dst;
switch (info->bmiHeader.biBitCount)
@@ -1666,7 +1666,7 @@ static DWORD copy_image_bits( BITMAPINFO *info, const ColorShifts *color_shifts,
break;
}
- if ((need_byteswap && !src_bits->is_copy) || (width_bytes & 3))
+ if ((need_byteswap && !src_bits->is_copy) || (width_bytes & 3) || (info->bmiHeader.biHeight > 0))
{
width_bytes = (width_bytes + 3) & ~3;
info->bmiHeader.biSizeImage = height * width_bytes;
@@ -1689,6 +1689,12 @@ static DWORD copy_image_bits( BITMAPINFO *info, const ColorShifts *color_shifts,
src = src_bits->ptr;
dst = dst_bits->ptr;
+ if (info->bmiHeader.biHeight > 0)
+ {
+ dst += (height - 1) * width_bytes;
+ width_bytes = -width_bytes;
+ }
+
if (need_byteswap)
{
switch (info->bmiHeader.biBitCount)
@@ -1768,7 +1774,6 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, const str
if (info->bmiHeader.biPlanes != 1) goto update_format;
if (info->bmiHeader.biBitCount != format->bits_per_pixel) goto update_format;
- if (info->bmiHeader.biHeight > 0) goto update_format; /* bottom-up not supported */
/* FIXME: could try to handle 1-bpp using XCopyPlane */
if (info->bmiHeader.biCompression == BI_BITFIELDS)
@@ -1804,7 +1809,7 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, const str
wine_tsx11_lock();
image = XCreateImage( gdi_display, visual, depth, ZPixmap, 0, NULL,
- info->bmiHeader.biWidth, -info->bmiHeader.biHeight, 32, 0 );
+ info->bmiHeader.biWidth, abs(info->bmiHeader.biHeight), 32, 0 );
wine_tsx11_unlock();
if (!image) return ERROR_OUTOFMEMORY;
More information about the wine-cvs
mailing list