Commit c309883a authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Update the coordinates in convert_bitmapinfo to reflect the position in…

gdi32: Update the coordinates in convert_bitmapinfo to reflect the position in the destination bitmap.
parent 2ba1a437
...@@ -212,7 +212,7 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, ...@@ -212,7 +212,7 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
dst_info->bmiHeader.biWidth = src->visrect.right - src->visrect.left; dst_info->bmiHeader.biWidth = src->visrect.right - src->visrect.left;
if ((ptr = HeapAlloc( GetProcessHeap(), 0, get_dib_image_size( dst_info )))) if ((ptr = HeapAlloc( GetProcessHeap(), 0, get_dib_image_size( dst_info ))))
{ {
err = convert_bitmapinfo( src_info, bits.ptr, &src->visrect, dst_info, ptr ); err = convert_bitmapinfo( src_info, bits.ptr, src, dst_info, ptr );
if (bits.free) bits.free( &bits ); if (bits.free) bits.free( &bits );
bits.ptr = ptr; bits.ptr = ptr;
bits.is_copy = TRUE; bits.is_copy = TRUE;
......
...@@ -615,7 +615,7 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, ...@@ -615,7 +615,7 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
ptr = HeapAlloc( GetProcessHeap(), 0, get_dib_image_size( dst_info )); ptr = HeapAlloc( GetProcessHeap(), 0, get_dib_image_size( dst_info ));
if (ptr) if (ptr)
{ {
err = convert_bitmapinfo( src_info, src_bits.ptr, &src.visrect, dst_info, ptr ); err = convert_bitmapinfo( src_info, src_bits.ptr, &src, dst_info, ptr );
{ {
if (src_bits.free) src_bits.free( &src_bits ); if (src_bits.free) src_bits.free( &src_bits );
src_bits.ptr = ptr; src_bits.ptr = ptr;
...@@ -1134,7 +1134,7 @@ INT WINAPI GetDIBits( ...@@ -1134,7 +1134,7 @@ INT WINAPI GetDIBits(
else else
dst_info->bmiHeader.biHeight = -src.height; dst_info->bmiHeader.biHeight = -src.height;
convert_bitmapinfo( src_info, src_bits.ptr, &src.visrect, dst_info, bits ); convert_bitmapinfo( src_info, src_bits.ptr, &src, dst_info, bits );
if (src_bits.free) src_bits.free( &src_bits ); if (src_bits.free) src_bits.free( &src_bits );
} }
else lines = abs(height); else lines = abs(height);
......
...@@ -260,7 +260,7 @@ void copy_dib_color_info(dib_info *dst, const dib_info *src) ...@@ -260,7 +260,7 @@ void copy_dib_color_info(dib_info *dst, const dib_info *src)
} }
} }
DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, const RECT *src_rect, DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitblt_coords *src,
const BITMAPINFO *dst_info, void *dst_bits ) const BITMAPINFO *dst_info, void *dst_bits )
{ {
dib_info src_dib, dst_dib; dib_info src_dib, dst_dib;
...@@ -271,11 +271,15 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, const RECT ...@@ -271,11 +271,15 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, const RECT
if ( !init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits, 0 ) ) if ( !init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits, 0 ) )
return ERROR_BAD_FORMAT; return ERROR_BAD_FORMAT;
ret = dst_dib.funcs->convert_to( &dst_dib, &src_dib, src_rect ); ret = dst_dib.funcs->convert_to( &dst_dib, &src_dib, &src->visrect );
/* We shared the color tables, so there's no need to free the dib_infos here */ /* We shared the color tables, so there's no need to free the dib_infos here */
if(!ret) return ERROR_BAD_FORMAT; if(!ret) return ERROR_BAD_FORMAT;
/* update coordinates, the destination rectangle is always stored at 0,0 */
src->x -= src->visrect.left;
src->y -= src->visrect.top;
offset_rect( &src->visrect, -src->visrect.left, -src->visrect.top );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
......
...@@ -340,7 +340,7 @@ extern void DC_UpdateXforms( DC * dc ) DECLSPEC_HIDDEN; ...@@ -340,7 +340,7 @@ extern void DC_UpdateXforms( DC * dc ) DECLSPEC_HIDDEN;
extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN; extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN;
extern int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width, extern int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size ) DECLSPEC_HIDDEN; LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size ) DECLSPEC_HIDDEN;
extern DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, const RECT *src_rect, extern DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitblt_coords *src,
const BITMAPINFO *dst_info, void *dst_bits ) DECLSPEC_HIDDEN; const BITMAPINFO *dst_info, void *dst_bits ) DECLSPEC_HIDDEN;
......
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