From e59c06603d7488904582b21295cdaca0cbd373f3 Mon Sep 17 00:00:00 2001 From: William Joye Date: Sun, 26 Mar 2017 12:29:46 -0400 Subject: only render contours in bbox --- tksao/frame/base.C | 9 ++++----- tksao/frame/context.C | 7 +++---- tksao/frame/context.h | 2 +- tksao/frame/contour.C | 11 ++++------- tksao/frame/contour.h | 4 ++-- 5 files changed, 14 insertions(+), 19 deletions(-) diff --git a/tksao/frame/base.C b/tksao/frame/base.C index d3ffb38..8179ee5 100644 --- a/tksao/frame/base.C +++ b/tksao/frame/base.C @@ -1715,8 +1715,8 @@ void Base::updateMagnifier(const Vector& vv) // render contours // needs to before markers if marker is filled - currentContext->contourX11(magnifierPixmap, Coord::MAGNIFIER, - magnifierWidth, magnifierHeight); + currentContext->contourX11(magnifierPixmap, Coord::MAGNIFIER, + bbox(0,0,magnifierWidth,magnifierHeight)); if (showMarkers) { x11MagnifierMarkers(&userMarkers, bb); @@ -1956,8 +1956,7 @@ void Base::updatePM(const BBox& bbox) // contours // needs to before markers if marker is filled - currentContext->contourX11(pixmap, Coord::WIDGET, - options->width, options->height); + currentContext->contourX11(pixmap, Coord::WIDGET, bbox); // markers if (showMarkers) { @@ -1975,7 +1974,7 @@ void Base::updatePM(const BBox& bbox) if (useCrosshair) x11Crosshair(pixmap, Coord::WIDGET, options->width, options->height); - // highlite bbox + // highlite bbox/compass x11Graphics(); if (DebugPerf) diff --git a/tksao/frame/context.C b/tksao/frame/context.C index 738ca55..9a6adeb 100644 --- a/tksao/frame/context.C +++ b/tksao/frame/context.C @@ -622,8 +622,7 @@ void Context::contourPS(Widget::PSColorSpace cs) } } -void Context::contourX11(Pixmap pm, Coord::InternalSystem sys, - int width, int height) +void Context::contourX11(Pixmap pm, Coord::InternalSystem sys, const BBox& bbox) { if (!cfits) return; @@ -633,7 +632,7 @@ void Context::contourX11(Pixmap pm, Coord::InternalSystem sys, if (hasAuxContour_) { if (auxcontours_.tail()) do - auxcontours_.current()->render(pm, sys, width, height); + auxcontours_.current()->render(pm, sys, bbox); while (auxcontours_.previous()); } @@ -641,7 +640,7 @@ void Context::contourX11(Pixmap pm, Coord::InternalSystem sys, List& cc = fvcontour_.lcontourlevel(); if (cc.head()) do - cc.current()->render(pm, sys, width, height); + cc.current()->render(pm, sys, bbox); while (cc.next()); } } diff --git a/tksao/frame/context.h b/tksao/frame/context.h index f0055da..47e0bb5 100644 --- a/tksao/frame/context.h +++ b/tksao/frame/context.h @@ -135,7 +135,7 @@ class Context { void contourLoadAux(istream&, Coord::CoordSystem, Coord::SkyFrame, const char*, int, int); void contourPS(Widget::PSColorSpace cs); - void contourX11(Pixmap, Coord::InternalSystem, int, int); + void contourX11(Pixmap, Coord::InternalSystem, const BBox&); #ifdef MAC_OSX_TK void contourMacOSX(); #endif diff --git a/tksao/frame/contour.C b/tksao/frame/contour.C index d533ef9..5b38f9a 100644 --- a/tksao/frame/contour.C +++ b/tksao/frame/contour.C @@ -59,11 +59,11 @@ void ContourLevel::list(ostream& str, FitsImage* fits, } void ContourLevel::render(Pixmap pmap, Coord::InternalSystem sys, - int width, int height) + const BBox& bbox) { if (lcontour_.head()) { do - lcontour_.current()->render(pmap, sys, width, height); + lcontour_.current()->render(pmap, sys, bbox); while (lcontour_.next()); } } @@ -146,8 +146,7 @@ void Contour::list(ostream& str, FitsImage* fits, str << ')' << endl; } -void Contour::render(Pixmap pmap, Coord::InternalSystem sys, - int width, int height) +void Contour::render(Pixmap pmap, Coord::InternalSystem sys, const BBox& bbox) { if (lvertex_.head()) { XSetForeground(base_->display, parent_->gc_, parent_->color_); @@ -166,15 +165,13 @@ void Contour::render(Pixmap pmap, Coord::InternalSystem sys, ww, LineOnOffDash, CapButt, JoinMiter); } - BBox bb = BBox(0, 0, width, height); - Vector u1 = lvertex_.current()->vector; while (lvertex_.next()) { Vector u2 = lvertex_.current()->vector; Vector v1 = base_->mapFromRef(u1,sys); Vector v2 = base_->mapFromRef(u2,sys); - if (bb.isIn(v1) || bb.isIn(v2)) + if (bbox.isIn(v1) || bbox.isIn(v2)) XDrawLine(base_->display, pmap, parent_->gc_, (int)v1[0], (int)v1[1], (int)v2[0], (int)v2[1]); diff --git a/tksao/frame/contour.h b/tksao/frame/contour.h index 853ab22..bda8cbd 100644 --- a/tksao/frame/contour.h +++ b/tksao/frame/contour.h @@ -43,7 +43,7 @@ class ContourLevel { List& lcontour() {return lcontour_;} void list(ostream& str, FitsImage*, Coord::CoordSystem, Coord::SkyFrame); - void render(Pixmap, Coord::InternalSystem, int, int); + void render(Pixmap, Coord::InternalSystem, const BBox&); void ps(int); void updateCoords(const Matrix&); #ifdef MAC_OSX_TK @@ -84,7 +84,7 @@ class Contour { List& lvertex() {return lvertex_;} void list(ostream& str, FitsImage*, Coord::CoordSystem, Coord::SkyFrame); - void render(Pixmap, Coord::InternalSystem, int, int); + void render(Pixmap, Coord::InternalSystem, const BBox&); void ps(int); void updateCoords(const Matrix&); #ifdef MAC_OSX_TK -- cgit v0.12