From fee1423eba48746d46e13c02374249d1760219d7 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 15 Apr 2009 08:32:42 +0200 Subject: Some ifdefs for debugging clipping performance --- src/gui/painting/qpaintengine_raster.cpp | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index addd63d..e981f8d 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1140,6 +1140,33 @@ void QRasterPaintEnginePrivate::updateMatrixData(QSpanData *spanData, const QBru } } +// #define QT_CLIPPING_RATIOS + +#ifdef QT_CLIPPING_RATIOS +int rectClips; +int regionClips; +int totalClips; + +static void checkClipRatios(QRasterPaintEnginePrivate *d) +{ + if (d->clip()->hasRectClip) + rectClips++; + if (d->clip()->hasRegionClip) + regionClips++; + totalClips++; + + if ((totalClips % 5000) == 0) { + printf("Clipping ratio: rectangular=%f%%, region=%f%%, complex=%f%%\n", + rectClips * 100.0 / (qreal) totalClips, + regionClips * 100.0 / (qreal) totalClips, + (totalClips - rectClips - regionClips) * 100.0 / (qreal) totalClips); + totalClips = 0; + rectClips = 0; + regionClips = 0; + } + +} +#endif /*! \internal @@ -1241,6 +1268,10 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) d->solid_color_filler.clip = d->clip(); d->solid_color_filler.adjustSpanMethods(); + +#ifdef QT_CLIPPING_RATIOS + checkClipRatios(d); +#endif } @@ -1315,6 +1346,11 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) d->solid_color_filler.clip = d->clip(); d->solid_color_filler.adjustSpanMethods(); + + +#ifdef QT_CLIPPING_RATIOS + checkClipRatios(d); +#endif } /*! -- cgit v0.12