summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-07-22 18:25:47 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-07-22 18:25:47 (GMT)
commit18728d2ddd725199017a36cb290c30d6e8c9e647 (patch)
tree72d9b4498798572c1d8b878460a059d79971b161 /src/plugins/gfxdrivers
parentd79f61b51868712590f423483f4d3b39cb60aa64 (diff)
downloadQt-18728d2ddd725199017a36cb290c30d6e8c9e647.zip
Qt-18728d2ddd725199017a36cb290c30d6e8c9e647.tar.gz
Qt-18728d2ddd725199017a36cb290c30d6e8c9e647.tar.bz2
Use dfbsurface::FillRectangles in solidFill
Minor optimization Reviewed-by: Donald <qt-info@nokia.com>
Diffstat (limited to 'src/plugins/gfxdrivers')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index e12cbc4..ae2e38b 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -1254,11 +1254,21 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion &region)
d_ptr->dfbSurface->SetColor(d_ptr->dfbSurface,
color.red(), color.green(), color.blue(),
color.alpha());
- const QVector<QRect> rects = region.rects();
- for (int i=0; i<rects.size(); ++i) {
- const QRect &r = rects.at(i);
- d_ptr->dfbSurface->FillRectangle(d_ptr->dfbSurface,
- r.x(), r.y(), r.width(), r.height());
+ const int n = region.numRects();
+ if (n > 1) {
+ const QRect r = region.boundingRect();
+ d_ptr->dfbSurface->FillRectangle(d_ptr->dfbSurface, r.x(), r.y(), r.width(), r.height());
+ } else {
+ const QVector<QRect> rects = region.rects();
+ QVarLengthArray<DFBRectangle, 32> rectArray(n);
+ for (int i=0; i<n; ++i) {
+ const QRect &r = rects.at(i);
+ rectArray[i].x = r.x();
+ rectArray[i].y = r.y();
+ rectArray[i].w = r.width();
+ rectArray[i].h = r.height();
+ }
+ d_ptr->dfbSurface->FillRectangles(d_ptr->dfbSurface, rectArray.constData(), n);
}
}