diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-05-29 04:33:35 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-05-29 04:33:35 (GMT) |
commit | 5b542cc9faf016c9071f41fa85ab071d05b0f26a (patch) | |
tree | 5f1ac4c42ba26bf627a8e070d916b24f7bec994f | |
parent | b189057d5105b3aae2049d2182ecfceb0399f041 (diff) | |
download | Qt-5b542cc9faf016c9071f41fa85ab071d05b0f26a.zip Qt-5b542cc9faf016c9071f41fa85ab071d05b0f26a.tar.gz Qt-5b542cc9faf016c9071f41fa85ab071d05b0f26a.tar.bz2 |
Make compile under Open GL ES 2.
We will need to optimize the pixmap.toImage calls.
-rw-r--r-- | src/declarative/canvas/qsimplecanvasdebugplugin.cpp | 7 | ||||
-rw-r--r-- | src/declarative/fx/qfxhighlightfilter.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfximage.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxpainteditem.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxparticles.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxrect.cpp | 28 | ||||
-rw-r--r-- | src/declarative/fx/qfxtext.cpp | 2 |
7 files changed, 23 insertions, 22 deletions
diff --git a/src/declarative/canvas/qsimplecanvasdebugplugin.cpp b/src/declarative/canvas/qsimplecanvasdebugplugin.cpp index f5f4f53..0fd0f81 100644 --- a/src/declarative/canvas/qsimplecanvasdebugplugin.cpp +++ b/src/declarative/canvas/qsimplecanvasdebugplugin.cpp @@ -122,7 +122,12 @@ void QSimpleCanvasSceneDebugPlugin::refresh(QDataStream &ds, ds << QmlDebugServerPlugin::objectToString(item) << item->x() << item->y() << item->z() << item->width() << item->height() << (int)item->transformOrigin() << item->scale() << (int)item->flip() - << item->transform() << item->hasActiveFocus() << (int)item->options(); +#ifdef QFX_RENDER_OPENGL + << item->transform().toTransform() +#elif defined(QFX_RENDER_QPAINTER) + << item->transform() +#endif + << item->hasActiveFocus() << (int)item->options(); QPixmap pix; diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp index c36ba98..6bf3148 100644 --- a/src/declarative/fx/qfxhighlightfilter.cpp +++ b/src/declarative/fx/qfxhighlightfilter.cpp @@ -138,7 +138,7 @@ void QFxHighlightFilter::imageLoaded() QPixmap img = QFxPixmap(d->url); #if defined(QFX_RENDER_OPENGL2) if (!img.isNull()) - d->tex.setImage(img); + d->tex.setImage(img.toImage()); #endif emit sourceChanged(d->source); update(); diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 8f63a90..22e5d97 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -459,7 +459,7 @@ uint QFxImage::glSimpleItemData(float *vertices, float *texVertices, void QFxImagePrivate::checkDirty() { if (_texDirty && !_pix.isNull()) { - _tex.setImage(_pix); + _tex.setImage(_pix.toImage()); _tex.setHorizontalWrap(GLTexture::Repeat); _tex.setVerticalWrap(GLTexture::Repeat); } diff --git a/src/declarative/fx/qfxpainteditem.cpp b/src/declarative/fx/qfxpainteditem.cpp index 7fd74a6..44adba7 100644 --- a/src/declarative/fx/qfxpainteditem.cpp +++ b/src/declarative/fx/qfxpainteditem.cpp @@ -315,7 +315,7 @@ void QFxPaintedItem::paintGLContents(GLPainter &p) #if defined(QFX_RENDER_QPAINTER) newitem->image = img; #else - newitem->image.setImage(img); + newitem->image.setImage(img.toImage()); #endif d->imagecache.append(newitem); QRectF target(r.x(), r.y(), r.width(), r.height()); diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp index 52f24a0..41fb5bc 100644 --- a/src/declarative/fx/qfxparticles.cpp +++ b/src/declarative/fx/qfxparticles.cpp @@ -1143,7 +1143,7 @@ void QFxParticlesPainter::paintGLContents(GLPainter &p) updateSize(); if (d->texDirty && !d->image.isNull()) { - d->tex.setImage(d->image); + d->tex.setImage(d->image.toImage()); d->tex.setHorizontalWrap(GLTexture::Repeat); d->tex.setVerticalWrap(GLTexture::Repeat); } diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index 475c095..564faa6 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -652,7 +652,7 @@ void QFxRect::paintGLContents(GLPainter &p) { Q_D(QFxRect); if (d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) { - if (d->_gradcolor.isValid()) { + if (d->gradient) { float widthV = width(); float heightV = height(); @@ -661,20 +661,16 @@ void QFxRect::paintGLContents(GLPainter &p) 0, 0, widthV, 0 }; - float r = d->_color.redF(); - float g = d->_color.greenF(); - float b = d->_color.blueF(); - float a = d->_color.alphaF() * p.activeOpacity; - - float r2 = d->_gradcolor.redF(); - float g2 = d->_gradcolor.greenF(); - float b2 = d->_gradcolor.blueF(); - float a2 = d->_gradcolor.alphaF() * p.activeOpacity; - - GLfloat colors[] = { r2, g2, b2, a2, - r2, g2, b2, a2, - r, g, b, a, - r, g, b, a }; + int count = d->gradient->stops()->size(); + GLfloat colors[count*8]; + for (int i = 0; i < count; i += 8) { + QFxGradientStop *g = d->gradient->stops()->at(i); + QColor c = g->color(); + colors[i] = c.redF(); colors[i+4] = colors[i]; + colors[i+1] = c.greenF(); colors[i+5] = colors[i+1]; + colors[i+2] = c.blueF(); colors[i+6] = colors[i+2]; + colors[i+3] = c.alphaF() * p.activeOpacity; colors[i+7] = colors[i+3]; + } ColorShader *shader = basicShaders()->color(); shader->enable(); @@ -682,7 +678,7 @@ void QFxRect::paintGLContents(GLPainter &p) shader->setAttributeArray(ColorShader::Vertices, vertices, 2); shader->setAttributeArray(ColorShader::Colors, colors, 4); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glDrawArrays(GL_TRIANGLE_STRIP, 0, count*2); shader->disableAttributeArray(ColorShader::Vertices); shader->disableAttributeArray(ColorShader::Colors); } else { diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index 2486a84..702ec81 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -696,7 +696,7 @@ void QFxTextPrivate::checkImgCache() } #if defined(QFX_RENDER_OPENGL) - tex.setImage(imgCache); + tex.setImage(imgCache.toImage()); #endif imgDirty = false; |