From 6bef50eaa9d81eb3ef071ae8f75ddfbe24283605 Mon Sep 17 00:00:00 2001 From: "g@localhost.localdomain" Date: Wed, 21 Feb 2007 21:13:10 +0100 Subject: [PATCH] Removed fast drawing as normal drawing is now considered fast enough --- pysize/main.py | 2 -- pysize/ui/gtk/pysize_widget_draw.py | 54 +++++++++++++++---------------------- 2 files changed, 21 insertions(+), 35 deletions(-) diff --git a/pysize/main.py b/pysize/main.py index 502ed61..1760b21 100644 --- a/pysize/main.py +++ b/pysize/main.py @@ -94,8 +94,6 @@ def main(): parser.add_option('--min-size', type='str', dest='min_size', default='auto', metavar='SIZE', help='minimum size to consider drawing [auto]') - parser.add_option('--fast-drawing', action='store_true', dest='fast', - default=False, help='faster but simpler drawing with GTK') parser.add_option('--profile', action='store_true', dest='profile', default=False, help=optparse.SUPPRESS_HELP) options, args = parser.parse_args() diff --git a/pysize/ui/gtk/pysize_widget_draw.py b/pysize/ui/gtk/pysize_widget_draw.py index 683b14b..1b914d7 100644 --- a/pysize/ui/gtk/pysize_widget_draw.py +++ b/pysize/ui/gtk/pysize_widget_draw.py @@ -34,7 +34,6 @@ class PysizeWidget_Draw(object): self.connect('expose-event', type(self)._expose_event) self.modify_font(pango.FontDescription('Monospace 12')) self.max_text_height = self.measure_font_height() - self.fast = options.fast def measure_font_height(self): w, h = self.create_pango_layout('a').get_pixel_size() @@ -104,6 +103,7 @@ class PysizeWidget_Draw(object): ((0.5, 0.4, 1.0), (0.2, 0.4, 1.0))) context.set_source_rgb(0, 0, 0) first_time = not node.rectangle + context.new_path() if first_time: if x0 == 0.0: x0 += LINE_WIDTH/2.0 @@ -116,41 +116,29 @@ class PysizeWidget_Draw(object): y0 += LINE_WIDTH/4.0 y1 -= LINE_WIDTH/4.0 node.rectangle = x0, x1, y0, y1 - if self.fast: - x, y, w, h = node.rectangle[0], node.rectangle[2], \ - node.rectangle[1] - node.rectangle[0], \ - node.rectangle[3] - node.rectangle[2] - context.rectangle(x, y, w, h) - context.stroke_preserve() - - context.set_source_rgb(*colors[0]) - context.fill() + context.arc(x0 + RADIUS, y0 + RADIUS, RADIUS, + - math.pi, - math.pi / 2.0) + context.rel_line_to(x1 - x0 - 2*RADIUS, 0) + context.arc(x1 - RADIUS, y0 + RADIUS, RADIUS, + - math.pi / 2.0, 0) + context.rel_line_to(0, y1 - y0 - 2*RADIUS) + context.arc(x1 - RADIUS, y1 - RADIUS, RADIUS, + 0, math.pi / 2.0) + context.rel_line_to(- x1 + x0 + 2*RADIUS, 0) + context.arc(x0 + RADIUS, y1 - RADIUS, RADIUS, + math.pi / 2.0, math.pi) + context.close_path() + node.cairo_box_path = context.copy_path() else: - context.new_path() - if first_time: - context.arc(x0 + RADIUS, y0 + RADIUS, RADIUS, - - math.pi, - math.pi / 2.0) - context.rel_line_to(x1 - x0 - 2*RADIUS, 0) - context.arc(x1 - RADIUS, y0 + RADIUS, RADIUS, - - math.pi / 2.0, 0) - context.rel_line_to(0, y1 - y0 - 2*RADIUS) - context.arc(x1 - RADIUS, y1 - RADIUS, RADIUS, - 0, math.pi / 2.0) - context.rel_line_to(- x1 + x0 + 2*RADIUS, 0) - context.arc(x0 + RADIUS, y1 - RADIUS, RADIUS, - math.pi / 2.0, math.pi) - context.close_path() - node.cairo_box_path = context.copy_path() - else: - context.append_path(node.cairo_box_path) - context.stroke_preserve() + context.append_path(node.cairo_box_path) + context.stroke_preserve() - gradient = cairo.LinearGradient(0, y0, 0, y1) + gradient = cairo.LinearGradient(0, y0, 0, y1) - gradient.add_color_stop_rgb(0.0, *colors[0]) - gradient.add_color_stop_rgb(1.0, *colors[1]) - context.set_source(gradient) - context.fill() + gradient.add_color_stop_rgb(0.0, *colors[0]) + gradient.add_color_stop_rgb(1.0, *colors[1]) + context.set_source(gradient) + context.fill() if is_selected: context.set_source_rgb(1, 1, 1) -- 2.11.4.GIT