X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2c24e7adf051b2b522bcfc70d3ca70b07c206275..e8b90482676205a0fc997be9fcdc47ef62a37211:/src/os2/dc.cpp diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp index aa54c8a48a..9988736141 100644 --- a/src/os2/dc.cpp +++ b/src/os2/dc.cpp @@ -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 @@ -540,7 +540,7 @@ bool wxPMDCImpl::DoFloodFill( wxCoord vX , wxCoord vY , const wxColour& rCol -, int nStyle +, wxFloodFillStyle nStyle ) { POINTL vPtlPos; @@ -839,7 +839,7 @@ void wxPMDCImpl::DoDrawPolygon( int n, wxPoint vPoints[], wxCoord vXoffset, wxCoord vYoffset, - int nFillStyle ) + wxPolygonFillMode nFillStyle ) { ULONG ulCount = 1; // Number of polygons. POLYGON vPlgn; // polygon. @@ -2017,7 +2017,7 @@ void wxPMDCImpl::SetBackgroundMode(int nMode) m_backgroundMode = nMode; } // end of wxPMDCImpl::SetBackgroundMode -void wxPMDCImpl::SetLogicalFunction(int nFunction) +void wxPMDCImpl::SetLogicalFunction(wxRasterOperationMode nFunction) { m_logicalFunction = nFunction; SetRop((WXHDC)m_hDC); @@ -2165,7 +2165,7 @@ void wxPMDCImpl::DoGetTextExtent( ,wxICON_INFORMATION ); } - + bRc = ::GpiQueryTextBox( m_hPS ,l ,rsString.char_str() @@ -2211,20 +2211,20 @@ void wxPMDCImpl::DoGetTextExtent( } void wxPMDCImpl::SetMapMode( - int nMode + wxMappingMode nMode ) { int nPixelWidth = 0; 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 - ,CAPS_FAMILY - ,CAPS_VERTICAL_RESOLUTION + ,CAPS_FAMILY // id of first item + ,CAPS_VERTICAL_RESOLUTION+1 // number of items wanted ,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; - nMmWidth = (lVertRes/1000) * nPixelHeight; + nMmHeight = (lVertRes/1000) * nPixelHeight; } 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) { @@ -2274,6 +2274,7 @@ void wxPMDCImpl::SetMapMode( m_logicalScaleY = 1.0; break; } + SIZEL vSize; ULONG ulOptions; @@ -2283,12 +2284,8 @@ void wxPMDCImpl::SetMapMode( 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 void wxPMDCImpl::SetUserScale( double dX, @@ -2360,7 +2357,7 @@ bool wxPMDCImpl::DoBlit( wxCoord vXdest, wxDC* pSource, wxCoord vXsrc, wxCoord vYsrc, - int nRop, + wxRasterOperationMode nRop, bool bUseMask, wxCoord WXUNUSED(vXsrcMask), wxCoord WXUNUSED(vYsrcMask) ) @@ -2655,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 )) {