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

Removed redundant clip_on variable

parent e326b090
......@@ -538,7 +538,7 @@ static GdkColor glow_allocate_custom_color(GlowDrawGtk* draw_ctx,
DrawWindGtk::DrawWindGtk()
: toplevel(0), shell(0), window(0), colormap(0), buffer(0), buffer_width(0),
buffer_height(0), clip_on(0), clip_cnt(0), background_pixmap(0),
buffer_height(0), clip_cnt(0), background_pixmap(0),
background_pixmap_width(0), background_pixmap_height(0)
{
memset(clip_rectangle, 0, sizeof(clip_rectangle));
......@@ -1281,7 +1281,7 @@ int GlowDrawGtk::rect(GlowWind* wind, int x, int y, int width, int height,
if (gc_type == glow_eDrawType_LineGray && highlight)
gc_type = glow_eDrawType_Line;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type + highlight, idx));
if (!w->draw_buffer_only)
......@@ -1291,7 +1291,7 @@ int GlowDrawGtk::rect(GlowWind* wind, int x, int y, int width, int height,
gdk_draw_rectangle(w->buffer, get_gc(this, gc_type + highlight, idx), 0, x,
y, width, height);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type + highlight, idx));
return 1;
......@@ -1304,7 +1304,7 @@ int GlowDrawGtk::rect_erase(
return 1;
DrawWindGtk* w = (DrawWindGtk*)wind->window;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, glow_eDrawType_LineErase, idx));
if (!w->draw_buffer_only)
......@@ -1314,7 +1314,7 @@ int GlowDrawGtk::rect_erase(
gdk_draw_rectangle(w->buffer, get_gc(this, glow_eDrawType_LineErase, idx),
0, x, y, width, height);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, glow_eDrawType_LineErase, idx));
return 1;
......@@ -1332,7 +1332,7 @@ int GlowDrawGtk::arrow(GlowWind* wind, int x1, int y1, int x2, int y2, int x3,
if (gc_type == glow_eDrawType_LineGray && highlight)
gc_type = glow_eDrawType_Line;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type + highlight, idx));
if (!w->draw_buffer_only)
......@@ -1342,7 +1342,7 @@ int GlowDrawGtk::arrow(GlowWind* wind, int x1, int y1, int x2, int y2, int x3,
gdk_draw_polygon(
w->buffer, get_gc(this, gc_type + highlight, idx), 1, p, 4);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type + highlight, idx));
return 1;
......@@ -1357,7 +1357,7 @@ int GlowDrawGtk::arrow_erase(
GdkPoint p[4] = { { x1, y1 }, { x2, y2 }, { x3, y3 }, { x1, y1 } };
DrawWindGtk* w = (DrawWindGtk*)wind->window;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, glow_eDrawType_LineErase, idx));
if (!w->draw_buffer_only)
......@@ -1367,7 +1367,7 @@ int GlowDrawGtk::arrow_erase(
gdk_draw_polygon(
w->buffer, get_gc(this, glow_eDrawType_LineErase, idx), 1, p, 4);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, glow_eDrawType_LineErase, idx));
return 1;
......@@ -1380,7 +1380,7 @@ int GlowDrawGtk::arc(GlowWind* wind, int x, int y, int width, int height,
return 1;
DrawWindGtk* w = (DrawWindGtk*)wind->window;
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
+ w->clip_rectangle[w->clip_cnt - 1].width
......@@ -1406,7 +1406,7 @@ int GlowDrawGtk::arc(GlowWind* wind, int x, int y, int width, int height,
else if (angle1 < 0)
angle1 = angle1 + (-angle1 / 360 + 1) * 360;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type + highlight, idx));
if (!w->draw_buffer_only)
......@@ -1417,7 +1417,7 @@ int GlowDrawGtk::arc(GlowWind* wind, int x, int y, int width, int height,
gdk_draw_arc(w->buffer, get_gc(this, gc_type + highlight, idx), 0, x, y,
width, height, angle1 * 64, angle2 * 64);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type + highlight, idx));
return 1;
......@@ -1438,7 +1438,7 @@ int GlowDrawGtk::fill_arc(GlowWind* wind, int x, int y, int width, int height,
else if (angle1 < 0)
angle1 = angle1 + (-angle1 / 360 + 1) * 360;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type + highlight, 0));
if (!w->draw_buffer_only)
......@@ -1448,7 +1448,7 @@ int GlowDrawGtk::fill_arc(GlowWind* wind, int x, int y, int width, int height,
gdk_draw_arc(w->buffer, get_gc(this, gc_type + highlight, 0), 1, x, y,
width, height, angle1 * 64, angle2 * 64);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type + highlight, 0));
return 1;
......@@ -1461,7 +1461,7 @@ int GlowDrawGtk::arc_erase(GlowWind* wind, int x, int y, int width, int height,
return 1;
DrawWindGtk* w = (DrawWindGtk*)wind->window;
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
+ w->clip_rectangle[w->clip_cnt - 1].width
......@@ -1480,7 +1480,7 @@ int GlowDrawGtk::arc_erase(GlowWind* wind, int x, int y, int width, int height,
else if (angle1 < 0)
angle1 = angle1 + (-angle1 / 360 + 1) * 360;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, glow_eDrawType_LineErase, idx));
if (!w->draw_buffer_only)
......@@ -1490,7 +1490,7 @@ int GlowDrawGtk::arc_erase(GlowWind* wind, int x, int y, int width, int height,
gdk_draw_arc(w->buffer, get_gc(this, glow_eDrawType_LineErase, idx), 0, x,
y, width, height, angle1 * 64, angle2 * 64);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, glow_eDrawType_LineErase, idx));
return 1;
}
......@@ -1502,7 +1502,7 @@ int GlowDrawGtk::line(GlowWind* wind, int x1, int y1, int x2, int y2,
return 1;
DrawWindGtk* w = (DrawWindGtk*)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
+ w->clip_rectangle[w->clip_cnt - 1].width
......@@ -1520,7 +1520,7 @@ int GlowDrawGtk::line(GlowWind* wind, int x1, int y1, int x2, int y2,
if (gc_type == glow_eDrawType_LineGray && highlight)
gc_type = glow_eDrawType_Line;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type + highlight, idx));
if (!w->draw_buffer_only)
......@@ -1530,7 +1530,7 @@ int GlowDrawGtk::line(GlowWind* wind, int x1, int y1, int x2, int y2,
gdk_draw_line(
w->buffer, get_gc(this, gc_type + highlight, idx), x1, y1, x2, y2);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type + highlight, idx));
return 1;
}
......@@ -1542,7 +1542,7 @@ int GlowDrawGtk::line_dashed(GlowWind* wind, int x1, int y1, int x2, int y2,
return 1;
DrawWindGtk* w = (DrawWindGtk*)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
+ w->clip_rectangle[w->clip_cnt - 1].width
......@@ -1608,7 +1608,7 @@ int GlowDrawGtk::line_dashed(GlowWind* wind, int x1, int y1, int x2, int y2,
default:;
}
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type + highlight, idx));
if (!w->draw_buffer_only)
......@@ -1618,7 +1618,7 @@ int GlowDrawGtk::line_dashed(GlowWind* wind, int x1, int y1, int x2, int y2,
gdk_draw_line(
w->buffer, get_gc(this, gc_type + highlight, idx), x1, y1, x2, y2);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type + highlight, idx));
gdk_gc_set_line_attributes(get_gc(this, gc_type + highlight, idx), idx + 1,
......@@ -1633,7 +1633,7 @@ int GlowDrawGtk::line_erase(
return 1;
DrawWindGtk* w = (DrawWindGtk*)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
+ w->clip_rectangle[w->clip_cnt - 1].width
......@@ -1644,7 +1644,7 @@ int GlowDrawGtk::line_erase(
>= MIN(y1, y2)))
return 1;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, glow_eDrawType_LineErase, idx));
if (!w->draw_buffer_only)
......@@ -1654,7 +1654,7 @@ int GlowDrawGtk::line_erase(
gdk_draw_line(
w->buffer, get_gc(this, glow_eDrawType_LineErase, idx), x1, y1, x2, y2);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, glow_eDrawType_LineErase, idx));
return 1;
......@@ -1670,7 +1670,7 @@ int GlowDrawGtk::polyline(GlowWind* wind, glow_sPointX* points, int point_cnt,
if (gc_type == glow_eDrawType_LineGray && highlight)
gc_type = glow_eDrawType_Line;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type + highlight, idx));
int cnt;
......@@ -1683,7 +1683,7 @@ int GlowDrawGtk::polyline(GlowWind* wind, glow_sPointX* points, int point_cnt,
w->buffer, get_gc(this, gc_type + highlight, idx), gpoints, cnt);
free(gpoints);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type + highlight, idx));
return 1;
}
......@@ -1698,7 +1698,7 @@ int GlowDrawGtk::fill_polyline(GlowWind* wind, glow_sPointX* points,
if (gc_type == glow_eDrawType_LineGray && highlight)
gc_type = glow_eDrawType_Line;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type + highlight, 0));
GdkPoint* gpoints = points_to_gdk_points(points, point_cnt);
......@@ -1710,7 +1710,7 @@ int GlowDrawGtk::fill_polyline(GlowWind* wind, glow_sPointX* points,
w->buffer, get_gc(this, gc_type + highlight, 0), 1, gpoints, point_cnt);
free(gpoints);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type + highlight, 0));
return 1;
}
......@@ -1722,7 +1722,7 @@ int GlowDrawGtk::polyline_erase(
return 1;
DrawWindGtk* w = (DrawWindGtk*)wind->window;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, glow_eDrawType_LineErase, idx));
int cnt;
......@@ -1735,7 +1735,7 @@ int GlowDrawGtk::polyline_erase(
w->buffer, get_gc(this, glow_eDrawType_LineErase, idx), gpoints, cnt);
free(gpoints);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, glow_eDrawType_LineErase, idx));
return 1;
}
......@@ -1755,7 +1755,7 @@ int GlowDrawGtk::text(GlowWind* wind, int x, int y, char* text, int len,
if (font_idx > glow_eFont_Courier)
font_idx = glow_eFont_Helvetica;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type, idx));
int font_type = get_font_type(gc_type);
......@@ -1778,7 +1778,7 @@ int GlowDrawGtk::text(GlowWind* wind, int x, int y, char* text, int len,
if (w->double_buffer_on)
gdk_draw_text(w->buffer, font[font_idx][font_type][idx],
get_gc(this, gc_type, idx), x, y, text, len);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type, idx));
if (color != glow_eDrawType_Line) {
......@@ -1811,7 +1811,7 @@ int GlowDrawGtk::text_cursor(GlowWind* wind, int x, int y, char* text, int len,
else
width = 0;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type, idx));
if (!w->draw_buffer_only) {
......@@ -1822,7 +1822,7 @@ int GlowDrawGtk::text_cursor(GlowWind* wind, int x, int y, char* text, int len,
gdk_draw_line(w->buffer, get_gc(this, color, 1), x + width, y + descent,
x + width, y - height + descent);
}
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type, idx));
return 1;
......@@ -1854,7 +1854,7 @@ int GlowDrawGtk::text_erase(GlowWind* wind, int x, int y, char* text, int len,
if (font_idx != glow_eFont_Helvetica)
gdk_gc_set_font(get_gc(this, gc_type, idx), font[font_idx][font_type][idx]);
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type, idx));
if (!w->draw_buffer_only)
gdk_draw_text(w->window, font[font_idx][font_type][idx],
......@@ -1862,7 +1862,7 @@ int GlowDrawGtk::text_erase(GlowWind* wind, int x, int y, char* text, int len,
if (w->double_buffer_on)
gdk_draw_text(w->buffer, font[font_idx][font_type][idx],
get_gc(this, gc_type, idx), x, y, text, len);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type, idx));
if (font_idx != glow_eFont_Helvetica)
......@@ -1915,7 +1915,7 @@ int GlowDrawGtk::image(GlowWind* wind, int x, int y, int width, int height,
if (clip_mask)
set_image_clip_mask(clip_mask, x, y);
else if (w->clip_on)
else if (w->clip_cnt > 0)
set_clip(w, get_gc(this, glow_eDrawType_Line, 0));
if (!w->draw_buffer_only)
......@@ -1928,7 +1928,7 @@ int GlowDrawGtk::image(GlowWind* wind, int x, int y, int width, int height,
0);
if (clip_mask)
reset_image_clip_mask();
else if (w->clip_on)
else if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, glow_eDrawType_Line, 0));
return 1;
}
......@@ -1949,7 +1949,7 @@ int GlowDrawGtk::image_d(GlowWind* wind, double x, double y, int width,
if (clip_mask)
set_image_clip_mask(clip_mask, x, y);
else if (w->clip_on) {
else if (w->clip_cnt > 0) {
set_clip(w, get_gc(this, glow_eDrawType_Line, 0));
set_cairo_clip(w, cr);
}
......@@ -1968,7 +1968,7 @@ int GlowDrawGtk::image_d(GlowWind* wind, double x, double y, int width,
}
if (clip_mask)
reset_image_clip_mask();
else if (w->clip_on) {
else if (w->clip_cnt > 0) {
reset_clip(w, get_gc(this, glow_eDrawType_Line, 0));
reset_cairo_clip(w, cr);
}
......@@ -1983,13 +1983,13 @@ int GlowDrawGtk::fill_rect(
if (ctx->nodraw)
return 1;
if (ww->clip_on)
if (ww->clip_cnt > 0)
set_clip(ww, get_gc(this, gc_type, 0));
if (!ww->draw_buffer_only)
gdk_draw_rectangle(ww->window, get_gc(this, gc_type, 0), 1, x, y, w, h);
if (ww->double_buffer_on)
gdk_draw_rectangle(ww->buffer, get_gc(this, gc_type, 0), 1, x, y, w, h);
if (ww->clip_on)
if (ww->clip_cnt > 0)
reset_clip(ww, get_gc(this, gc_type, 0));
return 1;
}
......@@ -2439,7 +2439,6 @@ int GlowDrawGtk::set_clip_rectangle(
w->clip_rectangle[w->clip_cnt].width = x1 - x0;
w->clip_rectangle[w->clip_cnt].height = y1 - y0;
w->clip_cnt++;
w->clip_on = 1;
return 1;
}
......@@ -2451,8 +2450,6 @@ void GlowDrawGtk::reset_clip_rectangle(GlowWind* wind)
return;
}
w->clip_cnt--;
if (w->clip_cnt == 0)
w->clip_on = 0;
}
int GlowDrawGtk::clip_level(GlowWind* wind)
......@@ -2468,14 +2465,14 @@ int GlowDrawGtk::draw_point(
if (ctx->nodraw)
return 1;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type, 0));
gdk_draw_point(w->window, get_gc(this, gc_type, 0), x1, y1);
if (w->double_buffer_on)
gdk_draw_point(w->buffer, get_gc(this, gc_type, 0), x1, y1);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type, 0));
return 1;
}
......@@ -2487,7 +2484,7 @@ int GlowDrawGtk::draw_points(GlowWind* wind, glow_sPointX* points,
return 1;
DrawWindGtk* w = (DrawWindGtk*)wind->window;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type, 0));
if (idx > 0) {
......@@ -2499,7 +2496,7 @@ int GlowDrawGtk::draw_points(GlowWind* wind, glow_sPointX* points,
gdk_draw_rectangle(w->buffer, get_gc(this, gc_type, 0), 1,
points[i].x - idx / 2, points[i].y - idx / 2, idx, idx);
}
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type, 0));
return 1;
}
......@@ -2511,7 +2508,7 @@ int GlowDrawGtk::draw_points(GlowWind* wind, glow_sPointX* points,
gdk_draw_points(w->buffer, get_gc(this, gc_type, 0), gpoints, point_num);
free(gpoints);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type, 0));
return 1;
}
......@@ -2589,7 +2586,7 @@ void GlowDrawGtk::buffer_background(DrawWind* wind, GlowCtx* cctx)
return;
if (w->background_pixmap) {
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, glow_eDrawType_Line, 0));
if (!((GrowCtx*)ctx)->background_tiled)
......@@ -2605,7 +2602,7 @@ void GlowDrawGtk::buffer_background(DrawWind* wind, GlowCtx* cctx)
i * w->background_pixmap_width, j * w->background_pixmap_height,
w->background_pixmap_width, w->background_pixmap_height);
}
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, glow_eDrawType_Line, 0));
} else {
glow_eDrawType bg;
......@@ -2615,12 +2612,12 @@ void GlowDrawGtk::buffer_background(DrawWind* wind, GlowCtx* cctx)
bg = ((GrowCtx*)ctx)->background_color;
// glow_eDrawType bg = glow_eDrawType_CustomColor1;
// glow_eDrawType bg = glow_eDrawType_LineErase;
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, bg, 0));
gdk_draw_rectangle(w->buffer, get_gc(this, bg, 0), 1, subwindow_x,
subwindow_y, window_width, window_height);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, bg, 0));
}
}
......@@ -3509,7 +3506,7 @@ int GlowDrawGtk::gradient_fill_rect(GlowWind* wind, int x, int y, int w, int h,
continue;
}
if (ww->clip_on)
if (ww->clip_cnt > 0)
set_cairo_clip(ww, cr);
cairo_pattern_t* pat;
......@@ -3519,7 +3516,7 @@ int GlowDrawGtk::gradient_fill_rect(GlowWind* wind, int x, int y, int w, int h,
cairo_set_source(cr, pat);
cairo_fill(cr);
if (ww->clip_on)
if (ww->clip_cnt > 0)
reset_cairo_clip(ww, cr);
cairo_pattern_destroy(pat);
cairo_destroy(cr);
......@@ -3549,7 +3546,7 @@ int GlowDrawGtk::gradient_fill_rectrounded(GlowWind* wind, int x, int y, int w,
continue;
}
if (ww->clip_on)
if (ww->clip_cnt > 0)
set_cairo_clip(ww, cr);
cairo_pattern_t* pat;
......@@ -3576,7 +3573,7 @@ int GlowDrawGtk::gradient_fill_rectrounded(GlowWind* wind, int x, int y, int w,
cairo_set_source(cr, pat);
cairo_fill(cr);
if (ww->clip_on)
if (ww->clip_cnt > 0)
reset_cairo_clip(ww, cr);
cairo_pattern_destroy(pat);
cairo_destroy(cr);
......@@ -3611,7 +3608,7 @@ int GlowDrawGtk::gradient_fill_arc(GlowWind* wind, int x, int y, int w, int h,
continue;
}
if (ww->clip_on)
if (ww->clip_cnt > 0)
set_cairo_clip(ww, cr);
cairo_pattern_t* pat;
......@@ -3631,7 +3628,7 @@ int GlowDrawGtk::gradient_fill_arc(GlowWind* wind, int x, int y, int w, int h,
cairo_set_source(cr, pat);
cairo_fill(cr);
if (ww->clip_on)
if (ww->clip_cnt > 0)
reset_cairo_clip(ww, cr);
cairo_pattern_destroy(pat);
cairo_destroy(cr);
......@@ -3662,7 +3659,7 @@ int GlowDrawGtk::gradient_fill_polyline(GlowWind* wind, glow_sPointX* points,
continue;
}
if (ww->clip_on)
if (ww->clip_cnt > 0)
set_cairo_clip(ww, cr);
x0 = y0 = 1e37;
......@@ -3690,7 +3687,7 @@ int GlowDrawGtk::gradient_fill_polyline(GlowWind* wind, glow_sPointX* points,
cairo_set_source(cr, pat);
cairo_fill(cr);
if (ww->clip_on)
if (ww->clip_cnt > 0)
reset_cairo_clip(ww, cr);
cairo_pattern_destroy(pat);
cairo_destroy(cr);
......@@ -3748,7 +3745,7 @@ int GlowDrawGtk::text_pango(GlowWind* wind, int x, int y, char* text, int len,
int font_type = get_font_type(gc_type);
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type, idx));
if (color != glow_eDrawType_Line) {
......@@ -3828,7 +3825,7 @@ int GlowDrawGtk::text_pango(GlowWind* wind, int x, int y, char* text, int len,
gdk_pango_renderer_set_drawable(GDK_PANGO_RENDERER(pr), 0);
gdk_pango_renderer_set_gc(GDK_PANGO_RENDERER(pr), 0);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type, idx));
if (color != glow_eDrawType_Line) {
......@@ -3861,7 +3858,7 @@ int GlowDrawGtk::text_erase_pango(GlowWind* wind, int x, int y, char* text,
int font_type = get_font_type(gc_type);
if (w->clip_on)
if (w->clip_cnt > 0)
set_clip(w, get_gc(this, gc_type, idx));
PangoRenderer* pr = gdk_pango_renderer_get_default(screen);
......@@ -3914,7 +3911,7 @@ int GlowDrawGtk::text_erase_pango(GlowWind* wind, int x, int y, char* text,
gdk_pango_renderer_set_drawable(GDK_PANGO_RENDERER(pr), 0);
gdk_pango_renderer_set_gc(GDK_PANGO_RENDERER(pr), 0);
if (w->clip_on)
if (w->clip_cnt > 0)
reset_clip(w, get_gc(this, gc_type, idx));
return 1;
......
......@@ -60,7 +60,6 @@ public:
GdkPixmap* buffer;
int buffer_width;
int buffer_height;
int clip_on;
int clip_cnt;
GdkRectangle clip_rectangle[DRAW_CLIP_SIZE];
GdkPixmap* background_pixmap;
......
......@@ -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);
if (w->clip_on) {
if (w->clip_cnt > 0) {
set_clip(w, painter);
}
......@@ -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);
if (w->clip_on) {
if (w->clip_cnt > 0) {
set_clip(w, painter);
}
......@@ -985,7 +985,7 @@ int GlowDrawQt::arc_helper(GlowWind* wind, int painter_type, int size, int x,
DrawWindQt* w = (DrawWindQt*)wind->window;
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()
+ 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,
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);
}
......@@ -1074,7 +1074,7 @@ int GlowDrawQt::line_helper(GlowWind* wind, int painter_type, int size, int x1,
}
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()
+ 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,
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);
}
......@@ -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);
if (w->clip_on) {
if (w->clip_cnt > 0) {
set_clip(w, painter);
}
......@@ -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);
if (w->clip_on) {
if (w->clip_cnt > 0) {
set_clip(w, painter);
}
......@@ -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);
if (w->clip_on) {
if (w->clip_cnt > 0) {
set_clip(w, painter);
}
......@@ -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));
}
if (w->clip_on) {
if (w->clip_cnt > 0) {
set_clip(w, painter);
}
......@@ -1396,7 +1396,7 @@ int GlowDrawQt::image_helper(GlowWind* wind, int x, int y, int width,
if (clip_mask) {
set_image_clip_mask(painter, clip_mask, x, y);
} else if (w->clip_on) {
} else if (w->clip_cnt > 0) {
set_clip(w, painter);
}
......@@ -1841,7 +1841,6 @@ int GlowDrawQt::set_clip_rectangle(
w->clip_rectangle[w->clip_cnt].setWidth(x1 - x0);
w->clip_rectangle[w->clip_cnt].setHeight(y1 - y0);
w->clip_cnt++;
w->clip_on = 1;
return 1;
}
......@@ -1853,9 +1852,6 @@ void GlowDrawQt::reset_clip_rectangle(GlowWind* wind)
return;
}
w->clip_cnt--;
if (w->clip_cnt == 0) {
w->clip_on = 0;
}
}
int GlowDrawQt::clip_level(GlowWind* wind)
......@@ -1874,7 +1870,7 @@ int GlowDrawQt::draw_point(
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);
}
......@@ -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<QPainter> painter = get_painter(w->buffer, this, painter_type, 0);
if (w->clip_on) {
if (w->clip_cnt > 0) {
set_clip(w, painter);
}
......@@ -1967,7 +1963,7 @@ void GlowDrawQt::buffer_background(DrawWind* wind, GlowCtx* cctx)
unique_ptr<QPainter> painterBg
= get_painter(w->background_pixmap, this, glow_eDrawType_Line, 0);
if (w->clip_on) {
if (w->clip_cnt > 0) {
set_clip(w, painterBg);
}
......@@ -1994,7 +1990,7 @@ void GlowDrawQt::buffer_background(DrawWind* wind, GlowCtx* cctx)
unique_ptr<QPainter> painter = get_painter(w->buffer, this, bg, 0);
if (w->clip_on) {
if (w->clip_cnt > 0) {
set_clip(w, painter);
}
......@@ -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);
if (ww->clip_on) {
if (ww->clip_cnt > 0) {
set_clip(ww, painter);
}
......@@ -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);
if (ww->clip_on) {
if (ww->clip_cnt > 0) {
set_clip(ww, painter);
}
......@@ -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);
if (ww->clip_on) {
if (ww->clip_cnt > 0) {
set_clip(ww, painter);
}
......@@ -2870,7 +2866,7 @@ int GlowDrawQt::gradient_fill_polyline(GlowWind* wind, glow_sPointX* points,
QPainterPath path;
double x0, y0, x1, y1;
if (ww->clip_on) {
if (ww->clip_cnt > 0) {
set_clip(ww, painter);
}
......@@ -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);
if (w->clip_on) {
if (w->clip_cnt > 0) {
set_clip(w, painter);
}
......@@ -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);
if (w->clip_on) {
if (w->clip_cnt > 0) {
set_clip(w, painter);
}
......
......@@ -59,7 +59,7 @@ class GlowCustomColors;
class DrawWindQt : public DrawWind {
public:
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)
{
memset(clip_rectangle, 0, sizeof(clip_rectangle));
......@@ -67,7 +67,6 @@ public:
QWidget* window;
QImage* buffer;
int clip_on;
int clip_cnt;
QRect clip_rectangle[DRAW_CLIP_SIZE];
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