summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglpixmapfilter.cpp
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-09-28 03:56:14 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-09-28 03:56:14 (GMT)
commitc4bdc8d6d7e09ddfd5e59f138c0632f636c09e26 (patch)
treef93b4e18bf25721a25fbf382b8ccfc4a5e50cf91 /src/opengl/qglpixmapfilter.cpp
parent96c3752a1178680cad7e4c87c2c077e34c377f18 (diff)
downloadQt-c4bdc8d6d7e09ddfd5e59f138c0632f636c09e26.zip
Qt-c4bdc8d6d7e09ddfd5e59f138c0632f636c09e26.tar.gz
Qt-c4bdc8d6d7e09ddfd5e59f138c0632f636c09e26.tar.bz2
ifdef out convolution filter for OpenGL/ES 2.0
Convolution filter is not compatible with OpenGL/ES 2.0 in its current form, and we probably don't need it now that we have a special-purpose blur filter. Reviewed-by: trustme
Diffstat (limited to 'src/opengl/qglpixmapfilter.cpp')
-rw-r--r--src/opengl/qglpixmapfilter.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index bb0306c..bb3cb5d 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -79,6 +79,8 @@ protected:
bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &pixmap, const QRectF &srcRect) const;
};
+#ifndef QT_OPENGL_ES_2
+
class QGLPixmapConvolutionFilter: public QGLPixmapFilter<QPixmapConvolutionFilter>
{
public:
@@ -99,6 +101,8 @@ private:
mutable int m_kernelHeight;
};
+#endif
+
class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapBlurFilter>
{
public:
@@ -143,22 +147,25 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr
return d->blurFilter.data();
}
+#ifndef QT_OPENGL_ES_2
case QPixmapFilter::ConvolutionFilter:
if (!d->convolutionFilter)
d->convolutionFilter.reset(new QGLPixmapConvolutionFilter);
return d->convolutionFilter.data();
+#endif
default: break;
}
return QPaintEngineEx::pixmapFilter(type, prototype);
}
+#ifndef QT_OPENGL_ES_2 // XXX: needs to be ported
+
extern void qt_add_rect_to_array(const QRectF &r, q_vertexType *array);
extern void qt_add_texcoords_to_array(qreal x1, qreal y1, qreal x2, qreal y2, q_vertexType *array);
static void qgl_drawTexture(const QRectF &rect, int tx_width, int tx_height, const QRectF & src)
{
-#ifndef QT_OPENGL_ES_2 // XXX: needs to be ported
#ifndef QT_OPENGL_ES
glPushAttrib(GL_CURRENT_BIT);
#endif
@@ -187,9 +194,10 @@ static void qgl_drawTexture(const QRectF &rect, int tx_width, int tx_height, con
#ifndef QT_OPENGL_ES
glPopAttrib();
#endif
-#endif
}
+#endif // !QT_OPENGL_ES_2
+
static const char *qt_gl_colorize_filter =
"uniform lowp vec4 colorizeColor;"
"uniform lowp float colorizeStrength;"
@@ -223,6 +231,8 @@ void QGLPixmapColorizeFilter::setUniforms(QGLShaderProgram *program)
program->setUniformValue("colorizeStrength", float(strength()));
}
+#ifndef QT_OPENGL_ES_2
+
// generates convolution filter code for arbitrary sized kernel
QByteArray QGLPixmapConvolutionFilter::generateConvolutionShader() const {
QByteArray code;
@@ -315,6 +325,8 @@ bool QGLPixmapConvolutionFilter::processGL(QPainter *, const QPointF &pos, const
return true;
}
+#endif // !QT_OPENGL_ES_2
+
static const char *qt_gl_blur_filter_fast =
"const int samples = 9;"
"uniform mediump vec2 delta;"