aboutsummaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-03-15 14:42:57 -0500
committerJeffrey Armstrong <jeff@approximatrix.com>2020-03-15 14:42:57 -0500
commitc88216bf7409d3b0d8a400082a1e8bfe2cd8309a (patch)
tree65ec89283f51be2ba11275d84bedcf8208584abd /util.h
parentffd5409c6f04734c43f3302610f51b7983043aa7 (diff)
downloadgemworm-c88216bf7409d3b0d8a400082a1e8bfe2cd8309a.zip
gemworm-c88216bf7409d3b0d8a400082a1e8bfe2cd8309a.tar.gz
Fixed redraw issues by actually passing the dirty rectangle into the redraw routine rather than considering the entire window dirty.
Diffstat (limited to 'util.h')
-rw-r--r--util.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..db82c04
--- /dev/null
+++ b/util.h
@@ -0,0 +1,54 @@
+#ifndef UTIL_WORM_HEADERS
+#define UTIL_WORM_HEADERS
+
+/* Mostly compatability stuff */
+
+#ifdef __GNUC__
+
+#include <gem.h>
+
+#define HIWORD(x) ((int16_t)((uint32_t)x >> 16))
+#define LOWORD(x) ((int16_t)((uint32_t)x & 0xFFFF))
+
+#else
+
+#include <portab.h>
+#include <aes.h>
+#include <vdi.h>
+
+#endif /* __GNUC__ */
+
+#ifndef WF_WXYWH
+#ifdef WF_WORKXYWH
+#define WF_WXYWH WF_WORKXYWH
+#endif
+#endif
+
+#ifndef WF_CXYWH
+#ifdef WF_CURRXYWH
+#define WF_CXYWH WF_CURRXYWH
+#endif
+#endif
+
+#define max(x,y) x>y ? x : y
+#define min(x,y) x<y ? x : y
+
+#ifndef MGEMLIB
+static int rc_intersect(const GRECT *one, GRECT *two)
+{
+WORD tx,ty,tw,th;
+
+ tw = min(one->g_x+one->g_w,two->g_x+two->g_w);
+ th = min(one->g_y+one->g_h,two->g_y+two->g_h);
+ tx = max(one->g_x,two->g_x);
+ ty = max(one->g_y,two->g_y);
+ two->g_x = tx;
+ two->g_y = ty;
+ two->g_w = tw-tx;
+ two->g_h = th-ty;
+ return ( (tw > tx) && (th > ty) );
+}
+#endif
+
+
+#endif /* UTIL_WORM_HEADERS */