changeset 1424:36d0e26a5dea

Use the image handle to get the dimensions on OS/2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 03 Dec 2011 03:40:48 +0000
parents 1bb1865fed9d
children 1628bf383893
files os2/dw.c
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/os2/dw.c	Sat Dec 03 03:31:43 2011 +0000
+++ b/os2/dw.c	Sat Dec 03 03:40:48 2011 +0000
@@ -4726,14 +4726,19 @@
    /* Bitmap/Static */
    else if(strncmp(tmpbuf, "#5", 3)==0)
    {
-      int bmwidth = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_width"));
-      int bmheight = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_height"));
-      
-      if(bmwidth > 0 && bmheight > 0)
-      {
-         thiswidth = bmwidth;
-         thisheight = bmheight;
-      }
+       HBITMAP hbm = (HBITMAP)WinSendMsg(handle, SM_QUERYHANDLE, MPVOID, MPVOID);
+
+       if(hbm)
+       {
+            BITMAPINFOHEADER2 bmp;
+            bmp.cbFix = sizeof(BITMAPINFOHEADER2);
+            /* Get the parameters of the bitmap */
+            if(GpiQueryBitmapInfoHeader(hbm, &bmp))
+            {
+               thiswidth = bmp.cx;
+               thisheight = bmp.cy;
+            }
+       }
    }
    /* Ranged: Slider/Percent/Scrollbar */
    else if(strncmp(tmpbuf, "#38", 4)== 0 ||