diff options
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qglpixmapfilter.cpp | 46 | ||||
-rw-r--r-- | src/opengl/qgraphicsshadereffect.cpp | 10 | ||||
-rw-r--r-- | src/opengl/qgraphicsshadereffect_p.h | 2 | ||||
-rw-r--r-- | src/opengl/qpixmapdata_gl.cpp | 2 |
6 files changed, 32 insertions, 32 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 8228c7e..8c5bf0e 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -2107,7 +2107,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged() q->state()->rectangleClip = use_system_clip ? systemClip.boundingRect() : QRect(0, 0, width, height); updateClipScissorTest(); - if (systemClip.numRects() == 1) { + if (systemClip.rectCount() == 1) { if (systemClip.boundingRect() == QRect(0, 0, width, height)) use_system_clip = false; #ifndef QT_GL_NO_SCISSOR_TEST diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index ad177dc..8063fc8 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4078,7 +4078,7 @@ QImage QGLWidget::grabFrameBuffer(bool withAlpha) glReadPixels(0, 0, w, h, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, res.bits()); const QVector<QColor> pal = QColormap::instance().colormap(); if (pal.size()) { - res.setNumColors(pal.size()); + res.setColorCount(pal.size()); for (int i = 0; i < pal.size(); i++) res.setColor(i, pal.at(i).rgb()); } diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 0eaab28..fcb0ea2 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -102,7 +102,7 @@ private: class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapBlurFilter> { public: - QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint); + QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHints hints); void setUniforms(QGLShaderProgram *program); @@ -123,13 +123,13 @@ private: mutable bool m_haveCached; mutable int m_cachedRadius; - mutable QGraphicsBlurEffect::BlurHint m_hint; + mutable QGraphicsBlurEffect::BlurHints m_hints; }; class QGLPixmapDropShadowFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapDropShadowFilter> { public: - QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHint hint); + QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHints hints); void setUniforms(QGLShaderProgram *program); @@ -143,7 +143,7 @@ private: mutable bool m_haveCached; mutable int m_cachedRadius; - mutable QGraphicsBlurEffect::BlurHint m_hint; + mutable QGraphicsBlurEffect::BlurHints m_hints; }; extern QGLWidget *qt_gl_share_widget(); @@ -159,19 +159,19 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr case QPixmapFilter::BlurFilter: { const QPixmapBlurFilter *proto = static_cast<const QPixmapBlurFilter *>(prototype); - if (proto->blurHint() == QGraphicsBlurEffect::AnimationHint) { + if (proto->blurHints() & QGraphicsBlurEffect::AnimationHint) { if (!d->animationBlurFilter) - d->animationBlurFilter.reset(new QGLPixmapBlurFilter(proto->blurHint())); + d->animationBlurFilter.reset(new QGLPixmapBlurFilter(proto->blurHints())); return d->animationBlurFilter.data(); } - if (proto->blurHint() == QGraphicsBlurEffect::PerformanceHint || proto->radius() <= 5) { - if (!d->fastBlurFilter) - d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::PerformanceHint)); - return d->fastBlurFilter.data(); + if ((proto->blurHints() & QGraphicsBlurEffect::QualityHint) && proto->radius() > 5) { + if (!d->blurFilter) + d->blurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::QualityHint)); + return d->blurFilter.data(); } - if (!d->blurFilter) - d->blurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::QualityHint)); - return d->blurFilter.data(); + if (!d->fastBlurFilter) + d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::PerformanceHint)); + return d->fastBlurFilter.data(); } case QPixmapFilter::DropShadowFilter: { @@ -316,11 +316,11 @@ static const char *qt_gl_texture_sampling_helper = " return texture2D(src, srcCoords).a;\n" "}\n"; -QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint) +QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHints hints) : m_animatedBlur(false) , m_haveCached(false) , m_cachedRadius(0) - , m_hint(hint) + , m_hints(hints) { } @@ -503,7 +503,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext()); QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx); - if (m_hint == QGraphicsBlurEffect::AnimationHint && blurTextureCache->fitsInCache(src)) { + if ((m_hints & QGraphicsBlurEffect::AnimationHint) && blurTextureCache->fitsInCache(src)) { QRect targetRect = src.rect().adjusted(-qMaxCachedBlurLevel, -qMaxCachedBlurLevel, qMaxCachedBlurLevel, qMaxCachedBlurLevel); // ensure even dimensions (going to divide by two) targetRect.setWidth((targetRect.width() + 1) & ~1); @@ -514,7 +514,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const info = blurTextureCache->takeBlurTextureInfo(src); } else { m_animatedBlur = false; - m_hint = QGraphicsBlurEffect::QualityHint; + m_hints = QGraphicsBlurEffect::QualityHint; m_singlePass = false; QGLFramebufferObjectFormat format; @@ -594,7 +594,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const if (!m_haveCached || !m_animatedBlur) { m_haveCached = true; m_animatedBlur = true; - m_hint = QGraphicsBlurEffect::AnimationHint; + m_hints = QGraphicsBlurEffect::AnimationHint; filter->setSource(qt_gl_interpolate_filter); } @@ -653,7 +653,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const int actualRadius = qRound(radius()); int filterRadius = actualRadius; int fastRadii[] = { 1, 2, 3, 5, 8, 15, 25 }; - if (m_hint != QGraphicsBlurEffect::QualityHint) { + if (!(m_hints & QGraphicsBlurEffect::QualityHint)) { uint i = 0; for (; i < (sizeof(fastRadii)/sizeof(*fastRadii))-1; ++i) { if (fastRadii[i+1] > filterRadius) @@ -762,7 +762,7 @@ void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program) return; } - if (m_hint == QGraphicsBlurEffect::QualityHint) { + if (m_hints & QGraphicsBlurEffect::QualityHint) { if (m_singlePass) program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); else if (m_horizontalBlur) @@ -912,10 +912,10 @@ QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius, bool singlePa return source; } -QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHint hint) +QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHints hints) : m_haveCached(false) , m_cachedRadius(0) - , m_hint(hint) + , m_hints(hints) { } @@ -1018,7 +1018,7 @@ void QGLPixmapDropShadowFilter::setUniforms(QGLShaderProgram *program) alpha); } - if (m_hint == QGraphicsBlurEffect::QualityHint) { + if (m_hints & QGraphicsBlurEffect::QualityHint) { if (m_singlePass) program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); else if (m_horizontalBlur) diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp index 1c02fd0..4d7a69c 100644 --- a/src/opengl/qgraphicsshadereffect.cpp +++ b/src/opengl/qgraphicsshadereffect.cpp @@ -241,7 +241,7 @@ void QGraphicsShaderEffect::setPixelShaderFragment(const QByteArray& code) /*# \reimp */ -void QGraphicsShaderEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +void QGraphicsShaderEffect::draw(QPainter *painter) { Q_D(QGraphicsShaderEffect); @@ -256,13 +256,13 @@ void QGraphicsShaderEffect::draw(QPainter *painter, QGraphicsEffectSource *sourc bool usingShader = d->customShaderStage->setOnPainter(painter); QPoint offset; - if (source->isPixmap()) { + if (sourceIsPixmap()) { // No point in drawing in device coordinates (pixmap will be scaled anyways). - const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); + const QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset); painter->drawPixmap(offset, pixmap); } else { // Draw pixmap in device coordinates to avoid pixmap scaling. - const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); + const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset); QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); painter->drawPixmap(offset, pixmap); @@ -273,7 +273,7 @@ void QGraphicsShaderEffect::draw(QPainter *painter, QGraphicsEffectSource *sourc if (usingShader) d->customShaderStage->removeFromPainter(painter); #else - source->draw(painter); + drawSource(painter); #endif } diff --git a/src/opengl/qgraphicsshadereffect_p.h b/src/opengl/qgraphicsshadereffect_p.h index de7f00c..de65ebb 100644 --- a/src/opengl/qgraphicsshadereffect_p.h +++ b/src/opengl/qgraphicsshadereffect_p.h @@ -76,7 +76,7 @@ public: void setPixelShaderFragment(const QByteArray& code); protected: - void draw(QPainter *painter, QGraphicsEffectSource *source); + void draw(QPainter *painter); void setUniformsDirty(); virtual void setUniforms(QGLShaderProgram *program); diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 5ca37ef..fb55097 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -452,7 +452,7 @@ QImage QGLPixmapData::fillImage(const QColor &color) const if (pixelType() == BitmapType) { img = QImage(w, h, QImage::Format_MonoLSB); - img.setNumColors(2); + img.setColorCount(2); img.setColor(0, QColor(Qt::color0).rgba()); img.setColor(1, QColor(Qt::color1).rgba()); |