Commit 8a9be0a3 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Get rid of the get_bitmap_funcs function.

DIBs no longer use the display driver functions.
parent 66774bab
...@@ -337,10 +337,8 @@ LONG WINAPI GetBitmapBits( ...@@ -337,10 +337,8 @@ LONG WINAPI GetBitmapBits(
struct bitblt_coords src; struct bitblt_coords src;
int dst_stride, max, ret; int dst_stride, max, ret;
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ); BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
const struct gdi_dc_funcs *funcs;
if (!bmp) return 0; if (!bmp) return 0;
funcs = get_bitmap_funcs( bmp );
dst_stride = get_bitmap_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel ); dst_stride = get_bitmap_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel );
ret = max = dst_stride * bmp->bitmap.bmHeight; ret = max = dst_stride * bmp->bitmap.bmHeight;
...@@ -356,7 +354,7 @@ LONG WINAPI GetBitmapBits( ...@@ -356,7 +354,7 @@ LONG WINAPI GetBitmapBits(
src.width = src.visrect.right - src.visrect.left; src.width = src.visrect.right - src.visrect.left;
src.height = src.visrect.bottom - src.visrect.top; src.height = src.visrect.bottom - src.visrect.top;
if (!funcs->pGetImage( NULL, hbitmap, info, &src_bits, &src )) if (!bmp->funcs->pGetImage( NULL, hbitmap, info, &src_bits, &src ))
{ {
const char *src_ptr = src_bits.ptr; const char *src_ptr = src_bits.ptr;
int src_stride = get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount ); int src_stride = get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount );
...@@ -410,15 +408,12 @@ LONG WINAPI SetBitmapBits( ...@@ -410,15 +408,12 @@ LONG WINAPI SetBitmapBits(
struct bitblt_coords src, dst; struct bitblt_coords src, dst;
struct gdi_image_bits src_bits; struct gdi_image_bits src_bits;
HRGN clip = NULL; HRGN clip = NULL;
const struct gdi_dc_funcs *funcs;
if (!bits) return 0; if (!bits) return 0;
bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ); bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
if (!bmp) return 0; if (!bmp) return 0;
funcs = get_bitmap_funcs( bmp );
if (count < 0) { if (count < 0) {
WARN("(%d): Negative number of bytes passed???\n", count ); WARN("(%d): Negative number of bytes passed???\n", count );
count = -count; count = -count;
...@@ -487,14 +482,14 @@ LONG WINAPI SetBitmapBits( ...@@ -487,14 +482,14 @@ LONG WINAPI SetBitmapBits(
info->bmiHeader.biWidth = 0; info->bmiHeader.biWidth = 0;
info->bmiHeader.biHeight = 0; info->bmiHeader.biHeight = 0;
info->bmiHeader.biSizeImage = 0; info->bmiHeader.biSizeImage = 0;
err = funcs->pPutImage( NULL, hbitmap, 0, info, NULL, NULL, NULL, SRCCOPY ); err = bmp->funcs->pPutImage( NULL, hbitmap, 0, info, NULL, NULL, NULL, SRCCOPY );
if (!err || err == ERROR_BAD_FORMAT) if (!err || err == ERROR_BAD_FORMAT)
{ {
info->bmiHeader.biWidth = bmp->bitmap.bmWidth; info->bmiHeader.biWidth = bmp->bitmap.bmWidth;
info->bmiHeader.biHeight = -dst.height; info->bmiHeader.biHeight = -dst.height;
info->bmiHeader.biSizeImage = dst.height * dst_stride; info->bmiHeader.biSizeImage = dst.height * dst_stride;
err = funcs->pPutImage( NULL, hbitmap, clip, info, &src_bits, &src, &dst, SRCCOPY ); err = bmp->funcs->pPutImage( NULL, hbitmap, clip, info, &src_bits, &src, &dst, SRCCOPY );
} }
if (err) count = 0; if (err) count = 0;
......
...@@ -58,7 +58,6 @@ static const struct gdi_obj_funcs brush_funcs = ...@@ -58,7 +58,6 @@ static const struct gdi_obj_funcs brush_funcs =
/* fetch the contents of the brush bitmap and cache them in the brush pattern */ /* fetch the contents of the brush bitmap and cache them in the brush pattern */
void cache_pattern_bits( PHYSDEV physdev, struct brush_pattern *pattern ) void cache_pattern_bits( PHYSDEV physdev, struct brush_pattern *pattern )
{ {
const struct gdi_dc_funcs *funcs;
struct gdi_image_bits bits; struct gdi_image_bits bits;
struct bitblt_coords src; struct bitblt_coords src;
BITMAPINFO *info; BITMAPINFO *info;
...@@ -76,8 +75,7 @@ void cache_pattern_bits( PHYSDEV physdev, struct brush_pattern *pattern ) ...@@ -76,8 +75,7 @@ void cache_pattern_bits( PHYSDEV physdev, struct brush_pattern *pattern )
src.visrect.top = src.y = 0; src.visrect.top = src.y = 0;
src.visrect.right = src.width = bmp->bitmap.bmWidth; src.visrect.right = src.width = bmp->bitmap.bmWidth;
src.visrect.bottom = src.height = bmp->bitmap.bmHeight; src.visrect.bottom = src.height = bmp->bitmap.bmHeight;
funcs = get_bitmap_funcs( bmp ); if (bmp->funcs->pGetImage( NULL, pattern->bitmap, info, &bits, &src ))
if (funcs->pGetImage( NULL, pattern->bitmap, info, &bits, &src ))
{ {
HeapFree( GetProcessHeap(), 0, info ); HeapFree( GetProcessHeap(), 0, info );
goto done; goto done;
......
...@@ -657,7 +657,6 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, ...@@ -657,7 +657,6 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
struct bitblt_coords src, dst; struct bitblt_coords src, dst;
INT src_to_dst_offset; INT src_to_dst_offset;
HRGN clip = 0; HRGN clip = 0;
const struct gdi_dc_funcs *funcs;
if (!bitmapinfo_from_user_bitmapinfo( src_info, info, coloruse, TRUE ) || coloruse > DIB_PAL_COLORS) if (!bitmapinfo_from_user_bitmapinfo( src_info, info, coloruse, TRUE ) || coloruse > DIB_PAL_COLORS)
{ {
...@@ -715,8 +714,6 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, ...@@ -715,8 +714,6 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
if (lines < src.visrect.bottom) src.visrect.bottom = lines; if (lines < src.visrect.bottom) src.visrect.bottom = lines;
} }
funcs = get_bitmap_funcs( bitmap );
result = lines; result = lines;
offset_rect( &src.visrect, 0, src_to_dst_offset ); offset_rect( &src.visrect, 0, src_to_dst_offset );
...@@ -736,11 +733,11 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, ...@@ -736,11 +733,11 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
copy_bitmapinfo( dst_info, src_info ); copy_bitmapinfo( dst_info, src_info );
err = funcs->pPutImage( NULL, hbitmap, clip, dst_info, &src_bits, &src, &dst, 0 ); err = bitmap->funcs->pPutImage( NULL, hbitmap, clip, dst_info, &src_bits, &src, &dst, 0 );
if (err == ERROR_BAD_FORMAT) if (err == ERROR_BAD_FORMAT)
{ {
err = convert_bits( src_info, &src, dst_info, &src_bits, FALSE ); err = convert_bits( src_info, &src, dst_info, &src_bits, FALSE );
if (!err) err = funcs->pPutImage( NULL, hbitmap, clip, dst_info, &src_bits, &src, &dst, 0 ); if (!err) err = bitmap->funcs->pPutImage( NULL, hbitmap, clip, dst_info, &src_bits, &src, &dst, 0 );
} }
if(err) result = 0; if(err) result = 0;
...@@ -1212,7 +1209,6 @@ INT WINAPI GetDIBits( ...@@ -1212,7 +1209,6 @@ INT WINAPI GetDIBits(
BITMAPINFO *dst_info = (BITMAPINFO *)dst_bmibuf; BITMAPINFO *dst_info = (BITMAPINFO *)dst_bmibuf;
char src_bmibuf[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; char src_bmibuf[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
BITMAPINFO *src_info = (BITMAPINFO *)src_bmibuf; BITMAPINFO *src_info = (BITMAPINFO *)src_bmibuf;
const struct gdi_dc_funcs *funcs;
struct gdi_image_bits src_bits; struct gdi_image_bits src_bits;
struct bitblt_coords src, dst; struct bitblt_coords src, dst;
BOOL empty_rect = FALSE; BOOL empty_rect = FALSE;
...@@ -1239,8 +1235,6 @@ INT WINAPI GetDIBits( ...@@ -1239,8 +1235,6 @@ INT WINAPI GetDIBits(
return 0; return 0;
} }
funcs = get_bitmap_funcs( bmp );
src.visrect.left = 0; src.visrect.left = 0;
src.visrect.top = 0; src.visrect.top = 0;
src.visrect.right = bmp->bitmap.bmWidth; src.visrect.right = bmp->bitmap.bmWidth;
...@@ -1348,7 +1342,7 @@ INT WINAPI GetDIBits( ...@@ -1348,7 +1342,7 @@ INT WINAPI GetDIBits(
lines = src.height; lines = src.height;
} }
err = funcs->pGetImage( NULL, hbitmap, src_info, bits ? &src_bits : NULL, bits ? &src : NULL ); err = bmp->funcs->pGetImage( NULL, hbitmap, src_info, bits ? &src_bits : NULL, bits ? &src : NULL );
if (err) goto done; if (err) goto done;
......
...@@ -486,12 +486,6 @@ static inline void copy_bitmapinfo( BITMAPINFO *dst, const BITMAPINFO *src ) ...@@ -486,12 +486,6 @@ static inline void copy_bitmapinfo( BITMAPINFO *dst, const BITMAPINFO *src )
memcpy( dst, src, get_dib_info_size( src, DIB_RGB_COLORS )); memcpy( dst, src, get_dib_info_size( src, DIB_RGB_COLORS ));
} }
static inline const struct gdi_dc_funcs *get_bitmap_funcs( const BITMAPOBJ *bitmap )
{
if( bitmap->dib ) return &dib_driver;
return bitmap->funcs;
}
extern void free_heap_bits( struct gdi_image_bits *bits ) DECLSPEC_HIDDEN; extern void free_heap_bits( struct gdi_image_bits *bits ) DECLSPEC_HIDDEN;
extern HMODULE gdi32_module DECLSPEC_HIDDEN; extern HMODULE gdi32_module 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