diff options
author | Marius Storm-Olsen <marius.storm-olsen@nokia.com> | 2009-11-06 11:04:15 (GMT) |
---|---|---|
committer | Marius Storm-Olsen <marius.storm-olsen@nokia.com> | 2009-11-09 11:10:52 (GMT) |
commit | 4ad31892d735e6f1a7afffbf0bf8028663855adb (patch) | |
tree | 39d1cddf14853c00c4f2b1f55e62f3835d2925a4 /src/gui | |
parent | 195f4b98fbf31a92e27be4533fc2ccae99372b82 (diff) | |
download | Qt-4ad31892d735e6f1a7afffbf0bf8028663855adb.zip Qt-4ad31892d735e6f1a7afffbf0bf8028663855adb.tar.gz Qt-4ad31892d735e6f1a7afffbf0bf8028663855adb.tar.bz2 |
API review: Rename numRects() -> rectCount()
QRegion::numRects() is marked obsolete.
Removed all usage of the old function inside Qt and test-cases.
Reviewed-by: Andreas Aardal Hanssen
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/embedded/qscreen_qws.cpp | 4 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsview.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qpaintengineex.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qregion.cpp | 20 | ||||
-rw-r--r-- | src/gui/painting/qregion.h | 3 | ||||
-rw-r--r-- | src/gui/painting/qtransform.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_raster.cpp | 6 |
9 files changed, 30 insertions, 15 deletions
diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp index 0dbfd05..ae5570f 100644 --- a/src/gui/embedded/qscreen_qws.cpp +++ b/src/gui/embedded/qscreen_qws.cpp @@ -600,7 +600,7 @@ static void blit_template(QScreen *screen, const QImage &image, const int screenStride = screen->linestep(); const int imageStride = image.bytesPerLine(); - if (region.numRects() == 1) { + if (region.rectCount() == 1) { const QRect r = region.boundingRect(); const SRC *src = reinterpret_cast<const SRC*>(image.scanLine(r.y())) + r.x(); @@ -2463,7 +2463,7 @@ void QScreen::exposeRegion(QRegion r, int windowIndex) delete blendBuffer; } - if (r.numRects() == 1) { + if (r.rectCount() == 1) { setDirty(r.boundingRect()); } else { const QVector<QRect> rects = r.rects(); diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index dc036f8..e28ab61 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4149,7 +4149,7 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion & QRect br = pixmapExposed.boundingRect(); // Don't use subpixmap if we get a full update. - if (pixmapExposed.isEmpty() || (pixmapExposed.numRects() == 1 && br.contains(pix->rect()))) { + if (pixmapExposed.isEmpty() || (pixmapExposed.rectCount() == 1 && br.contains(pix->rect()))) { pix->fill(Qt::transparent); pixmapPainter.begin(pix); } else { diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index c88f678..a880402 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -978,7 +978,7 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg // Step 2) If the expose region is a simple rect and the view is only // translated or scaled, search for items using // QGraphicsScene::items(QRectF). - bool simpleRectLookup = exposedRegion.numRects() == 1 && matrix.type() <= QTransform::TxScale; + bool simpleRectLookup = exposedRegion.rectCount() == 1 && matrix.type() <= QTransform::TxScale; if (simpleRectLookup) { return scene->items(exposedRegionSceneBounds, Qt::IntersectsItemBoundingRect, diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 8d0b961..3f33319 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1362,7 +1362,7 @@ void QRasterPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) Q_D(QRasterPaintEngine); - if (region.numRects() == 1) { + if (region.rectCount() == 1) { clip(region.boundingRect(), op); return; } @@ -4536,7 +4536,7 @@ void QClipData::setClipRect(const QRect &rect) */ void QClipData::setClipRegion(const QRegion ®ion) { - if (region.numRects() == 1) { + if (region.rectCount() == 1) { setClipRect(region.rects().at(0)); return; } diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 1fb8aab..7d1c109 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -602,7 +602,7 @@ void QPaintEngineEx::clip(const QRect &r, Qt::ClipOperation op) void QPaintEngineEx::clip(const QRegion ®ion, Qt::ClipOperation op) { - if (region.numRects() == 1) + if (region.rectCount() == 1) clip(region.boundingRect(), op); QVector<QRect> rects = region.rects(); diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index b48b024..9d1d965 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -690,7 +690,7 @@ bool QRegion::intersects(const QRegion ®ion) const if (!rect_intersects(boundingRect(), region.boundingRect())) return false; - if (numRects() == 1 && region.numRects() == 1) + if (rectCount() == 1 && region.rectCount() == 1) return true; const QVector<QRect> myRects = rects(); @@ -717,7 +717,7 @@ bool QRegion::intersects(const QRect &rect) const const QRect r = rect.normalized(); if (!rect_intersects(boundingRect(), r)) return false; - if (numRects() == 1) + if (rectCount() == 1) return true; const QVector<QRect> myRects = rects(); @@ -739,6 +739,7 @@ QRegion QRegion::intersect(const QRect &r) const #endif /*! + \obsolete \fn int QRegion::numRects() const \since 4.4 @@ -746,6 +747,13 @@ QRegion QRegion::intersect(const QRect &r) const */ /*! + \fn int QRegion::rectCount() const + \since 4.6 + + Returns the number of rectangles that will be returned in rects(). +*/ + +/*! \fn bool QRegion::isEmpty() const Returns true if the region is empty; otherwise returns false. An @@ -1027,7 +1035,7 @@ void addSegmentsToPath(Segment *segment, QPainterPath &path) Q_AUTOTEST_EXPORT QPainterPath qt_regionToPath(const QRegion ®ion) { QPainterPath result; - if (region.numRects() == 1) { + if (region.rectCount() == 1) { result.addRect(region.boundingRect()); return result; } @@ -4317,6 +4325,12 @@ int QRegion::numRects() const return (d->qt_rgn ? d->qt_rgn->numRects : 0); } +int QRegion::rectCount() const +{ + return (d->qt_rgn ? d->qt_rgn->numRects : 0); +} + + bool QRegion::operator==(const QRegion &r) const { if (!d->qt_rgn) diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index 7e459ed..2a1be86 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -116,7 +116,8 @@ public: QRect boundingRect() const; QVector<QRect> rects() const; void setRects(const QRect *rect, int num); - int numRects() const; + QT_DEPRECATED int numRects() const; + int rectCount() const; const QRegion operator|(const QRegion &r) const; const QRegion operator+(const QRegion &r) const; diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 1bd5842..45db80a 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -1421,7 +1421,7 @@ QRegion QTransform::map(const QRegion &r) const return copy; } - if (t == TxScale && r.numRects() == 1) + if (t == TxScale && r.rectCount() == 1) return QRegion(mapRect(r.boundingRect())); QPainterPath p = map(qt_regionToPath(r)); diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index d412040..5060f95 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -140,7 +140,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi // Not ready for painting yet, bail out. This can happen in // QWidget::create_sys() - if (!d->image || rgn.numRects() == 0) + if (!d->image || rgn.rectCount() == 0) return; #ifdef Q_WS_WIN @@ -203,7 +203,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi wrgn.translate(-wOffset); QRect wbr = wrgn.boundingRect(); - if (wrgn.numRects() != 1) { + if (wrgn.rectCount() != 1) { int num; XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num); XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded); @@ -242,7 +242,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi } } - if (wrgn.numRects() != 1) + if (wrgn.rectCount() != 1) XSetClipMask(X11->display, d_ptr->gc, XNone); #endif // FALCON |