diff options
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 8 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 7 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 2 | ||||
-rw-r--r-- | src/opengl/qglpixmapfilter.cpp | 21 |
4 files changed, 19 insertions, 19 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index e41d0b4..2ee92c3 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1769,14 +1769,6 @@ QOpenGL2PaintEngineState::~QOpenGL2PaintEngineState() { } -QPixmapFilter *QGL2PaintEngineEx::createPixmapFilter(int type) const -{ - const QGLContext *ctx = QGLContext::currentContext(); - if (ctx) - return ctx->d_func()->createPixmapFilter(type); - return 0; -} - QT_END_NAMESPACE #include "qpaintengineex_opengl2.moc" diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 34f4eb8..a44be90 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -59,6 +59,7 @@ #include <private/qglengineshadermanager_p.h> #include <private/qgl2pexvertexarray_p.h> #include <private/qglpaintdevice_p.h> +#include <private/qglpixmapfilter_p.h> enum EngineMode { ImageDrawingMode, @@ -140,7 +141,7 @@ public: const QGLContext* context(); - QPixmapFilter *createPixmapFilter(int type) const; + QPixmapFilter *pixmapFilter(int type, const QPixmapFilter *prototype); void setRenderTextActive(bool); @@ -264,6 +265,10 @@ public: bool inRenderText; float textureInvertedY; + + QScopedPointer<QPixmapFilter> convolutionFilter; + QScopedPointer<QPixmapFilter> colorizeFilter; + QScopedPointer<QPixmapFilter> blurFilter; }; QT_END_NAMESPACE diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 2b74e69..7269195 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -352,8 +352,6 @@ public: #endif static void setCurrentContext(QGLContext *context); - - QPixmapFilter *createPixmapFilter(int type) const; }; // ### make QGLContext a QObject in 5.0 and remove the proxy stuff diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 43f1990..b48c497 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -123,23 +123,28 @@ private: extern QGLWidget *qt_gl_share_widget(); -QPixmapFilter *QGLContextPrivate::createPixmapFilter(int type) const +QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *prototype) { + Q_D(QGL2PaintEngineEx); switch (type) { case QPixmapFilter::ColorizeFilter: - return new QGLPixmapColorizeFilter; + if (!d->colorizeFilter) + d->colorizeFilter.reset(new QGLPixmapColorizeFilter); + return d->colorizeFilter.data(); case QPixmapFilter::BlurFilter: - return new QGLPixmapBlurFilter; + if (!d->blurFilter) + d->blurFilter.reset(new QGLPixmapBlurFilter); + return d->blurFilter.data(); case QPixmapFilter::ConvolutionFilter: - return new QGLPixmapConvolutionFilter; + if (!d->convolutionFilter) + d->convolutionFilter.reset(new QGLPixmapConvolutionFilter); + return d->convolutionFilter.data(); - default: - return 0; - break; + default: break; } - return 0; + return QPaintEngineEx::pixmapFilter(type, prototype); } extern void qt_add_rect_to_array(const QRectF &r, q_vertexType *array); |