diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-08-18 06:44:16 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-08-18 08:47:35 (GMT) |
commit | 7b58efd28ec66725acf0e42d871859f1a046439a (patch) | |
tree | 7aea050f6aaca3ff9f4e89100565e45270c1ea2e | |
parent | b120ff4f1a479c35b3e5bbcbc3c72cc18ee4879c (diff) | |
download | Qt-7b58efd28ec66725acf0e42d871859f1a046439a.zip Qt-7b58efd28ec66725acf0e42d871859f1a046439a.tar.gz Qt-7b58efd28ec66725acf0e42d871859f1a046439a.tar.bz2 |
Speed up midpoint lines starting far outside the device bounds.
Reviewed-By: Samuel
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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; |