summaryrefslogtreecommitdiffstats
path: root/generic/tkbltGrMisc.h
diff options
context:
space:
mode:
authorAdrián Medraño Calvo <adrian@medranocalvo.com>2018-10-08 12:00:00 (GMT)
committerAdrián Medraño Calvo <adrian@medranocalvo.com>2018-10-08 12:00:00 (GMT)
commitdbddfe871076e4a9c10438a8af9c1dfea3b917f6 (patch)
tree8a6b82b70aea8c04445638aeddf2038fe2ad032e /generic/tkbltGrMisc.h
parent9b8c9769c0b7ad4e232550609f8e99d3d5b24f3c (diff)
downloadblt-dbddfe871076e4a9c10438a8af9c1dfea3b917f6.zip
blt-dbddfe871076e4a9c10438a8af9c1dfea3b917f6.tar.gz
blt-dbddfe871076e4a9c10438a8af9c1dfea3b917f6.tar.bz2
Correct display of zero values with -logscale 1
In order to do that, improve the clipping functionality in tkbltGrMisc.C to support infinite coordinates. It also now provides more information with regards to its processing, letting tkbltGrElemLine.C use that same routine instead of duplicade the clipping code.
Diffstat (limited to 'generic/tkbltGrMisc.h')
-rw-r--r--generic/tkbltGrMisc.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/generic/tkbltGrMisc.h b/generic/tkbltGrMisc.h
index ba86b75..5c16dce 100644
--- a/generic/tkbltGrMisc.h
+++ b/generic/tkbltGrMisc.h
@@ -104,6 +104,26 @@ namespace Blt {
int offset;
} Dashes;
+ typedef enum {
+ CLIP_OUTSIDE = 0,
+ CLIP_INSIDE = 1 << 0,
+ CLIP_P = 1 << 1,
+ CLIP_Q = 1 << 2
+ } LineRectClipResult;
+
+ inline LineRectClipResult operator|(LineRectClipResult a, LineRectClipResult b) {
+ return static_cast<LineRectClipResult>(static_cast<int>(a) | static_cast<int>(b));
+ }
+
+ inline LineRectClipResult operator&(LineRectClipResult a, LineRectClipResult b) {
+ return static_cast<LineRectClipResult>(static_cast<int>(a) & static_cast<int>(b));
+ }
+
+ inline LineRectClipResult & operator|=(LineRectClipResult & rhs, LineRectClipResult v) {
+ rhs = rhs | v;
+ return rhs;
+ }
+
extern char* dupstr(const char*);
extern Graph* getGraphFromWindowData(Tk_Window tkwin);
@@ -111,7 +131,7 @@ namespace Blt {
int nScreenPts);
extern int polyRectClip(Region2d *extsPtr, Point2d *inputPts,
int nInputPts, Point2d *outputPts);
- extern int lineRectClip(Region2d *regionPtr, Point2d *p, Point2d *q);
+ extern LineRectClipResult lineRectClip(Region2d *regionPtr, Point2d *p, Point2d *q);
extern Point2d getProjection (int x, int y, Point2d *p, Point2d *q);
};