diff options
author | rjb330 <[email protected]> | 2024-10-28 13:49:16 -0700 |
---|---|---|
committer | rjb330 <[email protected]> | 2024-10-28 13:49:16 -0700 |
commit | d055f3b3ad49e11f2b2666623de1f7a13e05f122 (patch) | |
tree | 2920d9cd7a61f2513e822570aecd2d5ea60b6d07 /src | |
parent | 8b22d57a20d86488421b96a27c675d7300d0bc07 (diff) | |
download | gtk-qt-engine-d055f3b3ad49e11f2b2666623de1f7a13e05f122.tar.gz gtk-qt-engine-d055f3b3ad49e11f2b2666623de1f7a13e05f122.zip |
Add some comments in drawTQPixmapToWindow()
Signed-off-by: rjb330 <[email protected]>
Diffstat (limited to 'src')
-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); |