aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2014-10-19 21:58:00 +0000
committerDimitri Sokolyuk <demon@dim13.org>2014-10-19 21:58:00 +0000
commit2ecca728b2bb12b63dc9d7dfc2d8e1ec78450043 (patch)
tree05c4ccdc39b51c0dd1ea6dce36e377328386a880
parent9a132fe42a239dbda5d1411158c62d10ae377c1d (diff)
experiment with backbuffer
-rw-r--r--Sgraph.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/Sgraph.c b/Sgraph.c
index 20091d7..380ded3 100644
--- a/Sgraph.c
+++ b/Sgraph.c
@@ -163,6 +163,7 @@ Realize(Widget w, XtValueMask *mask, XSetWindowAttributes *attr)
XtSuperclass(w)->core_class.realize(w, mask, attr);
sw->sgraph.backBuf = XdbeAllocateBackBufferName(XtDisplay(w),
XtWindow(w), XdbeBackground);
+ Resize(w);
}
static void
@@ -207,18 +208,38 @@ Redisplay(Widget w, XEvent *event, Region r)
for (i = 0; i < width - 1; i++) {
y = sw->sgraph.values[i];
+ if (y > sw->core.height)
+ y = sw->core.height - 1;
x = sw->sgraph.mirror ? sw->core.width - i : i;
+#if 0
XDrawLine(XtDisplay(sw), sw->sgraph.backBuf,
sw->sgraph.foreGC,
x, sw->core.height,
x, sw->core.height - y);
+#else
+ XDrawLine(XtDisplay(sw), sw->sgraph.bg,
+ sw->sgraph.foreGC,
+ x, sw->core.height,
+ x, sw->core.height - y);
+#endif
}
+#if 0
swap.swap_window = XtWindow(sw);
swap.swap_action = XdbeBackground;
XdbeSwapBuffers(XtDisplay(sw), &swap, 1);
+#else
+
+ XCopyArea(XtDisplay(sw), sw->sgraph.bg, XtWindow(sw),
+ sw->sgraph.foreGC, 0, 0,
+ sw->core.width, sw->core.height,
+ 0, 0);
+ XFillRectangle(XtDisplay(sw), sw->sgraph.bg,
+ sw->sgraph.backGC,
+ 0, 0, sw->core.width, sw->core.height);
+#endif
}
static void