4 * Copyright 1993 Alexandre Julliard
11 #include <X11/Xutil.h>
20 #ifdef PRELIMINARY_WING16_SUPPORT
21 #include <sys/types.h>
26 /* GCs used for B&W and color bitmap operations */
27 GC BITMAP_monoGC
= 0, BITMAP_colorGC
= 0;
29 extern void CLIPPING_UpdateGCRegion( DC
* dc
); /* objects/clipping.c */
32 /***********************************************************************
35 * Wrapper to call XPutImage with CALL_LARGE_STACK.
38 struct XPutImage_descr
46 static int XPutImage_wrapper( const struct XPutImage_descr
*descr
)
48 return XPutImage( display
, descr
->bmp
->pixmap
, BITMAP_GC(descr
->bmp
),
49 descr
->image
, 0, 0, 0, 0, descr
->width
, descr
->height
);
52 /***********************************************************************
53 * BITMAP_GetBitsPadding
55 * Return number of bytes to pad a scanline of 16-bit aligned Windows DDB data.
57 INT32
BITMAP_GetBitsPadding( int bmWidth
, int bpp
)
64 if (!(bmWidth
& 15)) pad
= 0;
65 else pad
= ((16 - (bmWidth
& 15)) + 7) / 8;
69 pad
= (2 - (bmWidth
& 1)) & 1;
73 pad
= (bmWidth
*3) & 1;
79 pad
= 0; /* we have 16bit alignment already */
83 if (!(bmWidth
& 3)) pad
= 0;
84 else pad
= ((4 - (bmWidth
& 3)) + 1) / 2;
88 fprintf(stderr
,"GetBitsPadding: unknown depth %d, please report.\n", bpp
);
94 /***********************************************************************
97 * Return number of bytes taken by a scanline of 16-bit aligned Windows DDB data.
99 INT32
BITMAP_GetBitsWidth( int bmWidth
, int bpp
)
104 return 2 * ((bmWidth
+15) >> 4);
107 bmWidth
*= 3; /* fall through */
109 return bmWidth
+ (bmWidth
& 1);
119 return 2 * ((bmWidth
+3) >> 2);
122 fprintf(stderr
,"GetBitsPadding: unknown depth %d, please report.\n", bpp
);
127 /***********************************************************************
128 * CreateBitmap16 (GDI.48)
130 HBITMAP16 WINAPI
CreateBitmap16( INT16 width
, INT16 height
, UINT16 planes
,
131 UINT16 bpp
, LPCVOID bits
)
133 return CreateBitmap32( width
, height
, planes
, bpp
, bits
);
137 /***********************************************************************
138 * CreateBitmap32 (GDI32.25)
140 HBITMAP32 WINAPI
CreateBitmap32( INT32 width
, INT32 height
, UINT32 planes
,
141 UINT32 bpp
, LPCVOID bits
)
143 BITMAPOBJ
* bmpObjPtr
;
146 planes
= (BYTE
)planes
;
149 dprintf_gdi( stddeb
, "CreateBitmap: %dx%d, %d colors\n",
150 width
, height
, 1 << (planes
*bpp
) );
152 /* Check parameters */
153 if (!height
|| !width
|| planes
!= 1) return 0;
154 if ((bpp
!= 1) && (bpp
!= screenDepth
)) return 0;
155 if (height
< 0) height
= -height
;
156 if (width
< 0) width
= -width
;
158 /* Create the BITMAPOBJ */
159 hbitmap
= GDI_AllocObject( sizeof(BITMAPOBJ
), BITMAP_MAGIC
);
160 if (!hbitmap
) return 0;
161 bmpObjPtr
= (BITMAPOBJ
*) GDI_HEAP_LOCK( hbitmap
);
163 bmpObjPtr
->size
.cx
= 0;
164 bmpObjPtr
->size
.cy
= 0;
165 bmpObjPtr
->bitmap
.bmType
= 0;
166 bmpObjPtr
->bitmap
.bmWidth
= (INT16
)width
;
167 bmpObjPtr
->bitmap
.bmHeight
= (INT16
)height
;
168 bmpObjPtr
->bitmap
.bmPlanes
= (BYTE
)planes
;
169 bmpObjPtr
->bitmap
.bmBitsPixel
= (BYTE
)bpp
;
170 bmpObjPtr
->bitmap
.bmWidthBytes
= (INT16
)BITMAP_WIDTH_BYTES( width
, bpp
);
171 bmpObjPtr
->bitmap
.bmBits
= NULL
;
173 /* Create the pixmap */
174 bmpObjPtr
->pixmap
= XCreatePixmap(display
, rootWindow
, width
, height
, bpp
);
175 if (!bmpObjPtr
->pixmap
)
177 GDI_HEAP_FREE( hbitmap
);
180 else if (bits
) /* Set bitmap bits */
181 SetBitmapBits32( hbitmap
, height
* bmpObjPtr
->bitmap
.bmWidthBytes
,
183 GDI_HEAP_UNLOCK( hbitmap
);
188 /***********************************************************************
189 * CreateCompatibleBitmap16 (GDI.51)
191 HBITMAP16 WINAPI
CreateCompatibleBitmap16(HDC16 hdc
, INT16 width
, INT16 height
)
193 return CreateCompatibleBitmap32( hdc
, width
, height
);
197 /***********************************************************************
198 * CreateCompatibleBitmap32 (GDI32.30)
200 HBITMAP32 WINAPI
CreateCompatibleBitmap32(HDC32 hdc
, INT32 width
, INT32 height
)
202 HBITMAP32 hbmpRet
= 0;
205 dprintf_gdi( stddeb
, "CreateCompatibleBitmap(%04x,%d,%d) = \n",
206 hdc
, width
, height
);
207 if (!(dc
= DC_GetDCPtr( hdc
))) return 0;
208 hbmpRet
= CreateBitmap32( width
, height
, 1, dc
->w
.bitsPerPixel
, NULL
);
209 dprintf_gdi(stddeb
,"\t\t%04x\n", hbmpRet
);
214 /***********************************************************************
215 * CreateBitmapIndirect16 (GDI.49)
217 HBITMAP16 WINAPI
CreateBitmapIndirect16( const BITMAP16
* bmp
)
219 return CreateBitmap16( bmp
->bmWidth
, bmp
->bmHeight
, bmp
->bmPlanes
,
220 bmp
->bmBitsPixel
, PTR_SEG_TO_LIN( bmp
->bmBits
) );
224 /***********************************************************************
225 * CreateBitmapIndirect32 (GDI32.26)
227 HBITMAP32 WINAPI
CreateBitmapIndirect32( const BITMAP32
* bmp
)
229 return CreateBitmap32( bmp
->bmWidth
, bmp
->bmHeight
, bmp
->bmPlanes
,
230 bmp
->bmBitsPixel
, bmp
->bmBits
);
234 /***********************************************************************
237 * Get an X image for a bitmap. For use with CALL_LARGE_STACK.
239 XImage
*BITMAP_GetXImage( const BITMAPOBJ
*bmp
)
241 return XGetImage( display
, bmp
->pixmap
, 0, 0, bmp
->bitmap
.bmWidth
,
242 bmp
->bitmap
.bmHeight
, AllPlanes
, ZPixmap
);
246 /***********************************************************************
247 * GetBitmapBits16 (GDI.74)
249 LONG WINAPI
GetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPVOID buffer
)
251 return GetBitmapBits32( hbitmap
, count
, buffer
);
255 /***********************************************************************
256 * GetBitmapBits32 (GDI32.143)
258 LONG WINAPI
GetBitmapBits32( HBITMAP32 hbitmap
, LONG count
, LPVOID buffer
)
261 LONG height
, old_height
;
268 fprintf(stderr
, "Negative number of bytes (%ld) passed to GetBitmapBits???\n", count
);
271 bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
274 /* Only get entire lines */
275 height
= count
/ bmp
->bitmap
.bmWidthBytes
;
276 if (height
> bmp
->bitmap
.bmHeight
) height
= bmp
->bitmap
.bmHeight
;
278 dprintf_bitmap(stddeb
, "GetBitmapBits: %dx%d %d colors %p fetched height: %ld\n",
279 bmp
->bitmap
.bmWidth
, bmp
->bitmap
.bmHeight
,
280 1 << bmp
->bitmap
.bmBitsPixel
, buffer
, height
);
282 pad
= BITMAP_GetBitsPadding( bmp
->bitmap
.bmWidth
, bmp
->bitmap
.bmBitsPixel
);
284 if (!height
|| (pad
== -1))
286 GDI_HEAP_UNLOCK( hbitmap
);
290 /* Hack: change the bitmap height temporarily to avoid */
291 /* getting unnecessary bitmap rows. */
292 old_height
= bmp
->bitmap
.bmHeight
;
293 bmp
->bitmap
.bmHeight
= height
;
294 image
= (XImage
*)CALL_LARGE_STACK( BITMAP_GetXImage
, bmp
);
295 bmp
->bitmap
.bmHeight
= old_height
;
297 /* copy XImage to 16 bit padded image buffer with real bitsperpixel */
300 switch (bmp
->bitmap
.bmBitsPixel
)
303 for (h
=0;h
<height
;h
++)
306 for (w
=0;w
<bmp
->bitmap
.bmWidth
;w
++)
310 *tbuf
|= XGetPixel(image
,w
,h
)<<(7-(w
&7));
311 if ((w
&7) == 7) ++tbuf
;
317 for (h
=0;h
<height
;h
++)
319 for (w
=0;w
<bmp
->bitmap
.bmWidth
;w
++)
321 if (!(w
& 1)) *tbuf
= XGetPixel( image
, w
, h
) << 4;
322 else *tbuf
++ |= XGetPixel( image
, w
, h
) & 0x0f;
328 for (h
=0;h
<height
;h
++)
330 for (w
=0;w
<bmp
->bitmap
.bmWidth
;w
++)
331 *tbuf
++ = XGetPixel(image
,w
,h
);
337 for (h
=0;h
<height
;h
++)
339 for (w
=0;w
<bmp
->bitmap
.bmWidth
;w
++)
341 long pixel
= XGetPixel(image
,w
,h
);
343 *tbuf
++ = pixel
& 0xff;
344 *tbuf
++ = (pixel
>>8) & 0xff;
349 for (h
=0;h
<height
;h
++)
351 for (w
=0;w
<bmp
->bitmap
.bmWidth
;w
++)
353 long pixel
= XGetPixel(image
,w
,h
);
355 *tbuf
++ = pixel
& 0xff;
356 *tbuf
++ = (pixel
>> 8) & 0xff;
357 *tbuf
++ = (pixel
>>16) & 0xff;
362 XDestroyImage( image
);
363 GDI_HEAP_UNLOCK( hbitmap
);
364 return height
* bmp
->bitmap
.bmWidthBytes
;
368 /***********************************************************************
369 * SetBitmapBits16 (GDI.106)
371 LONG WINAPI
SetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPCVOID buffer
)
373 return SetBitmapBits32( hbitmap
, count
, buffer
);
377 /***********************************************************************
378 * SetBitmapBits32 (GDI32.303)
380 LONG WINAPI
SetBitmapBits32( HBITMAP32 hbitmap
, LONG count
, LPCVOID buffer
)
382 struct XPutImage_descr descr
;
386 LPBYTE sbuf
,tmpbuffer
;
387 int w
,h
,pad
,widthbytes
;
391 fprintf(stderr
, "Negative number of bytes (%ld) passed to SetBitmapBits???\n", count
);
394 bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
397 dprintf_bitmap(stddeb
, "SetBitmapBits: %dx%d %d colors %p\n",
398 bmp
->bitmap
.bmWidth
, bmp
->bitmap
.bmHeight
,
399 1 << bmp
->bitmap
.bmBitsPixel
, buffer
);
401 /* Only set entire lines */
402 height
= count
/ bmp
->bitmap
.bmWidthBytes
;
403 if (height
> bmp
->bitmap
.bmHeight
) height
= bmp
->bitmap
.bmHeight
;
405 pad
= BITMAP_GetBitsPadding( bmp
->bitmap
.bmWidth
, bmp
->bitmap
.bmBitsPixel
);
407 if (!height
|| (pad
== -1))
409 GDI_HEAP_UNLOCK( hbitmap
);
413 sbuf
= (LPBYTE
)buffer
;
415 widthbytes
= DIB_GetXImageWidthBytes(bmp
->bitmap
.bmWidth
,bmp
->bitmap
.bmBitsPixel
);
416 tmpbuffer
= (LPBYTE
)xmalloc(widthbytes
*height
);
417 image
= XCreateImage( display
, DefaultVisualOfScreen(screen
),
418 bmp
->bitmap
.bmBitsPixel
, ZPixmap
, 0, tmpbuffer
,
419 bmp
->bitmap
.bmWidth
,height
,32,widthbytes
422 /* copy 16 bit padded image buffer with real bitsperpixel to XImage */
423 sbuf
= (LPBYTE
)buffer
;
424 switch (bmp
->bitmap
.bmBitsPixel
)
427 for (h
=0;h
<height
;h
++)
429 for (w
=0;w
<bmp
->bitmap
.bmWidth
;w
++)
431 XPutPixel(image
,w
,h
,(sbuf
[0]>>(7-(w
&7))) & 1);
439 for (h
=0;h
<height
;h
++)
441 for (w
=0;w
<bmp
->bitmap
.bmWidth
;w
++)
443 if (!(w
& 1)) XPutPixel( image
, w
, h
, *sbuf
>> 4 );
444 else XPutPixel( image
, w
, h
, *sbuf
++ & 0xf );
450 for (h
=0;h
<height
;h
++)
452 for (w
=0;w
<bmp
->bitmap
.bmWidth
;w
++)
453 XPutPixel(image
,w
,h
,*sbuf
++);
459 for (h
=0;h
<height
;h
++)
461 for (w
=0;w
<bmp
->bitmap
.bmWidth
;w
++)
463 XPutPixel(image
,w
,h
,sbuf
[1]*256+sbuf
[0]);
469 for (h
=0;h
<height
;h
++)
471 for (w
=0;w
<bmp
->bitmap
.bmWidth
;w
++)
473 XPutPixel(image
,w
,h
,(sbuf
[2]<<16)+(sbuf
[1]<<8)+sbuf
[0]);
483 descr
.width
= bmp
->bitmap
.bmWidth
;
484 descr
.height
= height
;
485 CALL_LARGE_STACK( XPutImage_wrapper
, &descr
);
487 XDestroyImage( image
); /* frees tmpbuffer too */
488 GDI_HEAP_UNLOCK( hbitmap
);
489 return height
* bmp
->bitmap
.bmWidthBytes
;
492 /**********************************************************************
493 * LoadImageA (USER32.364)
494 * FIXME: implementation still lacks nearly all features, see LR_*
495 * defines in windows.h
498 HANDLE32 WINAPI
LoadImage32A( HINSTANCE32 hinst
, LPCSTR name
, UINT32 type
,
499 INT32 desiredx
, INT32 desiredy
, UINT32 loadflags
)
502 dprintf_resource(stddeb
,"LoadImage32A(0x%04x,%s,%d,%d,%d,0x%08x)\n",
503 hinst
,name
,type
,desiredx
,desiredy
,loadflags
506 dprintf_resource(stddeb
,"LoadImage32A(0x%04x,%p,%d,%d,%d,0x%08x)\n",
507 hinst
,name
,type
,desiredx
,desiredy
,loadflags
512 return LoadBitmap32A(hinst
,name
);
514 return LoadIcon32A(hinst
,name
);
516 return LoadCursor32A(hinst
,name
);
521 HANDLE32 WINAPI
LoadImage32W( HINSTANCE32 hinst
, LPCWSTR name
, UINT32 type
,
522 INT32 desiredx
, INT32 desiredy
, UINT32 loadflags
)
525 dprintf_resource(stddeb
,"LoadImage32W(0x%04x,%p,%d,%d,%d,0x%08x)\n",
526 hinst
,name
,type
,desiredx
,desiredy
,loadflags
529 dprintf_resource(stddeb
,"LoadImage32W(0x%04x,%p,%d,%d,%d,0x%08x)\n",
530 hinst
,name
,type
,desiredx
,desiredy
,loadflags
535 return LoadBitmap32W(hinst
,name
);
537 return LoadIcon32W(hinst
,name
);
539 return LoadCursor32W(hinst
,name
);
544 /**********************************************************************
545 * CopyImage32 (USER32.60)
547 * FIXME: implementation still lacks nearly all features, see LR_*
548 * defines in windows.h
550 HANDLE32 WINAPI
CopyImage32( HANDLE32 hnd
, UINT32 type
, INT32 desiredx
,
551 INT32 desiredy
, UINT32 flags
)
556 return hnd
; /* FIXME ... need to copy here */
558 return CopyIcon32(hnd
);
560 return CopyCursor32(hnd
);
566 /**********************************************************************
567 * LoadBitmap16 (USER.175)
569 HBITMAP16 WINAPI
LoadBitmap16( HINSTANCE16 instance
, SEGPTR name
)
571 HBITMAP32 hbitmap
= 0;
579 char *str
= (char *)PTR_SEG_TO_LIN( name
);
580 dprintf_bitmap( stddeb
, "LoadBitmap16(%04x,'%s')\n", instance
, str
);
581 if (str
[0] == '#') name
= (SEGPTR
)(DWORD
)(WORD
)atoi( str
+ 1 );
584 dprintf_bitmap( stddeb
, "LoadBitmap16(%04x,%04x)\n",
585 instance
, LOWORD(name
) );
587 if (!instance
) /* OEM bitmap */
589 if (HIWORD((int)name
)) return 0;
590 return OBM_LoadBitmap( LOWORD((int)name
) );
593 if (!(hRsrc
= FindResource16( instance
, name
, RT_BITMAP
))) return 0;
594 if (!(handle
= LoadResource16( instance
, hRsrc
))) return 0;
596 info
= (BITMAPINFO
*)LockResource16( handle
);
597 if ((hdc
= GetDC32(0)) != 0)
599 char *bits
= (char *)info
+ DIB_BitmapInfoSize( info
, DIB_RGB_COLORS
);
600 hbitmap
= CreateDIBitmap32( hdc
, &info
->bmiHeader
, CBM_INIT
,
601 bits
, info
, DIB_RGB_COLORS
);
602 ReleaseDC32( 0, hdc
);
604 FreeResource16( handle
);
608 /**********************************************************************
609 * LoadBitmap32W (USER32.357)
611 HBITMAP32 WINAPI
LoadBitmap32W( HINSTANCE32 instance
, LPCWSTR name
)
613 HBITMAP32 hbitmap
= 0;
619 if (!instance
) /* OEM bitmap */
621 if (HIWORD((int)name
)) return 0;
622 return OBM_LoadBitmap( LOWORD((int)name
) );
625 if (!(hRsrc
= FindResource32W( instance
, name
,
626 (LPWSTR
)RT_BITMAP
))) return 0;
627 if (!(handle
= LoadResource32( instance
, hRsrc
))) return 0;
629 info
= (BITMAPINFO
*)LockResource32( handle
);
630 if ((hdc
= GetDC32(0)) != 0)
632 char *bits
= (char *)info
+ DIB_BitmapInfoSize( info
, DIB_RGB_COLORS
);
633 hbitmap
= CreateDIBitmap32( hdc
, &info
->bmiHeader
, CBM_INIT
,
634 bits
, info
, DIB_RGB_COLORS
);
635 ReleaseDC32( 0, hdc
);
641 /**********************************************************************
642 * LoadBitmap32A (USER32.356)
644 HBITMAP32 WINAPI
LoadBitmap32A( HINSTANCE32 instance
, LPCSTR name
)
647 if (!HIWORD(name
)) res
= LoadBitmap32W( instance
, (LPWSTR
)name
);
650 LPWSTR uni
= HEAP_strdupAtoW( GetProcessHeap(), 0, name
);
651 res
= LoadBitmap32W( instance
, uni
);
652 HeapFree( GetProcessHeap(), 0, uni
);
658 /***********************************************************************
659 * BITMAP_DeleteObject
661 BOOL32
BITMAP_DeleteObject( HBITMAP16 hbitmap
, BITMAPOBJ
* bmp
)
663 #ifdef PRELIMINARY_WING16_SUPPORT
664 if( bmp
->bitmap
.bmBits
)
665 XShmDetach( display
, (XShmSegmentInfo
*)bmp
->bitmap
.bmBits
);
668 XFreePixmap( display
, bmp
->pixmap
);
669 #ifdef PRELIMINARY_WING16_SUPPORT
670 if( bmp
->bitmap
.bmBits
)
672 __ShmBitmapCtl
* p
= (__ShmBitmapCtl
*)bmp
->bitmap
.bmBits
;
673 WORD sel
= HIWORD(p
->bits
);
674 unsigned long l
, limit
= GetSelectorLimit(sel
);
676 for( l
= 0; l
< limit
; l
+= 0x10000, sel
+= __AHINCR
)
678 shmctl(p
->si
.shmid
, IPC_RMID
, NULL
);
679 shmdt(p
->si
.shmaddr
); /* already marked for destruction */
682 return GDI_FreeObject( hbitmap
);
686 /***********************************************************************
689 INT16
BITMAP_GetObject16( BITMAPOBJ
* bmp
, INT16 count
, LPVOID buffer
)
691 if (count
> sizeof(bmp
->bitmap
)) count
= sizeof(bmp
->bitmap
);
692 memcpy( buffer
, &bmp
->bitmap
, count
);
697 /***********************************************************************
700 INT32
BITMAP_GetObject32( BITMAPOBJ
* bmp
, INT32 count
, LPVOID buffer
)
703 bmp32
.bmType
= bmp
->bitmap
.bmType
;
704 bmp32
.bmWidth
= bmp
->bitmap
.bmWidth
;
705 bmp32
.bmHeight
= bmp
->bitmap
.bmHeight
;
706 bmp32
.bmWidthBytes
= bmp
->bitmap
.bmWidthBytes
;
707 bmp32
.bmPlanes
= bmp
->bitmap
.bmPlanes
;
708 bmp32
.bmBitsPixel
= bmp
->bitmap
.bmBitsPixel
;
710 if (count
> sizeof(bmp32
)) count
= sizeof(bmp32
);
711 memcpy( buffer
, &bmp32
, count
);
717 /***********************************************************************
718 * CreateDiscardableBitmap16 (GDI.156)
720 HBITMAP16 WINAPI
CreateDiscardableBitmap16( HDC16 hdc
, INT16 width
,
723 return CreateCompatibleBitmap16( hdc
, width
, height
);
727 /***********************************************************************
728 * CreateDiscardableBitmap32 (GDI32.38)
730 HBITMAP32 WINAPI
CreateDiscardableBitmap32( HDC32 hdc
, INT32 width
,
733 return CreateCompatibleBitmap32( hdc
, width
, height
);
737 /***********************************************************************
738 * GetBitmapDimensionEx16 (GDI.468)
740 BOOL16 WINAPI
GetBitmapDimensionEx16( HBITMAP16 hbitmap
, LPSIZE16 size
)
742 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
743 if (!bmp
) return FALSE
;
745 GDI_HEAP_UNLOCK( hbitmap
);
750 /***********************************************************************
751 * GetBitmapDimensionEx32 (GDI32.144)
753 BOOL32 WINAPI
GetBitmapDimensionEx32( HBITMAP32 hbitmap
, LPSIZE32 size
)
755 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
756 if (!bmp
) return FALSE
;
757 size
->cx
= (INT32
)bmp
->size
.cx
;
758 size
->cy
= (INT32
)bmp
->size
.cy
;
759 GDI_HEAP_UNLOCK( hbitmap
);
764 /***********************************************************************
765 * GetBitmapDimension (GDI.162)
767 DWORD WINAPI
GetBitmapDimension( HBITMAP16 hbitmap
)
770 if (!GetBitmapDimensionEx16( hbitmap
, &size
)) return 0;
771 return MAKELONG( size
.cx
, size
.cy
);
775 /***********************************************************************
776 * SetBitmapDimensionEx16 (GDI.478)
778 BOOL16 WINAPI
SetBitmapDimensionEx16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
,
781 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
782 if (!bmp
) return FALSE
;
783 if (prevSize
) *prevSize
= bmp
->size
;
786 GDI_HEAP_UNLOCK( hbitmap
);
791 /***********************************************************************
792 * SetBitmapDimensionEx32 (GDI32.304)
794 BOOL32 WINAPI
SetBitmapDimensionEx32( HBITMAP32 hbitmap
, INT32 x
, INT32 y
,
797 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
798 if (!bmp
) return FALSE
;
799 if (prevSize
) CONV_SIZE16TO32( &bmp
->size
, prevSize
);
800 bmp
->size
.cx
= (INT16
)x
;
801 bmp
->size
.cy
= (INT16
)y
;
802 GDI_HEAP_UNLOCK( hbitmap
);
807 /***********************************************************************
808 * SetBitmapDimension (GDI.163)
810 DWORD WINAPI
SetBitmapDimension( HBITMAP16 hbitmap
, INT16 x
, INT16 y
)
813 if (!SetBitmapDimensionEx16( hbitmap
, x
, y
, &size
)) return 0;
814 return MAKELONG( size
.cx
, size
.cy
);