diff --git a/include/wx/mac/carbon/dc.h b/include/wx/mac/carbon/dc.h index 835aa3a65f..62a3961fa2 100644 --- a/include/wx/mac/carbon/dc.h +++ b/include/wx/mac/carbon/dc.h @@ -316,15 +316,16 @@ protected: #if wxMAC_USE_CORE_GRAPHICS // CoreGraphics wxGraphicContext * m_graphicContext ; + wxPoint m_macLocalOriginInPort ; #else - mutable bool m_macFontInstalled ; - mutable bool m_macPenInstalled ; - mutable bool m_macBrushInstalled ; + mutable bool m_macFontInstalled ; + mutable bool m_macPenInstalled ; + mutable bool m_macBrushInstalled ; - WXHRGN m_macBoundaryClipRgn ; - WXHRGN m_macCurrentClipRgn ; - void MacSetupPort( wxMacPortStateHelper* ph ) const ; - void MacCleanupPort( wxMacPortStateHelper* ph ) const ; + WXHRGN m_macBoundaryClipRgn ; + WXHRGN m_macCurrentClipRgn ; + void MacSetupPort( wxMacPortStateHelper* ph ) const ; + void MacCleanupPort( wxMacPortStateHelper* ph ) const ; mutable wxMacPortStateHelper* m_macCurrentPortStateHelper ; mutable bool m_macFormerAliasState ; mutable short m_macFormerAliasSize ; diff --git a/src/mac/carbon/dccg.cpp b/src/mac/carbon/dccg.cpp index c610c95a4e..4a26beeb28 100755 --- a/src/mac/carbon/dccg.cpp +++ b/src/mac/carbon/dccg.cpp @@ -906,8 +906,17 @@ bool wxDC::DoFloodFill(wxCoord x, wxCoord y, bool wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const { wxCHECK_MSG( Ok(), false, wxT("wxDC::DoGetPixel Invalid DC") ); - wxFAIL_MSG( wxT("GetPixel not implemented on Core Graphics") ) ; - return false ; + wxCHECK_MSG( Ok(), false, wxT("wxDC::DoGetPixel Invalid DC") ); + wxMacPortSaver helper((CGrafPtr)m_macPort) ; + RGBColor colour; + GetCPixel( + XLOG2DEVMAC(x) + m_macLocalOriginInPort.x - m_macLocalOrigin.x, + YLOG2DEVMAC(y) + m_macLocalOriginInPort.y - m_macLocalOrigin.y, &colour ); + // Convert from Mac colour to wx + col->Set( colour.red >> 8, + colour.green >> 8, + colour.blue >> 8); + return true ; } void wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )