summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx/qfximage.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-06-19 05:58:16 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-06-19 05:58:16 (GMT)
commit0b59aed42d27584ef3493305c565dd47f66d179d (patch)
tree5714e8f4fcd37e7500e85dfedb902fdf997eedae /src/declarative/fx/qfximage.cpp
parentbbdaf08826a9c93d2c0f56cbe064ee4c47a04f0f (diff)
downloadQt-0b59aed42d27584ef3493305c565dd47f66d179d.zip
Qt-0b59aed42d27584ef3493305c565dd47f66d179d.tar.gz
Qt-0b59aed42d27584ef3493305c565dd47f66d179d.tar.bz2
Remove OpenGL support from Fluid UI primitives
Diffstat (limited to 'src/declarative/fx/qfximage.cpp')
-rw-r--r--src/declarative/fx/qfximage.cpp358
1 files changed, 0 insertions, 358 deletions
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index 40389c4..2ac035d 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -42,9 +42,6 @@
#include "qfximage.h"
#include "qfximage_p.h"
#include <qfxperf.h>
-#if defined(QFX_RENDER_OPENGL)
-#include <glsave.h>
-#endif
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QFile>
@@ -131,12 +128,6 @@ QFxImage::~QFxImage()
QFxPixmap::cancelGet(d->url, this);
if (!d->sciurl.isEmpty())
QFxPixmap::cancelGet(d->sciurl, this);
-#if defined(QFX_RENDER_OPENGL)
- if (d->tex) {
- d->tex->release();
- d->tex = 0;
- }
-#endif
}
/*!
@@ -164,13 +155,6 @@ void QFxImage::setPixmap(const QPixmap &pix)
setImplicitWidth(d->pix.width());
setImplicitHeight(d->pix.height());
-#if defined(QFX_RENDER_OPENGL)
- d->texDirty = true;
- if (d->tex) {
- d->tex->release();
- d->tex = 0;
- }
-#endif
update();
}
@@ -329,7 +313,6 @@ void QFxImage::dump(int depth)
QFxItem::dump(depth);
}
-#if defined(QFX_RENDER_QPAINTER)
void QFxImage::paintContents(QPainter &p)
{
Q_D(QFxImage);
@@ -431,333 +414,6 @@ void QFxImage::paintContents(QPainter &p)
if (d->smooth)
p.setRenderHints(oldHints);
}
-#elif defined(QFX_RENDER_OPENGL)
-uint QFxImage::glSimpleItemData(float *vertices, float *texVertices,
- GLTexture **texture, uint count)
-{
- Q_D(QFxImage);
-
- if (d->pix.isNull() || (d->scaleGrid && !d->scaleGrid->isNull()))
- return 0;
-
- if (count < 8)
- return 8;
-
- d->checkDirty();
-
- float widthV = width();
- float heightV = height();
-
- vertices[0] = 0; vertices[1] = heightV;
- vertices[2] = widthV; vertices[3] = heightV;
- vertices[4] = 0; vertices[5] = 0;
- vertices[6] = widthV; vertices[7] = 0;
-
- *texture = d->tex;
-
- if (d->tiled) {
- float tileWidth = widthV / d->pix.width();
- float tileHeight = heightV / d->pix.height();
- texVertices[0] = 0; texVertices[1] = 0;
- texVertices[2] = tileWidth; texVertices[3] = 0;
- texVertices[4] = 0; texVertices[5] = tileHeight;
- texVertices[6] = tileWidth; texVertices[7] = tileHeight;
- } else {
- texVertices[0] = 0; texVertices[1] = 0;
- texVertices[2] = d->tex->glWidth(); texVertices[3] = 0;
- texVertices[4] = 0; texVertices[5] = d->tex->glHeight();
- texVertices[6] = d->tex->glWidth(); texVertices[7] = d->tex->glHeight();
- }
-
- return 8;
-}
-
-void QFxImagePrivate::checkDirty()
-{
- Q_Q(QFxImage);
- if (texDirty && !pix.isNull())
- tex = q->cachedTexture(url.toString(), pix);
- texDirty = false;
-}
-
-#if defined(QFX_RENDER_OPENGL2)
-void QFxImage::paintGLContents(GLPainter &p)
-{
- Q_D(QFxImage);
- if (d->pix.isNull())
- return;
-
- QGLShaderProgram *shader = p.useTextureShader();
-
- bool restoreBlend = false;
- if (p.blendEnabled && isOpaque() && p.activeOpacity == 1) {
- glDisable(GL_BLEND);
- restoreBlend = true;
- }
-
- d->checkDirty();
-
- if (d->tiled || (!d->scaleGrid || d->scaleGrid->isNull())) {
-
- if (!d->tiled) {
-
- float widthV = width();
- float heightV = height();
- float glWidth = d->tex->glWidth();
- float glHeight = d->tex->glHeight();
-
- float deltaX = 0.5 / qreal(d->tex->glSize().width());
- float deltaY = 0.5 / qreal(d->tex->glSize().height());
- glWidth -= deltaX;
- glHeight -= deltaY;
-
-
- float vert[] = {
- 0, heightV,
- widthV, heightV,
- 0, 0,
-
- widthV, heightV,
- 0, 0,
- widthV, 0 };
-
- float tex[] = {
- deltaX, deltaY,
- glWidth, deltaY,
- deltaX, glHeight,
-
- glWidth, deltaY,
- deltaX, glHeight,
- glWidth, glHeight
- };
-
- shader->setAttributeArray(SingleTextureShader::Vertices, vert, 2);
- shader->setAttributeArray(SingleTextureShader::TextureCoords, tex, 2);
- glBindTexture(GL_TEXTURE_2D, d->tex->texture());
- glDrawArrays(GL_TRIANGLES, 0, 6);
-
- } else {
-
- GLfloat vertices[8];
- GLfloat texVertices[8];
- GLTexture *tex = 0;
-
- QFxImage::glSimpleItemData(vertices, texVertices, &tex, 8);
-
- shader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2);
- shader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2);
-
- glBindTexture(GL_TEXTURE_2D, tex->texture());
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- }
-
- } else {
-
- float imgWidth = d->pix.width();
- float imgHeight = d->pix.height();
- if (!imgWidth || !imgHeight) {
- if (restoreBlend)
- glEnable(GL_BLEND);
- return;
- }
-
- float widthV = width();
- float heightV = height();
- float glWidth = d->tex->glWidth();
- float glHeight = d->tex->glHeight();
- float deltaX = 0.5 / qreal(d->tex->glSize().width());
- float deltaY = 0.5 / qreal(d->tex->glSize().height());
- glHeight -= deltaY;
- glWidth -= deltaX;
-
- float texleft = deltaX;
- float texright = glWidth;
- float textop = glHeight;
- float texbottom = deltaY;
- float imgleft = 0;
- float imgright = widthV;
- float imgtop = 0;
- float imgbottom = heightV;
-
- const int sgl = d->scaleGrid->left();
- const int sgr = d->scaleGrid->right();
- const int sgt = d->scaleGrid->top();
- const int sgb = d->scaleGrid->bottom();
-
- if (sgl) {
- texleft = deltaX + d->tex->glWidth() * float(sgl) / imgWidth;
- imgleft = sgl;
- }
- if (sgr) {
- texright = d->tex->glWidth() - float(sgr) / imgWidth - deltaX;
- imgright = widthV - sgr;
- }
- if (sgt) {
- textop = d->tex->glHeight() - float(sgb) / imgHeight - deltaY;
- imgtop = sgt;
- }
- if (sgb) {
- texbottom = deltaY + d->tex->glHeight() * float(sgt) / imgHeight;
- imgbottom = heightV - sgb;
- }
-
- float vert1[] = { 0, 0,
- 0, imgtop,
- imgleft, 0,
-
- 0, imgtop,
- imgleft, 0,
- imgleft, imgtop,
-
- imgleft, 0,
- imgleft, imgtop,
- imgright, 0,
-
- imgleft, imgtop,
- imgright, 0,
- imgright, imgtop,
-
- imgright, 0,
- imgright, imgtop,
- widthV, 0,
-
- imgright, imgtop,
- widthV, 0,
- widthV, imgtop,
-
- 0, imgtop,
- 0, imgbottom,
- imgleft, imgtop,
-
- 0, imgbottom,
- imgleft, imgtop,
- imgleft, imgbottom,
-
- imgleft, imgtop,
- imgleft, imgbottom,
- imgright, imgtop,
-
- imgleft, imgbottom,
- imgright, imgtop,
- imgright, imgbottom,
-
- imgright, imgtop,
- imgright, imgbottom,
- widthV, imgtop,
-
- imgright, imgbottom,
- widthV, imgtop,
- widthV, imgbottom,
-
- 0, imgbottom,
- 0, heightV,
- imgleft, imgbottom,
-
- 0, heightV,
- imgleft, imgbottom,
- imgleft, heightV,
-
- imgleft, imgbottom,
- imgleft, heightV,
- imgright, imgbottom,
-
- imgleft, heightV,
- imgright, imgbottom,
- imgright, heightV,
-
- imgright, imgbottom,
- imgright, heightV,
- widthV, imgbottom,
-
- imgright, heightV,
- widthV, imgbottom,
- widthV, heightV };
-
- float tex1[] = { deltaX, glHeight,
- deltaX, textop,
- texleft, glHeight,
-
- deltaX, textop,
- texleft, glHeight,
- texleft, textop,
-
- texleft, glHeight,
- texleft, textop,
- texright, glHeight,
-
- texleft, textop,
- texright, glHeight,
- texright, textop,
-
- texright, glHeight,
- texright, textop,
- glWidth, glHeight,
-
- texright, textop,
- glWidth, glHeight,
- glWidth, textop,
-
- deltaX, textop,
- deltaX, texbottom,
- texleft, textop,
-
- deltaX, texbottom,
- texleft, textop,
- texleft, texbottom,
-
- texleft, textop,
- texleft, texbottom,
- texright, textop,
-
- texleft, texbottom,
- texright, textop,
- texright, texbottom,
-
- texright, textop,
- texright, texbottom,
- glWidth, textop,
-
- texright, texbottom,
- glWidth, textop,
- glWidth, texbottom,
-
- deltaX, texbottom,
- deltaX, deltaY,
- texleft, texbottom,
-
- deltaX, deltaY,
- texleft, texbottom,
- texleft, deltaY,
-
- texleft, texbottom,
- texleft, deltaY,
- texright, texbottom,
-
- texleft, deltaY,
- texright, texbottom,
- texright, deltaY,
-
- texright, texbottom,
- texright, deltaY,
- glWidth, texbottom,
-
- texright, deltaY,
- glWidth, texbottom,
- glWidth, deltaY };
-
- glBindTexture(GL_TEXTURE_2D, d->tex->texture());
-
- shader->setAttributeArray(SingleTextureShader::Vertices, vert1, 2);
- shader->setAttributeArray(SingleTextureShader::TextureCoords, tex1, 2);
- glDrawArrays(GL_TRIANGLES, 0, 54);
- }
-
- if (restoreBlend)
- glEnable(GL_BLEND);
-}
-#endif
-
-#endif
QString QFxImage::propertyInfo() const
{
@@ -867,13 +523,6 @@ void QFxImage::setSource(const QUrl &url)
d->progress = 1.0;
setImplicitWidth(0);
setImplicitHeight(0);
-#if defined(QFX_RENDER_OPENGL)
- d->texDirty = true;
- if (d->tex) {
- d->tex->release();
- d->tex = 0;
- }
-#endif
emit statusChanged(d->status);
emit sourceChanged(d->url);
emit progressChanged(1.0);
@@ -931,13 +580,6 @@ void QFxImage::requestFinished()
if (d->status == Loading)
d->status = Idle;
d->progress = 1.0;
-#if defined(QFX_RENDER_OPENGL)
- d->texDirty = true;
- if (d->tex) {
- d->tex->release();
- d->tex = 0;
- }
-#endif
emit statusChanged(d->status);
emit sourceChanged(d->url);
emit progressChanged(1.0);