Commit c0c30a11 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Removed unnecessary clip_on variable.

parent bf73f91d
...@@ -563,8 +563,6 @@ void GlowDrawGtk::init_nav(GtkWidget* nav_widget) ...@@ -563,8 +563,6 @@ void GlowDrawGtk::init_nav(GtkWidget* nav_widget)
{ {
nav_wind.window = nav_widget->window; nav_wind.window = nav_widget->window;
create_buffer(&nav_wind); create_buffer(&nav_wind);
nav_wind.clip_cnt = 0;
nav_wind.clip_on = 0;
gtk_widget_modify_bg(nav_widget, GTK_STATE_NORMAL, &background); gtk_widget_modify_bg(nav_widget, GTK_STATE_NORMAL, &background);
...@@ -1845,15 +1843,15 @@ void GlowDrawGtk::reset_background(DrawWind* wind) ...@@ -1845,15 +1843,15 @@ void GlowDrawGtk::reset_background(DrawWind* wind)
void GlowDrawGtk::set_clip(GdkGC* gc) void GlowDrawGtk::set_clip(GdkGC* gc)
{ {
if (((DrawWindGtk*)w)->clip_on) { if (w->clip_cnt > 0) {
gdk_gc_set_clip_rectangle(gc, gdk_gc_set_clip_rectangle(gc,
&((DrawWindGtk*)w)->clip_rectangle[((DrawWindGtk*)w)->clip_cnt - 1]); &((DrawWindGtk*)w)->clip_rectangle[w->clip_cnt - 1]);
} }
} }
void GlowDrawGtk::reset_clip(GdkGC* gc) void GlowDrawGtk::reset_clip(GdkGC* gc)
{ {
if (((DrawWindGtk*)w)->clip_on) { if (w->clip_cnt > 0) {
gdk_gc_set_clip_rectangle(gc, NULL); gdk_gc_set_clip_rectangle(gc, NULL);
} }
} }
...@@ -1870,22 +1868,19 @@ int GlowDrawGtk::set_clip_rectangle( ...@@ -1870,22 +1868,19 @@ int GlowDrawGtk::set_clip_rectangle(
int x1 = MAX(ll_x, ur_x); int x1 = MAX(ll_x, ur_x);
int y0 = MIN(ll_y, ur_y); int y0 = MIN(ll_y, ur_y);
int y1 = MAX(ll_y, ur_y); int y1 = MAX(ll_y, ur_y);
if (w->clip_cnt != 0) { if (w->clip_cnt > 0) {
x0 = MAX(x0, w->clip_rectangle[w->clip_cnt - 1].x); x0 = MAX(x0, w->clip_rectangle[w->clip_cnt - 1].x);
x1 = MIN(x1, w->clip_rectangle[w->clip_cnt - 1].x x1 = MIN(x1, w->clip_rectangle[w->clip_cnt - 1].x
+ w->clip_rectangle[w->clip_cnt - 1].width); + w->clip_rectangle[w->clip_cnt - 1].width);
y0 = MAX(y0, w->clip_rectangle[w->clip_cnt - 1].y); y0 = MAX(y0, w->clip_rectangle[w->clip_cnt - 1].y);
y1 = MIN(y1, w->clip_rectangle[w->clip_cnt - 1].y y1 = MIN(y1, w->clip_rectangle[w->clip_cnt - 1].y
+ w->clip_rectangle[w->clip_cnt - 1].height); + w->clip_rectangle[w->clip_cnt - 1].height);
x0 = (x0 > x1) ? x1 : x0;
y0 = (y0 > y1) ? y1 : y0;
} }
w->clip_rectangle[w->clip_cnt].x = x0; w->clip_rectangle[w->clip_cnt].x = x0;
w->clip_rectangle[w->clip_cnt].y = y0; w->clip_rectangle[w->clip_cnt].y = y0;
w->clip_rectangle[w->clip_cnt].width = x1 - x0; w->clip_rectangle[w->clip_cnt].width = x1 - x0;
w->clip_rectangle[w->clip_cnt].height = y1 - y0; w->clip_rectangle[w->clip_cnt].height = y1 - y0;
w->clip_cnt++; w->clip_cnt++;
w->clip_on = 1;
return 1; return 1;
} }
...@@ -2371,7 +2366,7 @@ void GlowDrawGtk::image_pixel_iter(glow_tImImage orig_image, ...@@ -2371,7 +2366,7 @@ void GlowDrawGtk::image_pixel_iter(glow_tImImage orig_image,
void GlowDrawGtk::set_cairo_clip(cairo_t* cr) void GlowDrawGtk::set_cairo_clip(cairo_t* cr)
{ {
if (w->clip_on) { if (w->clip_cnt > 0) {
cairo_rectangle(cr, w->clip_rectangle[w->clip_cnt - 1].x, cairo_rectangle(cr, w->clip_rectangle[w->clip_cnt - 1].x,
w->clip_rectangle[w->clip_cnt - 1].y, w->clip_rectangle[w->clip_cnt - 1].y,
w->clip_rectangle[w->clip_cnt - 1].width, w->clip_rectangle[w->clip_cnt - 1].width,
...@@ -2382,7 +2377,7 @@ void GlowDrawGtk::set_cairo_clip(cairo_t* cr) ...@@ -2382,7 +2377,7 @@ void GlowDrawGtk::set_cairo_clip(cairo_t* cr)
void GlowDrawGtk::reset_cairo_clip(cairo_t* cr) void GlowDrawGtk::reset_cairo_clip(cairo_t* cr)
{ {
if (((DrawWindGtk*)w)->clip_on) { if (w->clip_cnt > 0) {
cairo_reset_clip(cr); cairo_reset_clip(cr);
} }
} }
......
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
window_width = window_height = 0; window_width = window_height = 0;
subwindow_x = subwindow_y = 0; subwindow_x = subwindow_y = 0;
subwindow_scale = 1; subwindow_scale = 1;
clip_cnt = clip_on = 0; clip_cnt = 0;
memset(clip_rectangle, 0, sizeof(clip_rectangle)); memset(clip_rectangle, 0, sizeof(clip_rectangle));
} }
GdkWindow* window = NULL; GdkWindow* window = NULL;
...@@ -69,7 +69,6 @@ public: ...@@ -69,7 +69,6 @@ public:
DrawWind* copy() { DrawWind* copy() {
DrawWindGtk* tmp = new DrawWindGtk(); DrawWindGtk* tmp = new DrawWindGtk();
tmp->clip_on = this->clip_on;
tmp->clip_cnt = this->clip_cnt; tmp->clip_cnt = this->clip_cnt;
tmp->window = this->window; tmp->window = this->window;
tmp->buffer = this->buffer; tmp->buffer = this->buffer;
......
...@@ -174,7 +174,7 @@ unique_ptr<QPainter> GlowDrawQt::get_painter(QPaintDevice* window, ...@@ -174,7 +174,7 @@ unique_ptr<QPainter> GlowDrawQt::get_painter(QPaintDevice* window,
painter->setPen(QPen(painter->brush(), size + 1)); painter->setPen(QPen(painter->brush(), size + 1));
} }
if (w && w->clip_on) { if (w && w->clip_cnt > 0) {
painter->setClipRect(w->clip_rectangle[w->clip_cnt - 1]); painter->setClipRect(w->clip_rectangle[w->clip_cnt - 1]);
painter->setClipping(true); painter->setClipping(true);
} }
...@@ -239,8 +239,6 @@ void GlowDrawQt::init_nav(QWidget* nav_widget) ...@@ -239,8 +239,6 @@ void GlowDrawQt::init_nav(QWidget* nav_widget)
assert(dynamic_cast<QtScrollWidgetGlow*>(nav_widget) != NULL); assert(dynamic_cast<QtScrollWidgetGlow*>(nav_widget) != NULL);
nav_wind.window = dynamic_cast<QtScrollWidgetGlow*>(nav_widget); nav_wind.window = dynamic_cast<QtScrollWidgetGlow*>(nav_widget);
nav_wind.buffer = &(dynamic_cast<QtScrollWidgetGlow*>(nav_widget)->image); nav_wind.buffer = &(dynamic_cast<QtScrollWidgetGlow*>(nav_widget)->image);
nav_wind.clip_cnt = 0;
nav_wind.clip_on = 0;
QPalette pal; QPalette pal;
pal.setColor(QPalette::Background, background); pal.setColor(QPalette::Background, background);
...@@ -1386,22 +1384,19 @@ int GlowDrawQt::set_clip_rectangle( ...@@ -1386,22 +1384,19 @@ int GlowDrawQt::set_clip_rectangle(
int x1 = MAX(ll_x, ur_x); int x1 = MAX(ll_x, ur_x);
int y0 = MIN(ll_y, ur_y); int y0 = MIN(ll_y, ur_y);
int y1 = MAX(ll_y, ur_y); int y1 = MAX(ll_y, ur_y);
if (w->clip_cnt != 0) { if (w->clip_cnt > 0) {
x0 = MAX(x0, w->clip_rectangle[w->clip_cnt - 1].x()); x0 = MAX(x0, w->clip_rectangle[w->clip_cnt - 1].x());
x1 = MIN(x1, w->clip_rectangle[w->clip_cnt - 1].x() x1 = MIN(x1, w->clip_rectangle[w->clip_cnt - 1].x()
+ w->clip_rectangle[w->clip_cnt - 1].width()); + w->clip_rectangle[w->clip_cnt - 1].width());
y0 = MAX(y0, w->clip_rectangle[w->clip_cnt - 1].y()); y0 = MAX(y0, w->clip_rectangle[w->clip_cnt - 1].y());
y1 = MIN(y1, w->clip_rectangle[w->clip_cnt - 1].y() y1 = MIN(y1, w->clip_rectangle[w->clip_cnt - 1].y()
+ w->clip_rectangle[w->clip_cnt - 1].height()); + w->clip_rectangle[w->clip_cnt - 1].height());
x0 = (x0 > x1) ? x1 : x0;
y0 = (y0 > y1) ? y1 : y0;
} }
w->clip_rectangle[w->clip_cnt].setX(x0); w->clip_rectangle[w->clip_cnt].setX(x0);
w->clip_rectangle[w->clip_cnt].setY(y0); w->clip_rectangle[w->clip_cnt].setY(y0);
w->clip_rectangle[w->clip_cnt].setWidth(x1 - x0); w->clip_rectangle[w->clip_cnt].setWidth(x1 - x0);
w->clip_rectangle[w->clip_cnt].setHeight(y1 - y0); w->clip_rectangle[w->clip_cnt].setHeight(y1 - y0);
w->clip_cnt++; w->clip_cnt++;
w->clip_on = 1;
return 1; return 1;
} }
......
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
window_width = window_height = 0; window_width = window_height = 0;
subwindow_x = subwindow_y = 0; subwindow_x = subwindow_y = 0;
subwindow_scale = 1; subwindow_scale = 1;
clip_cnt = clip_on = 0; clip_cnt = 0;
memset(clip_rectangle, 0, sizeof(clip_rectangle)); memset(clip_rectangle, 0, sizeof(clip_rectangle));
} }
...@@ -76,7 +76,6 @@ public: ...@@ -76,7 +76,6 @@ public:
DrawWind* copy() { DrawWind* copy() {
DrawWindQt* tmp = new DrawWindQt(); DrawWindQt* tmp = new DrawWindQt();
tmp->clip_on = this->clip_on;
tmp->clip_cnt = this->clip_cnt; tmp->clip_cnt = this->clip_cnt;
tmp->window = this->window; tmp->window = this->window;
tmp->buffer = this->buffer; tmp->buffer = this->buffer;
......
...@@ -53,8 +53,6 @@ void GlowDraw::reset_clip_rectangle(DrawWind* w) ...@@ -53,8 +53,6 @@ void GlowDraw::reset_clip_rectangle(DrawWind* w)
return; return;
} }
w->clip_cnt--; w->clip_cnt--;
if (w->clip_cnt == 0)
w->clip_on = 0;
} }
glow_eGradient GlowDraw::gradient_rotate(double rot, glow_eGradient gradient) glow_eGradient GlowDraw::gradient_rotate(double rot, glow_eGradient gradient)
......
...@@ -58,7 +58,6 @@ public: ...@@ -58,7 +58,6 @@ public:
int subwindow_x; //!< Subwindow x coordinate in pixel. int subwindow_x; //!< Subwindow x coordinate in pixel.
int subwindow_y; //!< Subwindow y coordinate in pixel. int subwindow_y; //!< Subwindow y coordinate in pixel.
double subwindow_scale; //!< Subwindow scale. double subwindow_scale; //!< Subwindow scale.
int clip_on = 0;
int clip_cnt = 0; int clip_cnt = 0;
virtual DrawWind* copy() = 0; virtual DrawWind* copy() = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment