summaryrefslogtreecommitdiff
path: root/lib/glshape.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/glshape.cc')
-rw-r--r--lib/glshape.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/glshape.cc b/lib/glshape.cc
index 0fdaef0..5572e4d 100644
--- a/lib/glshape.cc
+++ b/lib/glshape.cc
@@ -154,3 +154,33 @@ void mogltk::glshape::Leave(bool was2D) {
if (!was2D)
mogltk::engine::glbase_o->Leave2DMode();
}
+
+class filldrawer : public mogltk::fillwalker {
+ public:
+ filldrawer(mogltk::shape * _s, mogltk::ColorP _c = DOS_WHITE) : s(_s), c(_c), oldx(-1), oldy(-1) { }
+ virtual ~filldrawer() { }
+ virtual void step(int x, int y) {
+ if (oldy != y)
+ oldx = -1;
+ if (oldx == -1) {
+ oldx = x;
+ } else {
+ s->hline(oldx, x, y, c);
+ oldx = -1;
+ }
+ oldy = y;
+ }
+ private:
+ mogltk::shape * s;
+ mogltk::ColorP c;
+ int oldx, oldy;
+};
+
+void mogltk::glshape::fdraw(fill * f, ColorP c) {
+ ENTER;
+ filldrawer * w = new filldrawer(this, c);
+ f->walk(w);
+ delete w;
+ LEAVE;
+}
+ \ No newline at end of file