summaryrefslogtreecommitdiff
path: root/lib/shape.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/shape.cc')
-rw-r--r--lib/shape.cc31
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/shape.cc b/lib/shape.cc
index 9ba4f0c..54e552b 100644
--- a/lib/shape.cc
+++ b/lib/shape.cc
@@ -1,4 +1,5 @@
#include <math.h>
+#include <limits.h>
#include <SDL.h>
#include "engine.h"
#include "base.h"
@@ -18,7 +19,7 @@ mogltk::fillwalker::~fillwalker() {
void mogltk::fillwalker::step(int x, int y) {
}
-mogltk::fill::fill() : header(0) {
+mogltk::fill::fill() : minX(INT_MAX), minY(INT_MAX), maxX(INT_MIN), maxY(INT_MIN), header(0) {
}
mogltk::fill::~fill() {
@@ -35,6 +36,34 @@ void mogltk::fill::insert(int x, int y) {
new sline(y, this);
}
header->insert(x, y);
+
+ if (x > maxX)
+ maxX = x;
+
+ if (x < minX)
+ minX = x;
+
+ if (y > maxY)
+ maxY = y;
+
+ if (y < minY)
+ minY = y;
+}
+
+int mogltk::fill::GetMaxX() {
+ return maxX;
+}
+
+int mogltk::fill::GetMaxY() {
+ return maxY;
+}
+
+int mogltk::fill::GetMinX() {
+ return minX;
+}
+
+int mogltk::fill::GetMinY() {
+ return minY;
}
mogltk::fill::sline::sline(int _y, fill * _header) : y(_y), header(_header), pheader(0) {