From 18728d2ddd725199017a36cb290c30d6e8c9e647 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 22 Jul 2009 11:25:47 -0700 Subject: Use dfbsurface::FillRectangles in solidFill Minor optimization Reviewed-by: Donald --- src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index e12cbc40c8..ae2e38ba3b 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 ®ion) d_ptr->dfbSurface->SetColor(d_ptr->dfbSurface, color.red(), color.green(), color.blue(), color.alpha()); - const QVector rects = region.rects(); - for (int i=0; idfbSurface->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 rects = region.rects(); + QVarLengthArray rectArray(n); + for (int i=0; idfbSurface->FillRectangles(d_ptr->dfbSurface, rectArray.constData(), n); } } -- cgit v1.2.3