diff options
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 15 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h | 1 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index a1009ac..15a46d7 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -56,6 +56,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect , dfbWindow(0) #endif , engine(0) + , engineHeight(-1) , flipFlags(flip) , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) { @@ -77,6 +78,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect , dfbWindow(0) #endif , engine(0) + , engineHeight(-1) , flipFlags(flip) , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) { @@ -295,11 +297,8 @@ bool QDirectFBWindowSurface::move(const QPoint &moveBy) QPaintEngine *QDirectFBWindowSurface::paintEngine() const { - if (!engine) { - QDirectFBWindowSurface *that = const_cast<QDirectFBWindowSurface*>(this); - that->engine = new QDirectFBPaintEngine(that); - return that->engine; - } + Q_ASSERT(engine); + Q_ASSERT(height() <= engineHeight); return engine; } @@ -427,6 +426,12 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion ®ion, void QDirectFBWindowSurface::beginPaint(const QRegion &) { + const int h = height(); + if (h > engineHeight) { + engineHeight = h; + delete engine; + engine = new QDirectFBPaintEngine(this); + } } void QDirectFBWindowSurface::endPaint(const QRegion &) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index c46d93b..cd88aca 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -93,6 +93,7 @@ private: IDirectFBWindow *dfbWindow; #endif QDirectFBPaintEngine *engine; + int engineHeight; enum Mode { Primary, |