Commit fda7e6c1 authored by Christoffer Ackelman's avatar Christoffer Ackelman Committed by Esteban Blanc

Removed redundant clip_on variable

parent e326b090
This diff is collapsed.
...@@ -60,7 +60,6 @@ public: ...@@ -60,7 +60,6 @@ public:
GdkPixmap* buffer; GdkPixmap* buffer;
int buffer_width; int buffer_width;
int buffer_height; int buffer_height;
int clip_on;
int clip_cnt; int clip_cnt;
GdkRectangle clip_rectangle[DRAW_CLIP_SIZE]; GdkRectangle clip_rectangle[DRAW_CLIP_SIZE];
GdkPixmap* background_pixmap; GdkPixmap* background_pixmap;
......
...@@ -901,7 +901,7 @@ int GlowDrawQt::rect_helper(GlowWind* wind, int painter_type, int size, int x, ...@@ -901,7 +901,7 @@ int GlowDrawQt::rect_helper(GlowWind* wind, int painter_type, int size, int x,
unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, size); unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, size);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -947,7 +947,7 @@ int GlowDrawQt::arrow_helper(GlowWind* wind, int painter_type, int size, int x1, ...@@ -947,7 +947,7 @@ int GlowDrawQt::arrow_helper(GlowWind* wind, int painter_type, int size, int x1,
unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, size); unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, size);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -985,7 +985,7 @@ int GlowDrawQt::arc_helper(GlowWind* wind, int painter_type, int size, int x, ...@@ -985,7 +985,7 @@ int GlowDrawQt::arc_helper(GlowWind* wind, int painter_type, int size, int x,
DrawWindQt* w = (DrawWindQt*)wind->window; DrawWindQt* w = (DrawWindQt*)wind->window;
if (!fill) { if (!fill) {
if (w->clip_on if (w->clip_cnt > 0
&& !(w->clip_rectangle[w->clip_cnt - 1].x() <= x + width && !(w->clip_rectangle[w->clip_cnt - 1].x() <= x + width
&& w->clip_rectangle[w->clip_cnt - 1].x() && w->clip_rectangle[w->clip_cnt - 1].x()
+ w->clip_rectangle[w->clip_cnt - 1].width() + w->clip_rectangle[w->clip_cnt - 1].width()
...@@ -1000,7 +1000,7 @@ int GlowDrawQt::arc_helper(GlowWind* wind, int painter_type, int size, int x, ...@@ -1000,7 +1000,7 @@ int GlowDrawQt::arc_helper(GlowWind* wind, int painter_type, int size, int x,
unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, size); unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, size);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -1074,7 +1074,7 @@ int GlowDrawQt::line_helper(GlowWind* wind, int painter_type, int size, int x1, ...@@ -1074,7 +1074,7 @@ int GlowDrawQt::line_helper(GlowWind* wind, int painter_type, int size, int x1,
} }
DrawWindQt* w = (DrawWindQt*)wind->window; DrawWindQt* w = (DrawWindQt*)wind->window;
if (w->clip_on if (w->clip_cnt > 0
&& !(w->clip_rectangle[w->clip_cnt - 1].x() <= MAX(x1, x2) && !(w->clip_rectangle[w->clip_cnt - 1].x() <= MAX(x1, x2)
&& w->clip_rectangle[w->clip_cnt - 1].x() && w->clip_rectangle[w->clip_cnt - 1].x()
+ w->clip_rectangle[w->clip_cnt - 1].width() + w->clip_rectangle[w->clip_cnt - 1].width()
...@@ -1088,7 +1088,7 @@ int GlowDrawQt::line_helper(GlowWind* wind, int painter_type, int size, int x1, ...@@ -1088,7 +1088,7 @@ int GlowDrawQt::line_helper(GlowWind* wind, int painter_type, int size, int x1,
unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, size); unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, size);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -1190,7 +1190,7 @@ int GlowDrawQt::polyline_helper(GlowWind* wind, int painter_type, int size, ...@@ -1190,7 +1190,7 @@ int GlowDrawQt::polyline_helper(GlowWind* wind, int painter_type, int size,
unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, size); unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, size);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -1256,7 +1256,7 @@ int GlowDrawQt::text(GlowWind* wind, int x, int y, char* text, int len, ...@@ -1256,7 +1256,7 @@ int GlowDrawQt::text(GlowWind* wind, int x, int y, char* text, int len,
unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, idx); unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, idx);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -1298,7 +1298,7 @@ int GlowDrawQt::text_cursor(GlowWind* wind, int x, int y, char* text, int len, ...@@ -1298,7 +1298,7 @@ int GlowDrawQt::text_cursor(GlowWind* wind, int x, int y, char* text, int len,
unique_ptr<QPainter> painter = get_painter(w->buffer, this, color, 1); unique_ptr<QPainter> painter = get_painter(w->buffer, this, color, 1);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -1337,7 +1337,7 @@ int GlowDrawQt::text_erase(GlowWind* wind, int x, int y, char* text, int len, ...@@ -1337,7 +1337,7 @@ int GlowDrawQt::text_erase(GlowWind* wind, int x, int y, char* text, int len,
painter->setFont(get_font(font_idx, painter_type, idx)); painter->setFont(get_font(font_idx, painter_type, idx));
} }
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -1396,7 +1396,7 @@ int GlowDrawQt::image_helper(GlowWind* wind, int x, int y, int width, ...@@ -1396,7 +1396,7 @@ int GlowDrawQt::image_helper(GlowWind* wind, int x, int y, int width,
if (clip_mask) { if (clip_mask) {
set_image_clip_mask(painter, clip_mask, x, y); set_image_clip_mask(painter, clip_mask, x, y);
} else if (w->clip_on) { } else if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -1841,7 +1841,6 @@ int GlowDrawQt::set_clip_rectangle( ...@@ -1841,7 +1841,6 @@ int GlowDrawQt::set_clip_rectangle(
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;
} }
...@@ -1853,9 +1852,6 @@ void GlowDrawQt::reset_clip_rectangle(GlowWind* wind) ...@@ -1853,9 +1852,6 @@ void GlowDrawQt::reset_clip_rectangle(GlowWind* wind)
return; return;
} }
w->clip_cnt--; w->clip_cnt--;
if (w->clip_cnt == 0) {
w->clip_on = 0;
}
} }
int GlowDrawQt::clip_level(GlowWind* wind) int GlowDrawQt::clip_level(GlowWind* wind)
...@@ -1874,7 +1870,7 @@ int GlowDrawQt::draw_point( ...@@ -1874,7 +1870,7 @@ int GlowDrawQt::draw_point(
unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, 0); unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, 0);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -1894,7 +1890,7 @@ int GlowDrawQt::draw_points(GlowWind* wind, glow_sPointX* points, int point_num, ...@@ -1894,7 +1890,7 @@ int GlowDrawQt::draw_points(GlowWind* wind, glow_sPointX* points, int point_num,
unique_ptr<QPoint[]> qpoints = points_to_qt_points(points, point_num); unique_ptr<QPoint[]> qpoints = points_to_qt_points(points, point_num);
unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, 0); unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, 0);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -1967,7 +1963,7 @@ void GlowDrawQt::buffer_background(DrawWind* wind, GlowCtx* cctx) ...@@ -1967,7 +1963,7 @@ void GlowDrawQt::buffer_background(DrawWind* wind, GlowCtx* cctx)
unique_ptr<QPainter> painterBg unique_ptr<QPainter> painterBg
= get_painter(w->background_pixmap, this, glow_eDrawType_Line, 0); = get_painter(w->background_pixmap, this, glow_eDrawType_Line, 0);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painterBg); set_clip(w, painterBg);
} }
...@@ -1994,7 +1990,7 @@ void GlowDrawQt::buffer_background(DrawWind* wind, GlowCtx* cctx) ...@@ -1994,7 +1990,7 @@ void GlowDrawQt::buffer_background(DrawWind* wind, GlowCtx* cctx)
unique_ptr<QPainter> painter = get_painter(w->buffer, this, bg, 0); unique_ptr<QPainter> painter = get_painter(w->buffer, this, bg, 0);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -2767,7 +2763,7 @@ int GlowDrawQt::gradient_fill_rect(GlowWind* wind, int x, int y, int w, int h, ...@@ -2767,7 +2763,7 @@ int GlowDrawQt::gradient_fill_rect(GlowWind* wind, int x, int y, int w, int h,
unique_ptr<QPainter> painter = new QPainter(ww->buffer); unique_ptr<QPainter> painter = new QPainter(ww->buffer);
if (ww->clip_on) { if (ww->clip_cnt > 0) {
set_clip(ww, painter); set_clip(ww, painter);
} }
...@@ -2793,7 +2789,7 @@ int GlowDrawQt::gradient_fill_rectrounded(GlowWind* wind, int x, int y, int w, ...@@ -2793,7 +2789,7 @@ int GlowDrawQt::gradient_fill_rectrounded(GlowWind* wind, int x, int y, int w,
unique_ptr<QPainter> painter = new QPainter(ww->buffer); unique_ptr<QPainter> painter = new QPainter(ww->buffer);
if (ww->clip_on) { if (ww->clip_cnt > 0) {
set_clip(ww, painter); set_clip(ww, painter);
} }
...@@ -2833,7 +2829,7 @@ int GlowDrawQt::gradient_fill_arc(GlowWind* wind, int x, int y, int w, int h, ...@@ -2833,7 +2829,7 @@ int GlowDrawQt::gradient_fill_arc(GlowWind* wind, int x, int y, int w, int h,
unique_ptr<QPainter> painter = new QPainter(ww->buffer); unique_ptr<QPainter> painter = new QPainter(ww->buffer);
if (ww->clip_on) { if (ww->clip_cnt > 0) {
set_clip(ww, painter); set_clip(ww, painter);
} }
...@@ -2870,7 +2866,7 @@ int GlowDrawQt::gradient_fill_polyline(GlowWind* wind, glow_sPointX* points, ...@@ -2870,7 +2866,7 @@ int GlowDrawQt::gradient_fill_polyline(GlowWind* wind, glow_sPointX* points,
QPainterPath path; QPainterPath path;
double x0, y0, x1, y1; double x0, y0, x1, y1;
if (ww->clip_on) { if (ww->clip_cnt > 0) {
set_clip(ww, painter); set_clip(ww, painter);
} }
...@@ -2913,7 +2909,7 @@ int GlowDrawQt::text_qt(GlowWind* wind, int x, int y, char* text, int len, ...@@ -2913,7 +2909,7 @@ int GlowDrawQt::text_qt(GlowWind* wind, int x, int y, char* text, int len,
unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, idx); unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, idx);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
...@@ -3019,7 +3015,7 @@ int GlowDrawQt::text_erase_qt(GlowWind* wind, int x, int y, char* text, int len, ...@@ -3019,7 +3015,7 @@ int GlowDrawQt::text_erase_qt(GlowWind* wind, int x, int y, char* text, int len,
unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, idx); unique_ptr<QPainter> painter = get_painter(w->buffer, this, painter_type, idx);
if (w->clip_on) { if (w->clip_cnt > 0) {
set_clip(w, painter); set_clip(w, painter);
} }
......
...@@ -59,7 +59,7 @@ class GlowCustomColors; ...@@ -59,7 +59,7 @@ class GlowCustomColors;
class DrawWindQt : public DrawWind { class DrawWindQt : public DrawWind {
public: public:
DrawWindQt() DrawWindQt()
: window(0), buffer(0), clip_on(0), clip_cnt(0), background_pixmap(0), : window(0), buffer(0), clip_cnt(0), background_pixmap(0),
background_pixmap_width(0), background_pixmap_height(0) background_pixmap_width(0), background_pixmap_height(0)
{ {
memset(clip_rectangle, 0, sizeof(clip_rectangle)); memset(clip_rectangle, 0, sizeof(clip_rectangle));
...@@ -67,7 +67,6 @@ public: ...@@ -67,7 +67,6 @@ public:
QWidget* window; QWidget* window;
QImage* buffer; QImage* buffer;
int clip_on;
int clip_cnt; int clip_cnt;
QRect clip_rectangle[DRAW_CLIP_SIZE]; QRect clip_rectangle[DRAW_CLIP_SIZE];
QPixmap* background_pixmap; QPixmap* background_pixmap;
......
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