summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-04-24 07:29:06 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-04-24 08:47:40 (GMT)
commit9f1f048cb8c29f8c169afa0d5595acfa4eac606b (patch)
tree945d20ee29e3cd1894de5a3cefbbb2136abeadb7
parent861651c67a5f627f615ac1542f945e3c11593406 (diff)
downloadQt-9f1f048cb8c29f8c169afa0d5595acfa4eac606b.zip
Qt-9f1f048cb8c29f8c169afa0d5595acfa4eac606b.tar.gz
Qt-9f1f048cb8c29f8c169afa0d5595acfa4eac606b.tar.bz2
Optimize intersected rect clipping in raster engine..
If we have span based clipping (complex) and we manage to intersect down to a plain rectangle, we switch back to rectangle mode which speeds up filling significantly... Reviewed-by: Samuel
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index c44763d..bf84aa7 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -4401,20 +4401,39 @@ void QClipData::fixup()
ymax = m_spans[count-1].y + 1;
xmin = INT_MAX;
xmax = 0;
+
+ bool isRect = true;
+ int left = m_spans[0].x;
+ int right = m_spans[0].x + m_spans[0].len;
+
for (int i = 0; i < count; ++i) {
-// qDebug() << " " << spans[i].x << spans[i].y << spans[i].len << spans[i].coverage;
if (m_spans[i].y != y) {
+ if (m_spans[i].y != y + 1 && y != -1) {
+ isRect = false;
+ }
y = m_spans[i].y;
m_clipLines[y].spans = m_spans+i;
m_clipLines[y].count = 0;
// qDebug() << " new line: y=" << y;
}
++m_clipLines[y].count;
+ int sl = (int) m_spans[i].x;
+ int sr = sl + m_spans[i].len;
+
xmin = qMin(xmin, (int)m_spans[i].x);
xmax = qMax(xmax, (int)m_spans[i].x + m_spans[i].len);
+
+ if (sl != left || sr != right)
+ isRect = false;
}
++xmax;
-// qDebug("xmin=%d,xmax=%d,ymin=%d,ymax=%d", xmin, xmax, ymin, ymax);
+// qDebug("xmin=%d,xmax=%d,ymin=%d,ymax=%d %s", xmin, xmax, ymin, ymax, isRect ? "rectangular" : "");
+
+ if (isRect) {
+ hasRectClip = true;
+ clipRect.setRect(xmin, ymin, xmax - xmin, ymax - ymin);
+ }
+
}
/*