X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/81039e0de1c693128da186c8054052db8eeb853e..19e30148e18cc99296b26503c155e5cef59045f4:/src/os2/dc.cpp diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp index 2bee9f08e6..0fa3c05f7a 100644 --- a/src/os2/dc.cpp +++ b/src/os2/dc.cpp @@ -557,7 +557,7 @@ void wxDC::Clear() ::GpiErase(m_hPS); } // end of wxDC::Clear -void wxDC::DoFloodFill( +bool wxDC::DoFloodFill( wxCoord vX , wxCoord vY , const wxColour& rCol @@ -577,6 +577,8 @@ void wxDC::DoFloodFill( lOptions = FF_SURFACE; ::GpiFloodFill(m_hPS, lOptions, lColor); + + return TRUE; } // end of wxDC::DoFloodFill bool wxDC::DoGetPixel( @@ -1366,6 +1368,52 @@ void wxDC::DoDrawRotatedText( // set GDI objects // --------------------------------------------------------------------------- +void wxDC::DoSelectPalette( + bool bRealize +) +{ + // + // Set the old object temporarily, in case the assignment deletes an object + // that's not yet selected out. + // + if (m_hOldPalette) + { + m_hOldPalette = 0; + } + + if (m_palette.Ok()) + { + HPALETTE hOldPal; + + hOldPal = ::GpiSelectPalette((HDC) m_hPS, (HPALETTE) m_palette.GetHPALETTE()); + if (!m_hOldPalette) + m_hOldPalette = (WXHPALETTE)hOldPal; + } +} // end of wxDC::DoSelectPalette + +void wxDC::InitializePalette() +{ + if (wxDisplayDepth() <= 8 ) + { + // + // Look for any window or parent that has a custom palette. If any has + // one then we need to use it in drawing operations + // + wxWindow* pWin = m_pCanvas->GetAncestorWithCustomPalette(); + + m_hasCustomPalette = pWin && pWin->HasCustomPalette(); + if (m_hasCustomPalette) + { + m_palette = pWin->GetPalette(); + + // + // turn on PM translation for this palette + // + DoSelectPalette(); + } + } +} // end of wxDC::InitializePalette + void wxDC::SetPalette( const wxPalette& rPalette ) @@ -1808,8 +1856,8 @@ void wxDC::SetMapMode( ulOptions = PU_ARBITRARY | GPIF_DEFAULT; ::GpiSetPS(m_hPS, &vSize, ulOptions); } - m_nWindowExtX = (int)MS_XDEV2LOGREL(VIEWPORT_EXTENT); - m_nWindowExtY = (int)MS_YDEV2LOGREL(VIEWPORT_EXTENT); + m_nWindowExtX = (int)MS_XDEV2LOG(VIEWPORT_EXTENT); + m_nWindowExtY = (int)MS_YDEV2LOG(VIEWPORT_EXTENT); // ???? }; // end of wxDC::SetMapMode @@ -1897,7 +1945,8 @@ wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const { - return (wxCoord) ((x)/(m_logicalScaleX*m_userScaleX*m_signX*m_scaleX)); + // axis orientation is not taken into account for conversion of a distance + return (wxCoord) ((x)/(m_logicalScaleX*m_userScaleX*m_scaleX)); } wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const @@ -1907,7 +1956,8 @@ wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const { - return (wxCoord) ((y)/(m_logicalScaleY*m_userScaleY*m_signY*m_scaleY)); + // axis orientation is not taken into account for conversion of a distance + return (wxCoord) ((y)/(m_logicalScaleY*m_userScaleY*m_scaleY)); } wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const @@ -1917,7 +1967,8 @@ wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const { - return (wxCoord) (x*m_logicalScaleX*m_userScaleX*m_signX*m_scaleX); + // axis orientation is not taken into account for conversion of a distance + return (wxCoord) (x*m_logicalScaleX*m_userScaleX*m_scaleX); } wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const @@ -1927,7 +1978,8 @@ wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const { - return (wxCoord) (y*m_logicalScaleY*m_userScaleY*m_signY*m_scaleY); + // axis orientation is not taken into account for conversion of a distance + return (wxCoord) (y*m_logicalScaleY*m_userScaleY*m_scaleY); } // ---------------------------------------------------------------------------