Add some comments in drawTQPixmapToWindow()

Signed-off-by: rjb330 <122177540+rjb330@users.noreply.github.com>
pull/24/head
rjb330 3 weeks ago
parent 8b22d57a20
commit d055f3b3ad

@ -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);

Loading…
Cancel
Save