diff options
-rw-r--r-- | src/qt_qt_wrapper.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qt_qt_wrapper.cpp b/src/qt_qt_wrapper.cpp index a909463..618e6f5 100644 --- a/src/qt_qt_wrapper.cpp +++ b/src/qt_qt_wrapper.cpp @@ -655,10 +655,13 @@ TQColor gdkColorToTQColor(GdkColor* c) return TQColor(c->red / 256, c->green / 256, c->blue / 256); } -void drawTQPixmapToWindow(GdkWindow* window, GdkGC* gc, TQPixmap* pixmap, int x, int y, int w, int h) { - static GdkGC* igc = gdk_gc_new(window); +void drawTQPixmapToWindow(GdkWindow* window, GdkGC* gc, TQPixmap* pixmap, int x, int y, int w, int h) +{ + static GdkGC* imggc = gdk_gc_new(window); GdkPixmap* pix; + // gdk_drawable_get_image crashes if requested region is outside of the window. + // Bitmap masks cause artifacts with Domino and Baghira. int width, height; gdk_drawable_get_size(window, &width, &height); if (!pixmap->hasAlpha() || isDomino || isBaghira || @@ -669,10 +672,12 @@ void drawTQPixmapToWindow(GdkWindow* window, GdkGC* gc, TQPixmap* pixmap, int x, return; } + // Gdk isn't aware of the TQPixmap mask, + // so instead we create a new pixmap from the window region and bitBlt over it. TQPixmap gpixmap(w, h); pix = gdk_pixmap_foreign_new(gpixmap.handle()); GdkImage* img = gdk_drawable_get_image(window, x, y, w, h); - gdk_draw_image(pix, igc, img, 0, 0, 0, 0, w, h); + gdk_draw_image(pix, imggc, img, 0, 0, 0, 0, w, h); bitBlt(&gpixmap, 0, 0, pixmap, 0, 0, w, h, TQt::CopyROP); gdk_draw_drawable(window, gc, pix, 0, 0, x, y, w, h); |