X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/74de9ed64b22c88f6628ad92fed37dd81498b215..19e30148e18cc99296b26503c155e5cef59045f4:/src/os2/dc.cpp?ds=sidebyside diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp index 8c8d8a66a4..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 )