From 7b58efd28ec66725acf0e42d871859f1a046439a Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 18 Aug 2009 08:44:16 +0200 Subject: Speed up midpoint lines starting far outside the device bounds. Reviewed-By: Samuel --- src/gui/painting/qpaintengine_raster.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 8b83f02..547818c 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -5198,6 +5198,13 @@ static void drawLine_midpoint_i(int x1, int y1, int x2, int y2, ProcessSpans spa dy = -dy; } + int x_lower_limit = - 128; + if (x1 < x_lower_limit) { + int cy = dy * (x_lower_limit - x1) / dx + y1; + drawLine_midpoint_i(x_lower_limit, cy, x2, y2, span_func, data, style, devRect); + return; + } + if (style == LineDrawNormal) --x2; @@ -5335,6 +5342,13 @@ static void drawLine_midpoint_i(int x1, int y1, int x2, int y2, ProcessSpans spa dx = -dx; } + int y_lower_limit = - 128; + if (y1 < y_lower_limit) { + int cx = dx * (y_lower_limit - y1) / dy + x1; + drawLine_midpoint_i(cx, y_lower_limit, x2, y2, span_func, data, style, devRect); + return; + } + if (style == LineDrawNormal) --y2; -- cgit v0.12