+ // scale it
+ for (int y = sfh - 1; y >= 0; --y) {
+ int yy = y * h / sfh;
+ for (int x = sfw - 1; x >= 0; --x) {
+ int xx = x * w / sfw;
+ if (depth != info->depth()) {
+ XCopyPlane(**display, pixmap, p, DefaultGC(**display, _screen),
+ xx, yy, 1, 1, x, y, 1);
+ } else {
+ XCopyArea(**display, pixmap, p, DefaultGC(**display, _screen),
+ xx, yy, 1, 1, x, y);
+ }
+ if (mask != None)
+ XCopyArea(**display, mask, m, mgc, xx, yy, 1, 1, x, y);
+ }
+ }
+
+ XSetClipMask(**display, DefaultGC(**display, _screen), m);
+ XSetClipOrigin(**display, DefaultGC(**display, _screen), 0, 0);
+ XCopyArea(**display, p, sf.pixmap(), DefaultGC(**display, _screen), 0, 0,
+ sfw, sfh, 0, 0);
+ XSetClipMask(**display, DefaultGC(**display, _screen), None);
+
+ XFreePixmap(**display, p);
+ if (m != None) XFreePixmap(**display, m);