X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eb6ee8ab39758a6167c196df6bd05aaa07d45380..12bb29f5432174ecbd65549bda832d70d34a98ae:/src/gtk/dcclient.cpp diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 8a6960eb24..35b0fd4ff6 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -731,7 +731,7 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset } if (m_gdkwindow) - gdk_draw_lines( m_gdkwindow, m_penGC, gpts, n); + gdk_draw_lines( m_gdkwindow, m_penGC, (GdkPoint*) gpts, n); delete[] gpts_alloc; } @@ -777,7 +777,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[], bool originChanged; DrawingSetup(gc, originChanged); - gdk_draw_polygon(m_gdkwindow, gc, true, gdkpoints, n); + gdk_draw_polygon(m_gdkwindow, gc, true, (GdkPoint*) gdkpoints, n); if (originChanged) gdk_gc_set_ts_origin(gc, 0, 0); @@ -795,7 +795,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[], gdkpoints[(i+1)%n].y); } */ - gdk_draw_polygon( m_gdkwindow, m_penGC, FALSE, gdkpoints, n ); + gdk_draw_polygon( m_gdkwindow, m_penGC, FALSE, (GdkPoint*) gdkpoints, n ); } } @@ -1130,11 +1130,12 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, { wxMask* m = bitmap.GetMask(); if (m) - mask = m->GetBitmap(); + mask = *m; } + + GdkPixmap* mask_new = NULL; if (mask) { - GdkPixmap* mask_new = NULL; if (isScaled) { mask = ScaleMask(mask, 0, 0, w, h, ww, hh, m_scaleX, m_scaleY); @@ -1151,8 +1152,6 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, } gdk_gc_set_clip_mask(use_gc, mask); gdk_gc_set_clip_origin(use_gc, xx, yy); - if (mask_new) - g_object_unref(mask_new); } // determine whether to use pixmap or pixbuf @@ -1164,9 +1163,12 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, pixmap = bitmap.GetPixmap(); if (pixmap && gdk_drawable_get_depth(pixmap) == 1) { - // convert mono pixmap to color using text fg/bg colors - pixmap = MonoToColor(pixmap, 0, 0, w, h); - pixmap_new = pixmap; + if (gdk_drawable_get_depth(m_gdkwindow) != 1) + { + // convert mono pixmap to color using text fg/bg colors + pixmap = MonoToColor(pixmap, 0, 0, w, h); + pixmap_new = pixmap; + } } else if (hasAlpha || pixmap == NULL) pixbuf = bitmap.GetPixbuf(); @@ -1196,7 +1198,16 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, if (pixmap_new) g_object_unref(pixmap_new); if (mask) + { gdk_gc_set_clip_region(use_gc, clipRegion); + + // Notice that we can only release the mask now, we can't do it before + // the calls to gdk_draw_xxx() above as they crash with X error with + // GTK+ up to 2.20.1 (i.e. it works with 2.20 but is known to not work + // with 2.16.1 and below). + if (mask_new) + g_object_unref(mask_new); + } } bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, @@ -1225,7 +1236,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, { wxMask* m = bitmap.GetMask(); if (m) - mask = m->GetBitmap(); + mask = *m; } } else @@ -1340,7 +1351,8 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, } GdkPixmap* pixmap = NULL; - if (gdk_drawable_get_depth(srcDrawable) == 1) + if (gdk_drawable_get_depth(srcDrawable) == 1 && + (gdk_drawable_get_depth(m_gdkwindow) != 1 || isScaled)) { // Convert mono pixmap to color using text fg/bg colors. // Scaling/drawing is simpler if this is done first. @@ -1792,7 +1804,7 @@ void wxWindowDCImpl::SetBrush( const wxBrush &brush ) if ((m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask())) { gdk_gc_set_fill( m_textGC, GDK_OPAQUE_STIPPLED); - gdk_gc_set_stipple( m_textGC, m_brush.GetStipple()->GetMask()->GetBitmap() ); + gdk_gc_set_stipple( m_textGC, *m_brush.GetStipple()->GetMask() ); } if (m_brush.IsHatch())