- Attractor->dbuf_gc = XCreateGC(MI_DISPLAY(mi), Attractor->dbuf,
- GCForeground|GCBackground|GCFunction,
- &gcv);
- XFillRectangle(MI_DISPLAY(mi), Attractor->dbuf,
- Attractor->dbuf_gc, 0,0, Attractor->Width,
- Attractor->Height);
- XSetBackground(MI_DISPLAY(mi), MI_GC(mi), MI_WIN_BLACK_PIXEL(mi));
- XSetFunction(MI_DISPLAY(mi), MI_GC(mi), GXcopy);
- }
-
- XClearWindow(MI_DISPLAY(mi), MI_WINDOW(mi));
- return;
-
- Abort:
- if (Attractor->Buffer1 != NULL)
- free(Attractor->Buffer1);
- if (Attractor->Buffer2 != NULL)
- free(Attractor->Buffer2);
- Attractor->Buffer1 = NULL;
- Attractor->Buffer2 = NULL;
- Attractor->Cur_Pt = 0;
- return;
+
+ if (Attractor->dbuf_gc != None)
+ XFreeGC(display, Attractor->dbuf_gc);
+
+ if ((Attractor->dbuf_gc = XCreateGC(display, Attractor->dbuf,
+#ifndef HAVE_COCOA
+ GCGraphicsExposures |
+#endif /* HAVE_COCOA */
+ GCFunction | GCForeground | GCBackground,
+ &gcv)) == None) {
+ XFreePixmap(display, Attractor->dbuf);
+ Attractor->dbuf = None;
+ } else {
+ XFillRectangle(display, Attractor->dbuf, Attractor->dbuf_gc,
+ 0, 0, Attractor->Width, Attractor->Height);
+ XSetBackground(display, gc, MI_BLACK_PIXEL(mi));
+ XSetFunction(display, gc, GXcopy);
+ }
+ }
+#endif
+
+
+#ifdef useAccumulator
+ #define A Attractor
+ if (useAccumulator) {
+ XWindowAttributes xgwa;
+ int i,j;
+ XGetWindowAttributes (display, window, &xgwa);
+ /* cmap = xgwa.colormap; */
+ /* cmap = XCreateColormap(display, window, MI_VISUAL(mi), AllocAll); */
+ Attractor->accMap = (int**)calloc(Attractor->Width,sizeof(int*));
+ for (i=0;i<Attractor->Width;i++) {
+ Attractor->accMap[i] = (int*)calloc(Attractor->Height,sizeof(int));
+ for (j=0;j<Attractor->Height;j++) {
+ Attractor->accMap[i][j] = 0;
+ }
+ }
+#ifdef POINTS_HISTORY
+ numOldPoints = A->Max_Pt * MERGE_FRAMES;
+ oldPointsX = (int*)calloc(numOldPoints,sizeof(int));
+ oldPointsY = (int*)calloc(numOldPoints,sizeof(int));
+#endif
+ cols = (XColor*)calloc(NUM_COLS,sizeof(XColor));
+ for (i=0;i<NUM_COLS;i++) {
+ float li;
+ #define MINBLUE 1
+ #define FULLBLUE 128
+ li = MINBLUE + (255.0-MINBLUE) * log(1.0 + ACC_GAMMA*(float)i/NUM_COLS) / log(1.0 + ACC_GAMMA);
+ if (li<FULLBLUE) {
+ cols[i].red = 0;
+ cols[i].green = 0;
+ cols[i].blue = 65536*li/FULLBLUE;
+ } else {
+ cols[i].red = 65536*(li-FULLBLUE)/(256-FULLBLUE);
+ cols[i].green = 65536*(li-FULLBLUE)/(256-FULLBLUE);
+ cols[i].blue = 65535;
+ }
+ XAllocColor (display, xgwa.colormap, &cols[i]);
+ /*
+ if (!XAllocColor(MI_DISPLAY(mi), cmap, &cols[i])) {
+ if (!XAllocColor(display, cmap, &cols[i])) {
+ cols[i].pixel = WhitePixel (display, DefaultScreen (display));
+ cols[i].red = cols[i].green = cols[i].blue = 0xFFFF;
+ }
+ */
+ }
+ /*
+ XSetWindowColormap(display, window, cmap);
+ (void) XSetWMColormapWindows(display, window, &window, 1);
+ XInstallColormap(display, cmap);
+ XStoreColors(display, cmap, cols, 256);
+ */
+ }
+ #undef A
+#endif
+ MI_CLEARWINDOW(mi);
+
+ /* Do not want any exposure events from XCopyPlane */
+ XSetGraphicsExposures(display, MI_GC(mi), False);
+}
+
+ENTRYPOINT void
+reshape_strange(ModeInfo * mi, int width, int height)
+{
+ XClearWindow (MI_DISPLAY (mi), MI_WINDOW(mi));
+ init_strange (mi);