- invert = (white & 1) == 1 ? 0xff : 0x00;
-
- dummyWin = XCreateSimpleWindow(display, RootWindow(display, screen),
- 0, 0, 1, 1, 0,
- black, white);
- pixmap = XCreatePixmap(display, dummyWin, 1, 1, 1);
- return new PBMOutputDev(display, screen, pixmap, dummyWin,
- invert, fileRoot1);
+ invertA = (white & 1) == 1 ? 0xff : 0x00;
+
+ dummyWinA = XCreateSimpleWindow(displayA, RootWindow(displayA, screenA),
+ 0, 0, 1, 1, 0,
+ black, white);
+ pixmapA = XCreatePixmap(displayA, dummyWinA, 1, 1, 1);
+ out = new PBMOutputDev(displayA, screenA, pixmapA, dummyWinA,
+ invertA, fileRootA);
+ return out;
+}
+
+void PBMOutputDev::killPBMOutputDev(PBMOutputDev *out) {
+ Display *displayA;
+ Pixmap pixmapA;
+ Window dummyWinA;
+
+ displayA = out->display;
+ pixmapA = out->pixmap;
+ dummyWinA = out->dummyWin;
+
+ delete out;
+
+ // these have to be done *after* the XOutputDev (parent of the
+ // PBMOutputDev) is deleted, since XOutputDev::~XOutputDev() needs
+ // them
+ XFreePixmap(displayA, pixmapA);
+ XDestroyWindow(displayA, dummyWinA);
+ XCloseDisplay(displayA);