diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2012-01-23 10:42:21 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-27 17:49:27 (GMT) |
commit | d3991bfeb1c2b14e85f8080323065be0babd3e11 (patch) | |
tree | 37eb9f7b89c5412f24733a2c551cd1698459b491 /src/gui/painting | |
parent | 5debd05d2fd5f898c793b464aa1cfb5020275543 (diff) | |
download | Qt-d3991bfeb1c2b14e85f8080323065be0babd3e11.zip Qt-d3991bfeb1c2b14e85f8080323065be0babd3e11.tar.gz Qt-d3991bfeb1c2b14e85f8080323065be0babd3e11.tar.bz2 |
blitter: Group code by functionality in header and cpp file
* Group code responsible for tracking the render pipeline state
to check if we can easily accelerate it
* Code that will call into the QBlittable
* Code that will lock the QBlittable before calling into raster
Change-Id: I759a1864967d92a4cdd48c29941cb20d36afd84f
Based-On: I862e242d59805de5094ed363b486afcdbc23ff78
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qpaintengine_blitter.cpp | 217 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_blitter_p.h | 21 |
2 files changed, 118 insertions, 120 deletions
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 7b6ee50..ba2ac40 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -357,6 +357,58 @@ QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePixmapData *p) QBlitterPaintEngine::~QBlitterPaintEngine() {} +// State tracking +void QBlitterPaintEngine::penChanged() +{ + Q_D(QBlitterPaintEngine); + d->lock(); + d->raster->penChanged(); + + d->updatePenState(state()); +} + +void QBlitterPaintEngine::brushChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->brushChanged(); + + d->updateBrushState(state()); +} + +void QBlitterPaintEngine::brushOriginChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->brushOriginChanged(); +} + +void QBlitterPaintEngine::opacityChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->opacityChanged(); + d->updateOpacityState(state()); +} + +void QBlitterPaintEngine::compositionModeChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->compositionModeChanged(); + d->updateCompositionModeState(state()); +} + +void QBlitterPaintEngine::renderHintsChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->renderHintsChanged(); + d->updateRenderHintsState(state()); +} + +void QBlitterPaintEngine::transformChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->transformChanged(); + d->updateTransformState(state()); +} + QPainterState *QBlitterPaintEngine::createState(QPainterState *orig) const { Q_D(const QBlitterPaintEngine); @@ -375,7 +427,6 @@ bool QBlitterPaintEngine::begin(QPaintDevice *pdev) return ok; } - bool QBlitterPaintEngine::end() { Q_D(QBlitterPaintEngine); @@ -387,7 +438,23 @@ bool QBlitterPaintEngine::end() return d->raster->end(); } +void QBlitterPaintEngine::setState(QPainterState *s) +{ + Q_D(QBlitterPaintEngine); + d->lock(); + QPaintEngineEx::setState(s); + d->raster->setState(s); + + d->updateCompleteState(s); +} +inline QRasterPaintEngine *QBlitterPaintEngine::raster() const +{ + Q_D(const QBlitterPaintEngine); + return d->raster.data(); +} + +// Accelerated paths void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) { Q_D(QBlitterPaintEngine); @@ -489,96 +556,6 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) } -void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) -{ - Q_D(QBlitterPaintEngine); - d->lock(); - d->pmData->markRasterOverlay(path); - d->raster->stroke(path, pen); -} - -void QBlitterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) -{ - Q_D(QBlitterPaintEngine); - d->lock(); - d->raster->clip(path, op); - d->updateClipState(state()); -} - -void QBlitterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op){ - Q_D(QBlitterPaintEngine); - d->lock(); - d->raster->clip(rect, op); - d->updateClipState(state()); -} - -void QBlitterPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) -{ - Q_D(QBlitterPaintEngine); - d->lock(); - d->raster->clip(region, op); - d->updateClipState(state()); -} - -void QBlitterPaintEngine::clipEnabledChanged() -{ - Q_D(QBlitterPaintEngine); - d->lock(); - d->raster->clipEnabledChanged(); - d->updateClipState(state()); -} - -void QBlitterPaintEngine::penChanged() -{ - Q_D(QBlitterPaintEngine); - d->lock(); - d->raster->penChanged(); - - d->updatePenState(state()); -} - -void QBlitterPaintEngine::brushChanged() -{ - Q_D(QBlitterPaintEngine); - d->raster->brushChanged(); - - d->updateBrushState(state()); -} - -void QBlitterPaintEngine::brushOriginChanged() -{ - Q_D(QBlitterPaintEngine); - d->raster->brushOriginChanged(); -} - -void QBlitterPaintEngine::opacityChanged() -{ - Q_D(QBlitterPaintEngine); - d->raster->opacityChanged(); - d->updateOpacityState(state()); -} - -void QBlitterPaintEngine::compositionModeChanged() -{ - Q_D(QBlitterPaintEngine); - d->raster->compositionModeChanged(); - d->updateCompositionModeState(state()); -} - -void QBlitterPaintEngine::renderHintsChanged() -{ - Q_D(QBlitterPaintEngine); - d->raster->renderHintsChanged(); - d->updateRenderHintsState(state()); -} - -void QBlitterPaintEngine::transformChanged() -{ - Q_D(QBlitterPaintEngine); - d->raster->transformChanged(); - d->updateTransformState(state()); -} - void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount) { Q_D(QBlitterPaintEngine); @@ -632,6 +609,46 @@ void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const Q } } +// Overriden methods to lock the graphics memory +void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) +{ + Q_D(QBlitterPaintEngine); + d->lock(); + d->pmData->markRasterOverlay(path); + d->raster->stroke(path, pen); +} + +void QBlitterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) +{ + Q_D(QBlitterPaintEngine); + d->lock(); + d->raster->clip(path, op); + d->updateClipState(state()); +} + +void QBlitterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op){ + Q_D(QBlitterPaintEngine); + d->lock(); + d->raster->clip(rect, op); + d->updateClipState(state()); +} + +void QBlitterPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) +{ + Q_D(QBlitterPaintEngine); + d->lock(); + d->raster->clip(region, op); + d->updateClipState(state()); +} + +void QBlitterPaintEngine::clipEnabledChanged() +{ + Q_D(QBlitterPaintEngine); + d->lock(); + d->raster->clipEnabledChanged(); + d->updateClipState(state()); +} + void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags) { @@ -641,7 +658,6 @@ void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRe d->raster->drawImage(r, pm, sr, flags); } - void QBlitterPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &ti) { Q_D(QBlitterPaintEngine); @@ -661,7 +677,6 @@ void QBlitterPaintEngine::drawStaticTextItem(QStaticTextItem *sti) } - void QBlitterPaintEngine::drawEllipse(const QRectF &r) { Q_D(QBlitterPaintEngine); @@ -670,22 +685,6 @@ void QBlitterPaintEngine::drawEllipse(const QRectF &r) d->raster->drawEllipse(r); } -void QBlitterPaintEngine::setState(QPainterState *s) -{ - Q_D(QBlitterPaintEngine); - d->lock(); - QPaintEngineEx::setState(s); - d->raster->setState(s); - - d->updateCompleteState(s); -} - -inline QRasterPaintEngine *QBlitterPaintEngine::raster() const -{ - Q_D(const QBlitterPaintEngine); - return d->raster.data(); -} - QT_END_NAMESPACE #endif //QT_NO_BLITTABLE diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index f5c90da..2cdb61a 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -66,12 +66,14 @@ public: virtual bool begin(QPaintDevice *pdev); virtual bool end(); + // Call down into QBlittable virtual void fill(const QVectorPath &path, const QBrush &brush); virtual void stroke(const QVectorPath &path, const QPen &pen); - - virtual void clip(const QVectorPath &path, Qt::ClipOperation op); - virtual void clip(const QRect &rect, Qt::ClipOperation op); - virtual void clip(const QRegion ®ion, Qt::ClipOperation op); + virtual void fillRect(const QRectF &rect, const QBrush &brush); + virtual void fillRect(const QRectF &rect, const QColor &color); + virtual void drawRects(const QRect *rects, int rectCount); + virtual void drawRects(const QRectF *rects, int rectCount); + virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); virtual void clipEnabledChanged(); virtual void penChanged(); @@ -82,13 +84,10 @@ public: virtual void renderHintsChanged(); virtual void transformChanged(); - virtual void fillRect(const QRectF &rect, const QBrush &brush); - virtual void fillRect(const QRectF &rect, const QColor &color); - - virtual void drawRects(const QRect *rects, int rectCount); - virtual void drawRects(const QRectF *rects, int rectCount); - - virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); + // Override to lock the QBlittable before using raster + virtual void clip(const QVectorPath &path, Qt::ClipOperation op); + virtual void clip(const QRect &rect, Qt::ClipOperation op); + virtual void clip(const QRegion ®ion, Qt::ClipOperation op); virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags); |