]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed errors in OS/2's wxDC::SetMapMode (patch #1871556, needed for Filezilla).
authorStefan Neis <Stefan.Neis@t-online.de>
Fri, 18 Jan 2008 21:37:46 +0000 (21:37 +0000)
committerStefan Neis <Stefan.Neis@t-online.de>
Fri, 18 Jan 2008 21:37:46 +0000 (21:37 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51279 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/os2/dc.cpp

index aa54c8a48a377c1f3f542d887ebe3bcdcc74380f..9fb6ea2f9d024af6f67c3f5b94f909fbf6d9f3ed 100644 (file)
@@ -2218,13 +2218,13 @@ void wxPMDCImpl::SetMapMode(
     int                             nPixelHeight = 0;
     int                             nMmWidth = 1;
     int                             nMmHeight = 1;
     int                             nPixelHeight = 0;
     int                             nMmWidth = 1;
     int                             nMmHeight = 1;
-    LONG                            lArray[CAPS_VERTICAL_RESOLUTION];
+    LONG                            lArray[CAPS_VERTICAL_RESOLUTION+1];
 
     m_mappingMode = nMode;
 
     if(::DevQueryCaps( m_hDC
 
     m_mappingMode = nMode;
 
     if(::DevQueryCaps( m_hDC
-                      ,CAPS_FAMILY
-                      ,CAPS_VERTICAL_RESOLUTION
+                      ,CAPS_FAMILY                  // id of first item
+                      ,CAPS_VERTICAL_RESOLUTION+1   // number of items wanted
                       ,lArray
                      ))
     {
                       ,lArray
                      ))
     {
@@ -2236,15 +2236,15 @@ void wxPMDCImpl::SetMapMode(
         lHorzRes  = lArray[CAPS_HORIZONTAL_RESOLUTION]; // returns pel/meter
         lVertRes  = lArray[CAPS_VERTICAL_RESOLUTION];   // returns pel/meter
         nMmWidth  = (lHorzRes/1000) * nPixelWidth;
         lHorzRes  = lArray[CAPS_HORIZONTAL_RESOLUTION]; // returns pel/meter
         lVertRes  = lArray[CAPS_VERTICAL_RESOLUTION];   // returns pel/meter
         nMmWidth  = (lHorzRes/1000) * nPixelWidth;
-        nMmWidth = (lVertRes/1000) * nPixelHeight;
+        nMmHeight = (lVertRes/1000) * nPixelHeight;
     }
     if ((nPixelWidth == 0) || (nPixelHeight == 0) || (nMmWidth == 0) || (nMmHeight == 0))
     {
         return;
     }
 
     }
     if ((nPixelWidth == 0) || (nPixelHeight == 0) || (nMmWidth == 0) || (nMmHeight == 0))
     {
         return;
     }
 
-    double                          dMm2pixelsX = nPixelWidth/nMmWidth;
-    double                          dMm2pixelsY = nPixelHeight/nMmHeight;
+    double dMm2pixelsX = nPixelWidth/(double)nMmWidth;
+    double dMm2pixelsY = nPixelHeight/(double)nMmHeight;
 
     switch (nMode)
     {
 
     switch (nMode)
     {
@@ -2274,6 +2274,7 @@ void wxPMDCImpl::SetMapMode(
             m_logicalScaleY = 1.0;
             break;
     }
             m_logicalScaleY = 1.0;
             break;
     }
+
     SIZEL                           vSize;
     ULONG                           ulOptions;
 
     SIZEL                           vSize;
     ULONG                           ulOptions;
 
@@ -2283,10 +2284,6 @@ void wxPMDCImpl::SetMapMode(
         ulOptions = PU_ARBITRARY | GPIF_DEFAULT;
         ::GpiSetPS(m_hPS, &vSize, ulOptions);
     }
         ulOptions = PU_ARBITRARY | GPIF_DEFAULT;
         ::GpiSetPS(m_hPS, &vSize, ulOptions);
     }
-    m_nWindowExtX = (int)MS_XDEV2LOG(VIEWPORT_EXTENT);
-    m_nWindowExtY = (int)MS_YDEV2LOG(VIEWPORT_EXTENT);
-    // ????
-    
     ComputeScaleAndOrigin();
     
 }; // end of wxPMDCImpl::SetMapMode
     ComputeScaleAndOrigin();
     
 }; // end of wxPMDCImpl::SetMapMode