Use more accurate color conversion in DoGetPixel()

This commit is contained in:
Paul Cornett
2018-08-22 08:39:13 -07:00
parent 7c44f807ad
commit 41d534ac0d

View File

@@ -487,7 +487,7 @@ bool wxWindowDCImpl::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
} }
if (image == NULL) if (image == NULL)
{ {
*col = wxColour(); col->UnRef();
return false; return false;
} }
GdkColormap* colormap = gdk_image_get_colormap(image); GdkColormap* colormap = gdk_image_get_colormap(image);
@@ -498,7 +498,7 @@ bool wxWindowDCImpl::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
{ {
GdkColor c; GdkColor c;
gdk_colormap_query_color(colormap, pixel, &c); gdk_colormap_query_color(colormap, pixel, &c);
col->Set(c.red >> 8, c.green >> 8, c.blue >> 8); *col = wxColour(c);
} }
g_object_unref(image); g_object_unref(image);
return true; return true;
@@ -2062,7 +2062,7 @@ void wxWindowDCImpl::ComputeScaleAndOrigin()
// this is a bit artificial, but we need to force wxDC to think the pen // this is a bit artificial, but we need to force wxDC to think the pen
// has changed // has changed
wxPen pen = m_pen; wxPen pen = m_pen;
m_pen = wxNullPen; m_pen.UnRef();
SetPen( pen ); SetPen( pen );
} }