]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/dc.cpp
wxUniversal fixes:
[wxWidgets.git] / src / os2 / dc.cpp
index 0d89f00d9f0b02c55ac1b338699c77c8df12034c..9a58657da1af201924e7fac723b0ebee3c370bbc 100644 (file)
@@ -1043,12 +1043,49 @@ void wxDC::DoDrawRectangle(
         //
         // Debug testing:
         //
-        for (int i = 0; i < vHeight; i++)
+        if (m_vSelectedBitmap != wxNullBitmap)
         {
-            for (int j = 0; j < vHeight; j++)
+            BITMAPINFOHEADER2           vHeader;
+            BITMAPINFO2                 vInfo;
+
+            vHeader.cbFix = 16L;
+            if (::GpiQueryBitmapInfoHeader(m_hPS, &vHeader))
             {
-                vPoint[0].x = j; vPoint[0].y = i;
-                lColor = ::GpiQueryPel(m_hPS, &vPoint[0]);
+                int                     nBytesPerLine = vHeader.cBitCount/8;
+                unsigned char*          pucData = NULL;
+                unsigned char*          pucBits;
+                LONG                    lScans = 0L;
+
+                vInfo.cbFix = 16;
+                vInfo.cx              = vHeader.cx;
+                vInfo.cy              = vHeader.cy;
+                vInfo.cPlanes         = vHeader.cPlanes;
+                vInfo.cBitCount       = vHeader.cBitCount;
+                pucData = (unsigned char*)malloc(nBytesPerLine * vHeight);
+                pucBits = pucData;
+                for (int i = 0; i < vHeight; i++)
+                {
+                    if (i <= m_vSelectedBitmap.GetHeight())
+                    {
+                        for (int j = 0; j < vWidth; j++)
+                        {
+                            if (j <= m_vSelectedBitmap.GetWidth())
+                            {
+                                vPoint[0].x = j; vPoint[0].y = i;
+                                lColor = ::GpiQueryPel(m_hPS, &vPoint[0]);
+                                *(pucBits++) = lColor >> 24;
+                                *(pucBits++) = lColor >> 16;
+                                *(pucBits++) = lColor >> 8;
+                            }
+                        }
+                    }
+                }
+                lScans = ::GpiSetBitmapBits( m_hPS
+                                            ,0             // Start at the bottom
+                                            ,(LONG)vHeight // One line per scan
+                                            ,(PBYTE)pucData
+                                            ,&vInfo
+                                           );
             }
         }
     }