]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/dc.cpp
no real change: rename wxPendingEvents to wxHandlersWithPendingEvents since its curre...
[wxWidgets.git] / src / os2 / dc.cpp
index 9fb6ea2f9d024af6f67c3f5b94f909fbf6d9f3ed..47e40bc3bb3c707703ef273d276807412d810345 100644 (file)
@@ -444,7 +444,7 @@ void wxPMDCImpl::DoSetClippingRegion(
     DO_SET_CLIPPING_BOX()
 } // end of wxPMDCImpl::DoSetClippingRegion
 
-void wxPMDCImpl::DoSetClippingRegionAsRegion(
+void wxPMDCImpl::DoSetDeviceClippingRegion(
   const wxRegion&                   rRegion
 )
 {
@@ -457,7 +457,7 @@ void wxPMDCImpl::DoSetClippingRegionAsRegion(
                         ,&hRgnOld
                        );
     DO_SET_CLIPPING_BOX()
-} // end of wxPMDCImpl::DoSetClippingRegionAsRegion
+} // end of wxPMDCImpl::DoSetDeviceClippingRegion
 
 void wxPMDCImpl::DestroyClippingRegion(void)
 {
@@ -501,16 +501,16 @@ bool wxPMDCImpl::CanGetTextExtent() const
 
 int wxPMDCImpl::GetDepth() const
 {
-    LONG                            lArray[CAPS_COLOR_BITCOUNT];
+    LONG                            lCapsColorBitcount;
     int                             nBitsPerPixel = 0;
 
     if(::DevQueryCaps( GetHDC()
-                      ,CAPS_FAMILY
                       ,CAPS_COLOR_BITCOUNT
-                      ,lArray
+                      ,1L
+                      ,&lCapsColorBitcount
                      ))
     {
-        nBitsPerPixel = (int)lArray[CAPS_COLOR_BITCOUNT];
+        nBitsPerPixel = (int)lCapsColorBitcount;
     }
     return nBitsPerPixel;
 } // end of wxPMDCImpl::GetDepth
@@ -2652,57 +2652,61 @@ bool wxPMDCImpl::DoBlit( wxCoord vXdest,
 }
 
 void wxPMDCImpl::DoGetSize( int* pnWidth,
-                      int* pnHeight ) const
+                            int* pnHeight ) const
 {
-    LONG lArray[CAPS_HEIGHT];
+    LONG lArray[CAPS_HEIGHT+1];
 
     if(::DevQueryCaps( m_hDC
                       ,CAPS_FAMILY
-                      ,CAPS_HEIGHT
+                      ,CAPS_HEIGHT+1
                       ,lArray
                      ))
     {
-        *pnWidth  = lArray[CAPS_WIDTH];
-        *pnHeight = lArray[CAPS_HEIGHT];
+        if (pnWidth)
+            *pnWidth  = lArray[CAPS_WIDTH];
+        if (pnHeight)
+            *pnHeight = lArray[CAPS_HEIGHT];
     }
 }; // end of wxPMDCImpl::DoGetSize(
 
 void wxPMDCImpl::DoGetSizeMM( int* pnWidth,
                         int* pnHeight ) const
 {
-    LONG                            lArray[CAPS_VERTICAL_RESOLUTION];
+    LONG                            lArray[CAPS_VERTICAL_RESOLUTION+1];
 
     if(::DevQueryCaps( m_hDC
                       ,CAPS_FAMILY
-                      ,CAPS_VERTICAL_RESOLUTION
+                      ,CAPS_VERTICAL_RESOLUTION+1
                       ,lArray
                      ))
     {
         if(pnWidth)
         {
-            int nWidth = lArray[CAPS_WIDTH];
-            int nHorzRes  = lArray[CAPS_HORIZONTAL_RESOLUTION]; // returns pel/meter
-            *pnWidth  = (nHorzRes/1000) * nWidth;
+            int nWidth   = lArray[CAPS_WIDTH];
+            int nHorzRes = lArray[CAPS_HORIZONTAL_RESOLUTION]; // returns pel/meter
+            // use fp to avoid returning 0 if nHorzRes < 1000
+            *pnWidth  = (int)((nHorzRes/1000.0) * nWidth);
         }
 
         if(pnHeight)
         {
-            int nHeight   = lArray[CAPS_HEIGHT];
+            int nHeight  = lArray[CAPS_HEIGHT];
             int nVertRes = lArray[CAPS_VERTICAL_RESOLUTION];   // returns pel/meter
-            *pnHeight = (nVertRes/1000) * nHeight;
+            // use fp to avoid returning 0 if nVertRes < 1000
+            *pnHeight = (int)((nVertRes/1000.0) * nHeight);
         }
     }
 }; // end of wxPMDCImpl::DoGetSizeMM
 
 wxSize wxPMDCImpl::GetPPI() const
 {
-    LONG                            lArray[CAPS_VERTICAL_RESOLUTION];
+    LONG                            lArray[CAPS_VERTICAL_RESOLUTION+1];
     int                             nWidth = 0;
     int                             nHeight = 0;
 
     if(::DevQueryCaps( m_hDC
                       ,CAPS_FAMILY
-                      ,CAPS_VERTICAL_RESOLUTION
+                      ,CAPS_VERTICAL_RESOLUTION+1
                       ,lArray
                      ))
     {