summaryrefslogtreecommitdiffstats
path: root/src/declarative
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
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')
-rw-r--r--src/declarative/canvas/canvas.pri11
-rw-r--r--src/declarative/canvas/qsimplecanvas.cpp67
-rw-r--r--src/declarative/canvas/qsimplecanvas.h29
-rw-r--r--src/declarative/canvas/qsimplecanvas_opengl.cpp680
-rw-r--r--src/declarative/canvas/qsimplecanvas_opengl1.cpp401
-rw-r--r--src/declarative/canvas/qsimplecanvas_p.h64
-rw-r--r--src/declarative/canvas/qsimplecanvasdebugplugin.cpp4
-rw-r--r--src/declarative/canvas/qsimplecanvasfilter.cpp323
-rw-r--r--src/declarative/canvas/qsimplecanvasfilter.h113
-rw-r--r--src/declarative/canvas/qsimplecanvasfilter_p.h70
-rw-r--r--src/declarative/canvas/qsimplecanvasitem.cpp138
-rw-r--r--src/declarative/canvas/qsimplecanvasitem.h67
-rw-r--r--src/declarative/canvas/qsimplecanvasitem_p.h47
-rw-r--r--src/declarative/declarative.pro2
-rw-r--r--src/declarative/fx/fx.pri2
-rw-r--r--src/declarative/fx/qfxblendedimage.cpp308
-rw-r--r--src/declarative/fx/qfxblendedimage.h110
-rw-r--r--src/declarative/fx/qfxflipable.cpp18
-rw-r--r--src/declarative/fx/qfxflipable.h3
-rw-r--r--src/declarative/fx/qfximage.cpp358
-rw-r--r--src/declarative/fx/qfximage.h6
-rw-r--r--src/declarative/fx/qfximage_p.h12
-rw-r--r--src/declarative/fx/qfxitem.cpp10
-rw-r--r--src/declarative/fx/qfxitem.h3
-rw-r--r--src/declarative/fx/qfxpainteditem.cpp45
-rw-r--r--src/declarative/fx/qfxpainteditem.h4
-rw-r--r--src/declarative/fx/qfxpainteditem_p.h8
-rw-r--r--src/declarative/fx/qfxparticles.cpp81
-rw-r--r--src/declarative/fx/qfxparticles.h8
-rw-r--r--src/declarative/fx/qfxrect.cpp336
-rw-r--r--src/declarative/fx/qfxrect.h6
-rw-r--r--src/declarative/fx/qfxrect_p.h10
-rw-r--r--src/declarative/fx/qfxtext.cpp88
-rw-r--r--src/declarative/fx/qfxtext.h4
-rw-r--r--src/declarative/fx/qfxtext_p.h7
-rw-r--r--src/declarative/fx/qfxtextedit.cpp4
-rw-r--r--src/declarative/fx/qfxtextedit_p.h3
-rw-r--r--src/declarative/fx/qfxtransform.cpp95
-rw-r--r--src/declarative/fx/qfxtransform.h7
-rw-r--r--src/declarative/fx/qfxwebview.cpp13
-rw-r--r--src/declarative/opengl/glbasicshaders.cpp707
-rw-r--r--src/declarative/opengl/glbasicshaders.h244
-rw-r--r--src/declarative/opengl/glheaders.h49
-rw-r--r--src/declarative/opengl/glsave.cpp1
-rw-r--r--src/declarative/opengl/glsave.h111
-rw-r--r--src/declarative/opengl/gltexture.cpp384
-rw-r--r--src/declarative/opengl/gltexture.h120
-rw-r--r--src/declarative/opengl/opengl.pri20
-rw-r--r--src/declarative/util/qfxglobal.h31
49 files changed, 5 insertions, 5227 deletions
diff --git a/src/declarative/canvas/canvas.pri b/src/declarative/canvas/canvas.pri
index 9bdd3fa..28cab9b 100644
--- a/src/declarative/canvas/canvas.pri
+++ b/src/declarative/canvas/canvas.pri
@@ -1,19 +1,14 @@
SOURCES += \
canvas/qsimplecanvas.cpp \
canvas/qsimplecanvasitem.cpp \
- canvas/qsimplecanvasfilter.cpp \
- canvas/qsimplecanvasdebugplugin.cpp
+ canvas/qsimplecanvasdebugplugin.cpp \
+ canvas/qsimplecanvas_software.cpp \
+ canvas/qsimplecanvas_graphicsview.cpp
HEADERS += \
canvas/qsimplecanvas.h \
canvas/qsimplecanvasitem.h \
- canvas/qsimplecanvasfilter.h \
canvas/qsimplecanvas_p.h \
canvas/qsimplecanvasitem_p.h \
- canvas/qsimplecanvasfilter_p.h \
canvas/qsimplecanvasdebugplugin_p.h
-contains(QT_CONFIG, opengles2): SOURCES += canvas/qsimplecanvas_opengl.cpp
-else:contains(QT_CONFIG, opengles1): SOURCES += canvas/qsimplecanvas_opengl1.cpp
-else:SOURCES += canvas/qsimplecanvas_software.cpp
-SOURCES += canvas/qsimplecanvas_graphicsview.cpp
diff --git a/src/declarative/canvas/qsimplecanvas.cpp b/src/declarative/canvas/qsimplecanvas.cpp
index cb46f94..cbbc26d 100644
--- a/src/declarative/canvas/qsimplecanvas.cpp
+++ b/src/declarative/canvas/qsimplecanvas.cpp
@@ -49,9 +49,6 @@
#include "qtimer.h"
#include "qdatetime.h"
#include "qgraphicssceneevent.h"
-#if defined(QFX_RENDER_OPENGL)
-#include <glheaders.h>
-#endif
#include "qboxlayout.h"
#include "qsimplecanvasdebugplugin_p.h"
#include "qsimplecanvas.h"
@@ -601,13 +598,6 @@ void QSimpleCanvasPrivate::init(QSimpleCanvas::CanvasMode mode)
view->scene()->setItemIndexMethod(QGraphicsScene::NoIndex);
view->viewport()->setFocusPolicy(Qt::NoFocus);
}
-
-#if defined(QFX_RENDER_OPENGL) && defined(Q_WS_X11)
- QTimer *t = new QTimer(q);
- t->setInterval(200);
- QObject::connect(t, SIGNAL(timeout()), &egl, SLOT(updateGL()));
- t->start();
-#endif
}
QSimpleCanvas::~QSimpleCanvas()
@@ -795,9 +785,6 @@ bool QSimpleCanvas::focusNextPrevChild(bool)
void QSimpleCanvas::showEvent(QShowEvent *e)
{
-#if defined(QFX_RENDER_OPENGL)
- d->egl.resize(width(), height());
-#endif
if (d->isGraphicsView())
d->view->setSceneRect(rect());
@@ -806,9 +793,6 @@ void QSimpleCanvas::showEvent(QShowEvent *e)
void QSimpleCanvas::resizeEvent(QResizeEvent *e)
{
-#if defined(QFX_RENDER_OPENGL)
- d->egl.resize(width(), height());
-#endif
if (d->isGraphicsView())
d->view->setSceneRect(rect());
QWidget::resizeEvent(e);
@@ -833,21 +817,6 @@ void QSimpleCanvas::addDirty(QSimpleCanvasItem *c)
Q_ASSERT(d->isSimpleCanvas());
queueUpdate();
d->oldDirty |= c->d_func()->data()->lastPaintRect;
-#if defined(QFX_RENDER_OPENGL)
- // ### Is this parent crawl going to be a problem for scenes with nots
- // of things changing?
- // Check for filters
- QSimpleCanvasItem *fi = c->parent();
- while(fi) {
- if (fi->d_func()->data()->dirty) {
- break;
- } else if (fi->filter()) {
- fi->update();
- break;
- }
- fi = fi->parent();
- }
-#endif
d->dirtyItems.append(c);
}
@@ -855,15 +824,8 @@ QRect QSimpleCanvasPrivate::dirtyItemClip() const
{
QRect rv;
if (isSimpleCanvas()) {
-#if defined(QFX_RENDER_OPENGL)
- QRectF r;
- for (int ii = 0; ii < dirtyItems.count(); ++ii)
- r |= dirtyItems.at(ii)->d_func()->data()->lastPaintRect;
- rv = egl.map(r);
-#else
for (int ii = 0; ii < dirtyItems.count(); ++ii)
rv |= dirtyItems.at(ii)->d_func()->data()->lastPaintRect;
-#endif
}
return rv;
}
@@ -871,11 +833,7 @@ QRect QSimpleCanvasPrivate::dirtyItemClip() const
QRect QSimpleCanvasPrivate::resetDirty()
{
if (isSimpleCanvas()) {
-#if defined(QFX_RENDER_OPENGL)
- QRect r = egl.map(oldDirty) | dirtyItemClip();
-#else
QRect r = oldDirty | dirtyItemClip();
-#endif
if (!r.isEmpty())
r.adjust(-1,-1,2,2); //make sure we get everything (since we rounded from floats to ints)
for (int ii = 0; ii < dirtyItems.count(); ++ii)
@@ -918,37 +876,16 @@ bool QSimpleCanvas::event(QEvent *e)
int tbf = d->frameTimer.restart();
d->timer = 0;
d->isSetup = true;
-#if defined(QFX_RENDER_OPENGL1)
- unsigned int zero = 0;
- d->root->d_func()->setupPainting(0, rect(), &zero);
-#elif defined(QFX_RENDER_OPENGL2)
- ++d->paintVersion;
- d->opaqueList = 0;
- int z = 0;
- d->root->d_func()->setupPainting(0, z, &d->opaqueList);
-#else
++d->paintVersion;
d->root->d_func()->setupPainting(0, rect());
-#endif
QRect r = d->resetDirty();
-#if defined(QFX_RENDER_QPAINTER)
if (r.isEmpty() || fullUpdate())
repaint();
else
repaint(r);
emit framePainted();
-#else
-
- QRect nr(r.x(), height() - r.y() - r.height(), r.width(), r.height());
-
- if (r.isEmpty() || fullUpdate())
- d->egl.updateGL();
- else
- d->egl.updateGL(nr);
- emit framePainted();
-#endif
d->isSetup = false;
int frametimer = d->frameTimer.elapsed();
@@ -1016,14 +953,10 @@ void QSimpleCanvas::checkState()
QImage QSimpleCanvas::asImage() const
{
if (d->isSimpleCanvas()) {
-#if defined(QFX_RENDER_QPAINTER)
QImage img(width(),height(),QImage::Format_RGB32);
QPainter p(&img);
const_cast<QSimpleCanvas*>(this)->d->paint(p);
return img;
-#elif defined(QFX_RENDER_OPENGL)
- return d->egl.grabFrameBuffer();
-#endif
} else {
QImage img(width(),height(),QImage::Format_RGB32);
QPainter p(&img);
diff --git a/src/declarative/canvas/qsimplecanvas.h b/src/declarative/canvas/qsimplecanvas.h
index 1cbd3c7..b9f8ddb 100644
--- a/src/declarative/canvas/qsimplecanvas.h
+++ b/src/declarative/canvas/qsimplecanvas.h
@@ -44,10 +44,6 @@
#include <QtDeclarative/qfxglobal.h>
-#ifdef QFX_RENDER_OPENGL
-#include <QtGui/qmatrix4x4.h>
-#endif
-
#include <QtGui/QTransform>
#include <QtGui/QPainter>
#include <QtCore/QDebug>
@@ -65,42 +61,18 @@ namespace QSimpleCanvasConfig
{
enum ImageType { Opaque, Translucent };
-#ifdef QFX_RENDER_OPENGL
- typedef QMatrix4x4 Matrix;
- typedef QImage Image;
-
- inline Matrix transformToMatrix(const QTransform &)
- {
- return Matrix(); // XXX
- }
- inline QTransform matrixToTransform(const Matrix &)
- {
- return QTransform(); // XXX
- }
- inline bool needConvert(ImageType, const Image &)
- { return false; }
- inline Image convert(ImageType, const Image &i)
- { return i; }
- inline Image create(const QSize &s)
- { return QImage(s, QImage::Format_ARGB32); }
- inline const Image &toImage(const QImage &i)
- { return i; }
-
-#elif defined(QFX_RENDER_QPAINTER)
typedef QTransform Matrix;
inline Matrix transformToMatrix(const QTransform &t)
{ return t; }
inline QTransform matrixToTransform(const Matrix &t)
{ return t; }
-#endif
}
class QSimpleCanvas;
class QSimpleCanvasLayer;
class QGraphicsSceneMouseEvent;
-class GLBasicShaders;
class QSimpleCanvasItem;
class QSimpleCanvasPrivate;
class Q_DECLARATIVE_EXPORT QSimpleCanvas : public QWidget
@@ -157,7 +129,6 @@ private:
friend class QSimpleCanvasPrivate;
friend class QSimpleCanvasItem;
friend class QSimpleCanvasItemPrivate;
- friend class QSimpleCanvasFilter;
friend class QSimpleGraphicsItem;
void queueUpdate();
diff --git a/src/declarative/canvas/qsimplecanvas_opengl.cpp b/src/declarative/canvas/qsimplecanvas_opengl.cpp
deleted file mode 100644
index 7969a2a..0000000
--- a/src/declarative/canvas/qsimplecanvas_opengl.cpp
+++ /dev/null
@@ -1,680 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsimplecanvas.h"
-#include "qsimplecanvas_p.h"
-#include "qsimplecanvasitem_p.h"
-#include "qsimplecanvasfilter_p.h"
-#include <glsave.h>
-#include <QtOpenGL/qglframebufferobject.h>
-#include <gltexture.h>
-#include <math.h>
-
-
-QT_BEGIN_NAMESPACE
-void CanvasEGLWidget::paintGL()
-{
- glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- _canvas->paintGL();
-}
-
-void CanvasEGLWidget::updateGL()
-{
- _clip = QRect();
- QGLWidget::updateGL();
-}
-
-void CanvasEGLWidget::updateGL(const QRect &r)
-{
- if (r.isEmpty())
- return;
-
- _clip = r;
- QGLWidget::updateGL();
-}
-
-void CanvasEGLWidget::resizeGL(int w, int h)
-{
- glViewport(0, 0, w, h);
-}
-
-QRect CanvasEGLWidget::map(const QRectF &f) const
-{
- return invDefaultTransform.mapRect(f).toAlignedRect();
-}
-
-void CanvasEGLWidget::resizeEvent(QResizeEvent *e)
-{
- defaultTransform.setIdentity();
- defaultTransform.flipCoordinates();
- defaultTransform.translate(-1, -1, 0);
- defaultTransform.scale(2. / width(), 2. / height(), 1. / (1024. * 1024.));
- invDefaultTransform = defaultTransform.inverted();
- _canvas->root->d_func()->data()->transformActive = defaultTransform;
- _canvas->root->d_func()->data()->transformValid = true;
-
- QGLWidget::resizeEvent(e);
-}
-
-void CanvasEGLWidget::initializeGL()
-{
- glEnable(GL_BLEND);
- glEnable(GL_STENCIL_TEST);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
- GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
-
- glStencilFunc(GL_EQUAL, 0, 0xFFFFFFFF);
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
-}
-
-void QSimpleCanvasPrivate::paintGL()
-{
- lrpTimer.start();
-
- QSimpleCanvasItemPrivate::GLPaintParameters p;
- QSimpleCanvasItem::GLPainter painter;
-
- p.sceneRect = QRect(0, 0, q->width(), q->height());
- p.clipRect = p.sceneRect;
- p.stencilValue = 0;
- p.opacity = 1;
- p.forceParamRefresh = false;
- p.painter = &painter;
- if (!isSetup) {
- opaqueList = 0;
- int z = 0;
- root->d_func()->setupPainting(0, z, &opaqueList);
- }
-
- glEnable(GL_DEPTH_TEST);
-
- glDisable(GL_BLEND);
- painter.blendEnabled = false;
- painter.activeOpacity = 1;
- while (opaqueList) {
- painter.item = opaqueList;
- painter.activeTransform = opaqueList->d_func()->data()->transformActive;
- // ### - I don't think this is right
- painter.sceneClipRect = p.clipRect;
-
- opaqueList->paintGLContents(painter);
- opaqueList = opaqueList->d_func()->nextOpaque;
- }
- glEnable(GL_BLEND);
- painter.blendEnabled = true;
-
- root->d_func()->paint(p);
-
- lrpTime = lrpTimer.elapsed();
-}
-
-QGLFramebufferObject *QSimpleCanvasPrivate::acquire(int w, int h)
-{
- if (w <= 0 || h <= 0)
- return 0;
-
- int size = qMax(w, h);
- for (int ii = 0; ii < frameBuffers.count(); ++ii) {
- if (frameBuffers.at(ii)->width() >= size) {
- QGLFramebufferObject *rv = frameBuffers.at(ii);
- frameBuffers.removeAt(ii);
- return rv;
- }
- }
-
- // Find power of two
- size--;
- size |= size >> 1;
- size |= size >> 2;
- size |= size >> 4;
- size |= size >> 8;
- size |= size >> 16;
- size++;
-
- QGLFramebufferObject *fbo = new QGLFramebufferObject(size, size);
- return fbo;
-}
-
-void QSimpleCanvasPrivate::release(QGLFramebufferObject *buf)
-{
- int size = qMax(buf->width(), buf->height());
- for (int ii = 0; ii < frameBuffers.count(); ++ii) {
- if (frameBuffers.at(ii)->width() >= size) {
- frameBuffers.insert(ii, buf);
- return;
- }
- }
- frameBuffers.append(buf);
-}
-
-GLBasicShaders *QSimpleCanvasItemPrivate::basicShaders() const
-{
- return canvas->d->basicShaders();
-}
-
-QSimpleCanvas::Matrix QSimpleCanvasItemPrivate::localTransform() const
-{
- Q_Q(const QSimpleCanvasItem);
-
- QSimpleCanvas::Matrix trans;
- trans.translate(q->x(), q->y());
- QPointF to = transformOrigin();
- trans.translate(to.x(), to.y());
- trans.scale(q->scale(), q->scale());
- trans.translate(-to.x(), -to.y());
- if (data()->transformUser)
- trans *= *data()->transformUser;
- return trans;
-}
-
-void QSimpleCanvasItemPrivate::simplePaintChild(const GLPaintParameters &params, QSimpleCanvasItem *child)
-{
- Q_Q(QSimpleCanvasItem);
-
- GLPaintParameters childParams = params;
- if (clip)
- ++childParams.stencilValue;
-
- if (child->d_func()->data()->activeOpacity != 0) {
- childParams.boundingRect = child->boundingRect();
-
- if (child->filter() && child->filter()->enabled()) {
- QSimpleCanvasItem::GLPainter &painter = *params.painter;
- painter.item = q;
- painter.activeTransform = child->d_func()->data()->transformActive;
- painter.activeOpacity = child->d_func()->data()->activeOpacity;
- painter.sceneClipRect = params.clipRect;
- child->filter()->d->doFilterGL(painter, childParams);
- } else {
- child->d_func()->paint(childParams);
- }
- }
-}
-
-void QSimpleCanvasItemPrivate::paintChild(const GLPaintParameters &params,
- QSimpleCanvasItem *child)
-{
- if (params.forceParamRefresh) {
- QSimpleCanvas::Matrix t = child->d_func()->data()->transformActive;
- qreal o = child->d_func()->data()->activeOpacity;
- setupChildState(child);
- simplePaintChild(params, child);
- child->d_func()->data()->transformActive = t;
- child->d_func()->data()->transformValid = true;
- child->d_func()->data()->activeOpacity = o;
- } else {
- simplePaintChild(params, child);
- }
-}
-
-void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child)
-{
- QSimpleCanvasItemData *const myData = data();
- QSimpleCanvasItemPrivate *const childPrivate = child->d_func();
- QSimpleCanvasItemData *const childData = childPrivate->data();
-
- childData->activeOpacity = myData->activeOpacity;
- if (childData->visible != 1.)
- childData->activeOpacity *= childData->visible;
-
- if (childData->activeOpacity != 0.) {
- QSimpleCanvas::Matrix &am = childData->transformActive;
- am = myData->transformActive;
-
- // Calculate child's transform
- const qreal x = childData->x;
- const qreal y = childData->y;
- const qreal scale = childPrivate->scale;
- QSimpleCanvasItem::Flip flip = childData->flip;
-
- if (x != 0. || y != 0.)
- am.translate(x, y);
-
- if (scale != 1.) {
- if (childPrivate->origin == QSimpleCanvasItem::TopLeft) {
- am.scale(scale, scale);
- } else {
- QPointF to = childPrivate->transformOrigin();
- am.translate(to.x(), to.y());
- am.scale(scale, scale);
- am.translate(-to.x(), -to.y());
- }
- }
-
- if (childData->transformUser)
- am *= *childData->transformUser;
- if (flip) {
- QRectF br = child->boundingRect();
- am.translate(br.width() / 2., br.height() / 2);
- am.rotate(180, (flip & QSimpleCanvasItem::VerticalFlip)?1:0, (flip & QSimpleCanvasItem::HorizontalFlip)?1:0, 0);
- am.translate(-br.width() / 2., -br.height() / 2);
- }
-
- childData->transformValid = true;
- }
-}
-
-#define QSIMPLECANVAS_DISABLE_TREE_CLIPPING
-QRectF QSimpleCanvasItemPrivate::setupPainting(int version, int &z, QSimpleCanvasItem **opaqueList)
-{
- static QRectF scene(-1., -1., 2., 2.);
- Q_Q(QSimpleCanvasItem);
-
- bool hasContents = options & QSimpleCanvasItem::HasContents;
-
- QSimpleCanvasItemData *myData = data();
-
- QRectF rv;
- if (hasContents) {
- QRectF filteredBoundRect = q->boundingRect();
- if (filter)
- filteredBoundRect = filter->itemBoundingRect(filteredBoundRect);
- const QMatrix4x4 &active = myData->transformActive;
-
- rv = active.mapRect(filteredBoundRect);
- }
-#ifdef QSIMPLECANVAS_DISABLE_TREE_CLIPPING
- myData->doNotPaint = false;
- myData->doNotPaintChildren = false;
-#else
- myData->doNotPaint = !hasContents || !rv.intersects(scene);
- myData->doNotPaintChildren = hasContents && myData->doNotPaint &&
- (clip != QSimpleCanvasItem::NoClip);
-#endif
-
- if (!myData->doNotPaint &&
- (options & QSimpleCanvasItem::IsOpaque) &&
- (myData->activeOpacity == 1.) &&
- (clip == 0)) {
-
- nextOpaque = *opaqueList;
- *opaqueList = q;
- myData->doNotPaint = true;
-
- }
-
- int myZ = z++;
-
- if (myData->doNotPaintChildren) {
- rv = QRectF();
- } else {
- zOrderChildren();
-
- for (int ii = 0; ii < children.count(); ++ii) {
- QSimpleCanvasItem *child = children.at(ii);
- setupChildState(child);
-
- QSimpleCanvasItemData *childData = child->d_func()->data();
- if (childData->activeOpacity != 0)
- rv |= child->d_func()->setupPainting(version, z, opaqueList);
- }
-
-#ifndef QSIMPLECANVAS_DISABLE_TREE_CLIPPING
- myData->doNotPaintChildren |= !rv.intersects(scene);
-#endif
- }
-
- myData->transformActive.translate(0, 0, myZ);
-
- myData->lastPaintRect = rv;
-
- return rv;
-}
-
-
-void QSimpleCanvasItemPrivate::paint(GLPaintParameters &oldParams, QSimpleCanvasFilter::Layer layer)
-{
- if (!layer)
- return;
-
- Q_Q(QSimpleCanvasItem);
-
- bool doNotPaintChildren = data()->doNotPaintChildren;
- if (doNotPaintChildren)
- return;
-
- GLPaintParameters params = oldParams;
-
- qreal width = params.boundingRect.width();
- qreal height = params.boundingRect.height();
-
- GLfloat vertices[] = { 0, height,
- width, height,
- 0, 0,
- width, 0 };
-
- // XXX Handle separate cliping modes
- if (clip) {
- if (params.stencilValue == 255)
- qWarning()
- << "OpenGL: Clip recursion greater than 255 not permitted.";
- glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
-
- glStencilFunc(GL_EQUAL, params.stencilValue, 0xFFFFFFFF);
- glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
-
- ConstantColorShader *shader = basicShaders()->constantColor();
- params.painter->invalidate();
- shader->enable();
- shader->setTransform(data()->transformActive);
-
- shader->setAttributeArray(ConstantColorShader::Vertices, vertices, 2);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
- glStencilFunc(GL_EQUAL, params.stencilValue + 1, 0xFFFFFFFF);
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
-
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-
- // XXX Copied from qsimplecanvas_opengl1 scissor based clipping
- QRectF r = data()->transformActive.mapRect(params.boundingRect);
- r.translate(1, 1);
- float xscale = 0.5 * float(params.sceneRect.width());
- float yscale = 0.5 * float(params.sceneRect.height());
- r.moveTo(r.x() * xscale, r.y() * yscale);
- r.setSize(QSizeF(r.width() * xscale, r.height() * yscale));
- int sr_x = int(::floorf(r.x()));
- int sr_y = int(::floorf(r.y()));
- int sr_width = int(::ceilf(r.right())) - sr_x;
- int sr_height = int(::ceilf(r.bottom())) - sr_y;
- QRect sr(sr_x, sr_y, sr_width, sr_height);
- sr.moveTo(sr.x(), params.sceneRect.height() - sr.y() - sr.height());
- sr &= params.clipRect;
- params.clipRect = sr;
- }
-
- int upto = 0;
- for (upto = 0; upto < children.count(); ++upto) {
- QSimpleCanvasItem *c = children.at(upto);
- if (c->z() < 0) {
- if (layer & QSimpleCanvasFilter::ChildrenUnderItem)
- paintChild(params, c);
- } else {
- break;
- }
- }
-
- bool doNotPaint = data()->doNotPaint;
-
- if (!doNotPaint && layer & QSimpleCanvasFilter::Item) {
- QSimpleCanvasItem::GLPainter &painter = *params.painter;
- painter.item = q;
- painter.activeTransform = data()->transformActive;
- painter.activeOpacity = data()->activeOpacity;
- painter.sceneClipRect = params.clipRect;
-
- q->paintGLContents(painter);
- }
-
- if (layer & QSimpleCanvasFilter::ChildrenAboveItem) {
- for (; upto < children.count(); ++upto) {
- QSimpleCanvasItem *c = children.at(upto);
- paintChild(params, c);
- }
- }
-
- if (clip) {
- glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
- glStencilFunc(GL_EQUAL, params.stencilValue + 1, 0xFFFFFFFF);
- glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
-
- params.painter->invalidate();
- ConstantColorShader *shader = basicShaders()->constantColor();
- shader->enable();
- shader->setTransform(data()->transformActive);
-
- shader->setAttributeArray(ConstantColorShader::Vertices, vertices, 2);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
- glStencilFunc(GL_EQUAL, params.stencilValue, 0xFFFFFFFF);
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- }
-}
-
-enum ShaderType { ST_None, ST_SingleTexture, ST_SingleTextureOpacity, ST_Color };
-
-QSimpleCanvasItem::GLPainter::GLPainter()
-: item(0), activeOpacity(1), blendEnabled(true), flags(0)
-{
-}
-
-QSimpleCanvasItem::GLPainter::GLPainter(QSimpleCanvasItem *i)
-: item(i), activeOpacity(1), blendEnabled(true), flags(0)
-{
-}
-
-QGLShaderProgram *QSimpleCanvasItem::GLPainter::useTextureShader()
-{
- if (activeOpacity == 1.) {
- SingleTextureShader *shader = item->basicShaders()->singleTexture();
- if (flags != ST_SingleTexture) {
- shader->enable();
- flags = ST_SingleTexture;
- }
-
- shader->setTransform(activeTransform);
- return shader;
- } else {
- SingleTextureOpacityShader *shader = item->basicShaders()->singleTextureOpacity();
-
- if (flags != ST_SingleTextureOpacity) {
- shader->enable();
- flags = ST_SingleTextureOpacity;
- }
-
- shader->setTransform(activeTransform);
- shader->setOpacity(activeOpacity);
- return shader;
- }
-}
-
-void QSimpleCanvasItem::GLPainter::invalidate()
-{
- flags = ST_None;
-}
-
-QGLShaderProgram *QSimpleCanvasItem::GLPainter::useColorShader(const QColor &color)
-{
- QColor c = color;
-
- ConstantColorShader *shader = item->basicShaders()->constantColor();
-
- if (flags != ST_Color) {
- shader->enable();
- flags = ST_Color;
- }
-
- if (activeOpacity != 1.)
- c.setAlpha(int(c.alpha() * activeOpacity));
-
- shader->setColor(c);
- shader->setTransform(activeTransform);
-
- return shader;
-}
-
-void QSimpleCanvasItem::GLPainter::drawPixmap(const QPointF &point,
- const GLTexture &texture)
-{
- drawPixmap(QRectF(point, QSizeF(texture.width(), texture.height())), texture);
-}
-
-void QSimpleCanvasItem::GLPainter::drawPixmap(const QRectF &rect,
- const GLTexture &img)
-{
- QGLShaderProgram *shader = useTextureShader();
-
- GLfloat vertices[8];
- GLfloat texVertices[8];
-
- float widthV = img.width();
- float heightV = img.height();
-
- vertices[0] = rect.x(); vertices[1] = rect.y()+heightV;
- vertices[2] = rect.x()+widthV; vertices[3] = rect.y()+heightV;
- vertices[4] = rect.x(); vertices[5] = rect.y();
- vertices[6] = rect.x()+widthV; vertices[7] = rect.y();
-
- texVertices[0] = 0; texVertices[1] = 0;
- texVertices[2] = 1; texVertices[3] = 0;
- texVertices[4] = 0; texVertices[5] = 1;
- texVertices[6] = 1; texVertices[7] = 1;
-
- shader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2);
- shader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2);
-
- glBindTexture(GL_TEXTURE_2D, img.texture());
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-}
-
-void QSimpleCanvasItem::GLPainter::fillRect(const QRectF &rect,
- const QColor &color)
-{
- if (color.alpha() == 0xFF)
- glDisable(GL_BLEND);
-
- QGLShaderProgram *shader = useColorShader(color);
- float x = rect.x();
- float y = rect.y();
- float width = rect.width();
- float height = rect.height();
-
- GLfloat vertices[] = { x, height,
- width, height,
- x, y,
-
- width, height,
- x, y,
- width, y };
-
- shader->setAttributeArray(ConstantColorShader::Vertices, vertices, 2);
- glDrawArrays(GL_TRIANGLES, 0, 6);
-
- if (color.alpha() == 0xFF)
- glEnable(GL_BLEND);
-}
-
-void QSimpleCanvasItem::CachedTexture::addRef()
-{
- ++r;
-}
-
-void QSimpleCanvasItem::CachedTexture::release()
-{
- Q_ASSERT(r > 0);
- --r;
-
- if (r == 0) {
- if (!s.isEmpty())
- d->cachedTextures.remove(s);
- delete this;
- }
-}
-
-int QSimpleCanvasItem::CachedTexture::pixmapWidth() const
-{
- return w;
-}
-
-int QSimpleCanvasItem::CachedTexture::pixmapHeight() const
-{
- return h;
-}
-
-QSimpleCanvasItem::CachedTexture::CachedTexture()
-: r(0), w(0), h(0)
-{
-}
-
-QSimpleCanvasItem::CachedTexture *
-QSimpleCanvasItem::cachedTexture(const QString &key)
-{
- Q_D(QSimpleCanvasItem);
- if (!d->canvas || key.isEmpty())
- return 0;
-
- QSimpleCanvasPrivate *canvas = d->canvas->d;
- QHash<QString, QSimpleCanvasItem::CachedTexture *>::ConstIterator iter =
- canvas->cachedTextures.find(key);
- if (iter != canvas->cachedTextures.end()) {
- (*iter)->addRef();
- return (*iter);
- } else {
- return 0;
- }
-}
-
-QSimpleCanvasItem::CachedTexture *
-QSimpleCanvasItem::cachedTexture(const QString &key, const QPixmap &pix)
-{
- Q_D(QSimpleCanvasItem);
- if (!d->canvas)
- return 0;
-
- QSimpleCanvasPrivate *canvas = d->canvas->d;
- QHash<QString, QSimpleCanvasItem::CachedTexture *>::ConstIterator iter =
- canvas->cachedTextures.end();
- if (!key.isEmpty())
- iter = canvas->cachedTextures.find(key);
-
- if (iter != canvas->cachedTextures.end()) {
- (*iter)->addRef();
- return (*iter);
- } else {
- CachedTexture *rv = new CachedTexture;
- rv->s = key;
- rv->d = canvas;
- rv->w = pix.width();
- rv->h = pix.height();
- rv->setImage(pix.toImage(), GLTexture::PowerOfTwo);
- rv->setHorizontalWrap(GLTexture::Repeat);
- rv->setVerticalWrap(GLTexture::Repeat);
- rv->addRef();
- if (!key.isEmpty())
- canvas->cachedTextures.insert(key, rv);
- return rv;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/canvas/qsimplecanvas_opengl1.cpp b/src/declarative/canvas/qsimplecanvas_opengl1.cpp
deleted file mode 100644
index 6e50ef8..0000000
--- a/src/declarative/canvas/qsimplecanvas_opengl1.cpp
+++ /dev/null
@@ -1,401 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsimplecanvas.h"
-#include "qsimplecanvas_p.h"
-#include "qsimplecanvasitem_p.h"
-#include "qsimplecanvasfilter_p.h"
-#include <gltexture.h>
-#include <glsave.h>
-#include <math.h>
-
-
-QT_BEGIN_NAMESPACE
-void CanvasEGLWidget::updateGL()
-{
- _clip = QRect();
- QGLWidget::updateGL();
-}
-
-void CanvasEGLWidget::updateGL(const QRect &r)
-{
- if (r.isEmpty())
- return;
-
- _clip = r;
- QGLWidget::updateGL();
-}
-
-void CanvasEGLWidget::paintGL()
-{
- if (!_clip.isEmpty()) {
- glEnable(GL_SCISSOR_TEST);
- glScissor(_clip.x(), _clip.y(), _clip.width(), _clip.height());
- } else {
- glDisable(GL_SCISSOR_TEST);
- }
-
- glDepthMask(GL_TRUE);
- glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glDepthMask(GL_FALSE);
-
- _canvas->paintGL();
-}
-
-QRect CanvasEGLWidget::map(const QRectF &f)
-{
- return invDefaultTransform.mapRect(f).toAlignedRect();
-}
-
-void CanvasEGLWidget::resizeGL(int w, int h)
-{
- glViewport(0, 0, w, h);
-}
-
-void CanvasEGLWidget::resizeEvent(QResizeEvent *e)
-{
- defaultTransform.identity();
- defaultTransform.flipCoordinates();
- defaultTransform.translate(-1, -1, 0);
- defaultTransform.scale(2. / width(), 2. / height(), -2. / 65536.);
- invDefaultTransform = defaultTransform.inverted();
- _canvas->root->d_func()->transformActive = defaultTransform;
- QGLWidget::resizeEvent(e);
-}
-
-void CanvasEGLWidget::initializeGL()
-{
- glEnable(GL_BLEND);
- glEnable(GL_DEPTH_TEST);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glDepthFunc(GL_GREATER);
-#ifdef QT_OPENGL_ES
- glClearDepthf(0);
-#else
- glClearDepth(0);
-#endif
-}
-
-void QSimpleCanvasPrivate::paintGL()
-{
- lrpTimer.start();
-
- QSimpleCanvasItemPrivate::GLPaintParameters p;
- p.sceneRect = QRect(0, 0, q->width(), q->height());
- p.clipRect = p.sceneRect;
- p.opacity = 1;
- p.forceParamRefresh = false;
- if (!isSetup) {
- unsigned int zero = 0;
- root->d_func()->setupPainting(0, QRect(), &zero);
- }
- root->d_func()->paint(p);
-
- lrpTime = lrpTimer.elapsed();
-}
-
-QSimpleCanvas::Matrix QSimpleCanvasItemPrivate::localTransform() const
-{
- Q_Q(const QSimpleCanvasItem);
-
- QSimpleCanvas::Matrix trans;
- trans.translate(q->x(), q->y());
- QPointF to = transformOrigin();
- trans.translate(to.x(), to.y());
- trans.scale(q->scale().value(), q->scale().value());
- trans.translate(-to.x(), -to.y());
- trans *= transformUser;
- return trans;
-}
-
-void QSimpleCanvasItemPrivate::simplePaintChild(const GLPaintParameters &params, QSimpleCanvasItem *child)
-{
- GLPaintParameters childParams = params;
-
- if (child->d_func()->activeOpacity != 0) {
- childParams.boundingRect = child->boundingRect();
- child->d_func()->paint(childParams);
- }
-}
-
-void QSimpleCanvasItemPrivate::paintChild(const GLPaintParameters &params,
- QSimpleCanvasItem *child)
-{
- if (params.forceParamRefresh) {
- QSimpleCanvas::Matrix t = child->d_func()->transformActive;
- qreal o = child->d_func()->activeOpacity;
- setupChildState(child);
- simplePaintChild(params, child);
- child->d_func()->transformActive = t;
- child->d_func()->activeOpacity = o;
- } else {
- simplePaintChild(params, child);
- }
-}
-
-
-void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child)
-{
- qreal visible = child->visible().value();
- child->d_func()->activeOpacity = activeOpacity;
- if (visible != 1)
- child->d_func()->activeOpacity *= visible;
-
- if (child->d_func()->activeOpacity != 0) {
- // Calculate child's transform
- qreal x = child->x();
- qreal y = child->y();
- qreal scale = child->scale().value();
- QSimpleCanvasItem::Flip flip = child->flip();
-
- QSimpleCanvas::Matrix &am = child->d_func()->transformActive;
- am = transformActive;
- if (x != 0 || y != 0)
- am.translate(x, y);
- if (scale != 1) {
- QPointF to = child->d_func()->transformOrigin();
- if (to.x() != 0. || to.y() != 0.)
- am.translate(to.x(), to.y());
- am.scale(scale, scale);
- if (to.x() != 0. || to.y() != 0.)
- am.translate(-to.x(), -to.y());
- }
- if (child->d_func()->transformUserSet)
- am *= child->d_func()->transformUser;
- if (flip) {
- QRectF br = child->boundingRect();
- am.translate(br.width() / 2., br.height() / 2);
- am.rotate(180, (flip & QSimpleCanvasItem::VerticalFlip)?1:0, (flip & QSimpleCanvasItem::HorizontalFlip)?1:0, 0);
- am.translate(-br.width() / 2., -br.height() / 2);
- }
- }
-}
-
-QRectF QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &bounding, unsigned int *zero)
-{
- Q_Q(QSimpleCanvasItem);
-
- QRectF rv = transformActive.mapRect(q->boundingRect());
-
- unsigned int oldZero = *zero;
-
- for (int ii = 0; ii < children.count(); ++ii) {
- QSimpleCanvasItem *child = children.at(ii);
- setupChildState(child);
-
- if (child->d_func()->activeOpacity != 0)
- rv |= child->d_func()->setupPainting(version, bounding, zero);
- }
-
- if (clip || oldZero != *zero)
- (*zero)++;
- transformActive.translate(0, 0, *zero);
-
- lastPaintRect = rv;
- return rv;
-}
-
-void QSimpleCanvasItemPrivate::paintNoClip(GLPaintParameters &params, QSimpleCanvasFilter::Layer layer)
-{
- Q_Q(QSimpleCanvasItem);
-
- zOrderChildren();
-
- int upto = 0;
- for (upto = 0; upto < children.count(); ++upto) {
- QSimpleCanvasItem *c = children.at(upto);
- if (c->zValue().value() < 0) {
- if (layer & QSimpleCanvasFilter::ChildrenUnderItem)
- paintChild(params, c);
- } else {
- break;
- }
- }
-
- if (layer & QSimpleCanvasFilter::Item &&
- q->options() & QSimpleCanvasItem::HasContents) {
- QSimpleCanvasItem::GLPainter painter(q);
- painter.activeTransform = transformActive;
- painter.activeOpacity = activeOpacity;
- painter.sceneClipRect = params.clipRect;
-
- q->paintGLContents(painter);
- }
-
- if (layer & QSimpleCanvasFilter::ChildrenAboveItem) {
- for (; upto < children.count(); ++upto) {
- QSimpleCanvasItem *c = children.at(upto);
- paintChild(params, c);
- }
- }
-}
-
-void QSimpleCanvasItemPrivate::paint(GLPaintParameters &params, QSimpleCanvasFilter::Layer layer)
-{
- if (!layer)
- return;
-
- // XXX Handle separate cliping modes
- if (clip) {
-
- GLSaveScissor ss;
- qreal width = params.boundingRect.width();
- qreal height = params.boundingRect.height();
- float margin = width + height;
-
- GLfloat clipvertices[] =
- {
- -margin, -margin,
- margin, -margin,
- margin, 0,
-
- -margin, -margin,
- -margin, 0,
- margin, 0,
-
- -margin, 0,
- -margin, margin,
- 0, 0,
-
- 0, 0,
- 0, margin,
- -margin, margin,
-
- 0, height,
- 0, margin,
- margin, margin,
-
- margin, margin,
- 0, height,
- margin, height,
-
- width, 0,
- margin, 0,
- margin, height,
-
- margin, height,
- width, height,
- width, 0
- };
-
- QRectF r = transformActive.mapRect(params.boundingRect);
- r.translate(1, 1);
- float xscale = 0.5 * float(params.sceneRect.width());
- float yscale = 0.5 * float(params.sceneRect.height());
- r.moveTo(r.x() * xscale, r.y() * yscale);
- r.setSize(QSizeF(r.width() * xscale, r.height() * yscale));
-
- glEnable(GL_SCISSOR_TEST);
- int sr_x = ::floorf(r.x());
- int sr_y = ::floorf(r.y());
- int sr_width = ::ceilf(r.right()) - sr_x;
- int sr_height = ::ceilf(r.bottom()) - sr_y;
-
- QRect sr(sr_x, sr_y, sr_width, sr_height);
- if (ss.wasEnabled())
- sr &= ss.rect();
-
- glScissor(sr.x(), sr.y(), sr.width(), sr.height());
-
- {
- glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf(transformActive.data());
- glDepthMask(GL_TRUE);
- glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, clipvertices);
- glDrawArrays(GL_TRIANGLES, 0, 24);
- glDisableClientState(GL_VERTEX_ARRAY);
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- glDepthMask(GL_FALSE);
- }
-
- GLPaintParameters newParams = params;
- newParams.clipRect = sr;
- newParams.clipRect.moveTo(sr.x(), params.sceneRect.height() - sr.y() - sr.height());
- paintNoClip(newParams, layer);
- } else {
- paintNoClip(params, layer);
- }
-}
-
-QGLShaderProgram *QSimpleCanvasItem::GLPainter::useTextureShader()
-{
- qFatal("Cannot call QSimpleCanvasItem::GLPainter::useTextureShader() when using OpenGL ES 1.1");
- return 0;
-}
-
-QGLShaderProgram *QSimpleCanvasItem::GLPainter::useColorShader(const QColor &color)
-{
- Q_UNUSED(color);
- qFatal("Cannot call QSimpleCanvasItem::GLPainter::useColorShader() when using OpenGL ES 1.1");
- return 0;
-}
-
-GLBasicShaders *QSimpleCanvasItemPrivate::basicShaders() const
-{
- qFatal("Cannot call QSimpleCanvasItem::basicShaders() when using OpenGL ES 1.1");
- return 0;
-}
-
-QGLFramebufferObject *QSimpleCanvasPrivate::acquire(int, int)
-{
- return 0;
-}
-
-void QSimpleCanvasPrivate::release(QGLFramebufferObject *)
-{
-}
-
-void QSimpleCanvasItem::GLPainter::drawPixmap(const QPointF &point,
- const GLTexture &texture)
-{
- drawPixmap(QRectF(point, QSizeF(texture.width(), texture.height())), texture);
-}
-
-void QSimpleCanvasItem::GLPainter::drawPixmap(const QRectF &rect,
- const GLTexture &img)
-{
- qFatal("Cannot call QSimpleCanvasItem::GLPainter::drawPixmap() when using OpenGL ES 1.1");
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/canvas/qsimplecanvas_p.h b/src/declarative/canvas/qsimplecanvas_p.h
index 3a0186e..cd76b22 100644
--- a/src/declarative/canvas/qsimplecanvas_p.h
+++ b/src/declarative/canvas/qsimplecanvas_p.h
@@ -47,41 +47,6 @@
#include <qstack.h>
#include <qdatetime.h>
-#if defined(QFX_RENDER_OPENGL)
-
-#if defined(QFX_RENDER_OPENGL2)
-#include "glbasicshaders.h"
-#endif
-
-#include <QGLWidget>
-QT_BEGIN_NAMESPACE
-
-class CanvasEGLWidget : public QGLWidget
-{
-public:
- CanvasEGLWidget(QSimpleCanvas *parent, QSimpleCanvasPrivate *canvas)
- :
- QGLWidget(parent),
- _canvas(canvas)
- {
- }
-
- virtual void paintGL();
- virtual void resizeGL(int,int);
- virtual void resizeEvent(QResizeEvent *e);
- virtual void initializeGL();
-
- void updateGL();
- void updateGL(const QRect &);
-
- QRect map(const QRectF &) const;
-private:
- QRect _clip;
- QSimpleCanvasPrivate *_canvas;
- QSimpleCanvas::Matrix defaultTransform;
- QSimpleCanvas::Matrix invDefaultTransform;
-};
-#endif
#include <QGraphicsView>
#include <QGraphicsScene>
@@ -101,7 +66,6 @@ private:
QGraphicsScene _scene;
};
-class QGLFramebufferObject;
class QSimpleCanvasDebugPlugin;
class QSimpleCanvasPrivate
{
@@ -110,9 +74,6 @@ public:
: q(canvas), timer(0), root(0), lrpTime(0), debugPlugin(0), focusItem(0),
lastFocusItem(0), lastMouseItem(0),
isSetup(false), view(0)
-#if defined(QFX_RENDER_OPENGL)
- ,egl(q, this), basicShadersInstance(0)
-#endif
, paintVersion(1)
{
}
@@ -122,11 +83,7 @@ public:
bool isSimpleCanvas() const { return mode == QSimpleCanvas::SimpleCanvas; }
bool isGraphicsView() const { return mode == QSimpleCanvas::GraphicsView; }
-#if defined(QFX_RENDER_OPENGL)
- QRectF oldDirty;
-#else
QRect oldDirty;
-#endif
QRect resetDirty();
void paint(QPainter &p);
@@ -174,27 +131,6 @@ public:
QSimpleCanvasGraphicsView *view;
-#if defined(QFX_RENDER_OPENGL)
- CanvasEGLWidget egl;
- GLBasicShaders *basicShaders() const
- {
-#if defined(QFX_RENDER_OPENGL2)
- if (!basicShadersInstance)
- basicShadersInstance = new GLBasicShaders;
- return basicShadersInstance;
-#else
- return 0;
-#endif
- }
- mutable GLBasicShaders *basicShadersInstance;
-
- QHash<QString, QSimpleCanvasItem::CachedTexture *> cachedTextures;
-
- QList<QGLFramebufferObject *> frameBuffers;
- QGLFramebufferObject *acquire(int, int);
- void release(QGLFramebufferObject *);
- void paintGL();
-#endif
int paintVersion;
};
diff --git a/src/declarative/canvas/qsimplecanvasdebugplugin.cpp b/src/declarative/canvas/qsimplecanvasdebugplugin.cpp
index 12088c1..91ef7dc 100644
--- a/src/declarative/canvas/qsimplecanvasdebugplugin.cpp
+++ b/src/declarative/canvas/qsimplecanvasdebugplugin.cpp
@@ -123,11 +123,7 @@ 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()
-#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/canvas/qsimplecanvasfilter.cpp b/src/declarative/canvas/qsimplecanvasfilter.cpp
deleted file mode 100644
index 5bc6b35..0000000
--- a/src/declarative/canvas/qsimplecanvasfilter.cpp
+++ /dev/null
@@ -1,323 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsimplecanvasfilter.h"
-#include "qsimplecanvasfilter_p.h"
-#include "qsimplecanvasitem_p.h"
-#include "qsimplecanvas.h"
-#include "qsimplecanvas_p.h"
-
-#if defined(QFX_RENDER_OPENGL2)
-#include <glsave.h>
-#include <QtOpenGL/qglframebufferobject.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlclass Filter
- \brief A Filter is a graphical filter that can be applied to items.
-*/
-
-QSimpleCanvasFilter::QSimpleCanvasFilter(QObject *parent)
-: QObject(parent), d(new QSimpleCanvasFilterPrivate(this))
-{
-}
-
-QSimpleCanvasFilter::~QSimpleCanvasFilter()
-{
- if (d->item) d->item->setFilter(0);
- delete d; d = 0;
-}
-
-bool QSimpleCanvasFilter::enabled() const
-{
- return d->enabled;
-}
-
-/*!
- \qmlproperty bool Filter::enabled
- \brief Controls whether the filter is applied.
-*/
-
-void QSimpleCanvasFilter::setEnabled(bool e)
-{
- if (e == d->enabled)
- return;
- d->enabled = e;
- emit enabledChanged();
- update();
-}
-
-QGLFramebufferObject *QSimpleCanvasFilter::renderToFBO(float scale, const QRectF &src, const QPoint &offset, Layer)
-{
- // XXX - respect src
-#if defined(QFX_RENDER_OPENGL2)
- Q_UNUSED(src);
- Q_UNUSED(offset);
-
- QSimpleCanvasItem *item = d->item;
- QRect br = item->itemBoundingRect();
- if (br.isEmpty())
- return 0;
- QGLFramebufferObject *fbo =
- item->canvas()->d->acquire(int(br.width() * scale), int(br.height() * scale));
-
- GLSaveViewport sv; GLSaveScissor ss;
- qreal oldOpacity = item->d_func()->data()->activeOpacity;
- item->d_func()->data()->activeOpacity = 1;
-
- fbo->bind();
-
- glClearColor(0,0,0,0);
- glEnable(GL_SCISSOR_TEST);
- glScissor(0, 0, int(br.width() * scale), int(br.height() * scale));
- glClear(GL_COLOR_BUFFER_BIT);
- glViewport(0, 0, int(br.width() * scale), int(br.height() * scale));
-
- QMatrix4x4 mat;
- mat.flipCoordinates();
- mat.translate(-1, -1, 0);
- mat.scale(2. / (br.width()), 2. / (br.height()), 1. / (1024. * 1024.));
-
- renderToScreen(mat);
-
- fbo->release();
-
- item->d_func()->data()->activeOpacity = oldOpacity;
- return fbo;
-#else
- Q_UNUSED(src);
- Q_UNUSED(offset);
- Q_UNUSED(scale);
- return 0;
-#endif
-}
-
-QGLFramebufferObject *QSimpleCanvasFilter::renderToFBO(const QRectF &src, const QPoint &offset, Layer)
-{
- // XXX - respect src
-#if defined(QFX_RENDER_OPENGL2)
- Q_UNUSED(src);
- Q_UNUSED(offset);
-
- QSimpleCanvasItem *item = d->item;
- QRect br = item->itemBoundingRect();
- if (br.isEmpty())
- return 0;
- QGLFramebufferObject *fbo =
- item->canvas()->d->acquire(br.width(), br.height());
-
- GLSaveViewport sv; GLSaveScissor ss;
- qreal oldOpacity = item->d_func()->data()->activeOpacity;
- item->d_func()->data()->activeOpacity = 1;
-
- fbo->bind();
-
- glClearColor(0,0,0,0);
- glEnable(GL_SCISSOR_TEST);
- glScissor(0, 0, br.width(), br.height());
- glClear(GL_COLOR_BUFFER_BIT);
- glViewport(0, 0, br.width(), br.height());
-
- QMatrix4x4 mat;
- mat.flipCoordinates();
- mat.translate(-1, -1, 0);
- mat.scale(2. / br.width(), 2. / br.height(), 1. / (1024. * 1024.));
-
- renderToScreen(mat);
-
- fbo->release();
-
- item->d_func()->data()->activeOpacity = oldOpacity;
- return fbo;
-#else
- Q_UNUSED(src);
- Q_UNUSED(offset);
- return 0;
-#endif
-}
-
-QGLFramebufferObject *QSimpleCanvasFilter::acquireFBO(const QSize &s)
-{
-#if defined(QFX_RENDER_OPENGL2)
- QSize size;
- QSimpleCanvasItem *item = d->item;
- if (size.isNull()) {
- QRect br = item->itemBoundingRect();
- size = br.size();
- } else {
- size = s;
- }
-
- QGLFramebufferObject *fbo =
- item->canvas()->d->acquire(s.width(), s.height());
-
- return fbo;
-#else
- Q_UNUSED(s);
- return 0;
-#endif
-}
-
-void QSimpleCanvasFilter::releaseFBO(QGLFramebufferObject *fbo)
-{
-#if defined(QFX_RENDER_OPENGL2)
- d->item->d_func()->canvas->d->release(fbo);
-#else
- Q_UNUSED(fbo);
-#endif
-}
-
-void QSimpleCanvasFilter::renderToScreen(const QRectF &src, Layer layer)
-{
- // XXX - respect src
-#if defined(QFX_RENDER_OPENGL2)
- Q_UNUSED(src);
- Q_UNUSED(layer);
- d->item->d_func()->paint(d->params, layer);
-#else
- Q_UNUSED(src);
- Q_UNUSED(layer);
-#endif
-}
-
-void QSimpleCanvasFilter::renderToScreen(const QSimpleCanvas::Matrix &trans, const QRectF &src, Layer layer)
-{
- // XXX - respect src
-#if defined(QFX_RENDER_OPENGL2)
- Q_UNUSED(src);
- QSimpleCanvas::Matrix old = d->item->d_func()->data()->transformActive;
- d->item->d_func()->data()->transformActive = trans;
- QSimpleCanvasItemPrivate::GLPaintParameters params = d->params;
- params.forceParamRefresh = true;
- d->item->d_func()->paint(params, layer);
- d->item->d_func()->data()->transformActive = old;
-#else
- Q_UNUSED(trans);
- Q_UNUSED(src);
- Q_UNUSED(layer);
-#endif
-}
-
-QSimpleCanvasItem *QSimpleCanvasFilter::item() const
-{
- return d->item;
-}
-
-void QSimpleCanvasFilter::setItem(QSimpleCanvasItem *i)
-{
- if (d->item == i)
- return;
- if (d->item) {
- d->item->setFilter(0);
- d->item = 0;
- }
-
- if (i->filter() != this) {
- i->setFilter(this);
- } else {
- d->item = i;
- }
-}
-
-#if defined(QFX_RENDER_OPENGL2)
-void QSimpleCanvasFilterPrivate::doFilterGL(QSimpleCanvasItem::GLPainter &p, const QSimpleCanvasItemPrivate::GLPaintParameters &prms)
-{
- params = prms;
- q->filterGL(p);
-}
-#endif
-
-QRectF QSimpleCanvasFilter::itemBoundingRect(const QRectF &r) const
-{
- return r;
-}
-
-void QSimpleCanvasFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
-{
- Q_UNUSED(p);
-}
-
-void QSimpleCanvasFilter::filter(QPainter &)
-{
-}
-
-void QSimpleCanvasFilter::update()
-{
- if (d->item)
- d->item->update();
-}
-
-#if defined(QFX_RENDER_OPENGL2)
-bool QSimpleCanvasFilterPrivate::isSimpleItem(QSimpleCanvasItem *item, QSimpleCanvasItem **out, QSimpleCanvas::Matrix *mout)
-{
- if (item->options() & QSimpleCanvasItem::SimpleItem && !item->hasChildren()) {
- *out = item;
- return true;
- } else if (!(item->options() & QSimpleCanvasItem::HasContents) &&
- item->children().count() == 1) {
- QSimpleCanvasItem *child = item->children().first();
- if (child->filter() && child->filter()->enabled())
- return false;
- bool rv = isSimpleItem(child, out, mout);
- if (rv)
- *mout *= child->d_func()->localTransform();
- return rv;
- } else {
- return false;
- }
-}
-#endif
-
-bool QSimpleCanvasFilter::isSimpleItem(QSimpleCanvasItem **out, QSimpleCanvas::Matrix *mout)
-{
-#if defined(QFX_RENDER_OPENGL2)
- return d->isSimpleItem(item(), out, mout);
-#else
- Q_UNUSED(out);
- Q_UNUSED(mout);
-#endif
-
- return false;
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/canvas/qsimplecanvasfilter.h b/src/declarative/canvas/qsimplecanvasfilter.h
deleted file mode 100644
index 14bb765..0000000
--- a/src/declarative/canvas/qsimplecanvasfilter.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSIMPLECANVASFILTER_H
-#define QSIMPLECANVASFILTER_H
-
-#include <QtCore/qobject.h>
-#include <QtDeclarative/qfxglobal.h>
-#include <QtDeclarative/qsimplecanvasitem.h>
-#include <QtDeclarative/qsimplecanvas.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-class QSimpleCanvasFilterPrivate;
-class QRectF;
-class QPoint;
-class QGLFramebufferObject;
-class GLShaderProgram;
-class Q_DECLARATIVE_EXPORT QSimpleCanvasFilter : public QObject
-{
-Q_OBJECT
-public:
- QSimpleCanvasFilter(QObject *parent);
- virtual ~QSimpleCanvasFilter();
-
- enum Layer { ChildrenUnderItem = 0x01,
- Item = 0x02,
- ChildrenAboveItem = 0x04,
- All = 0x07 };
-
- Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
- bool enabled() const;
- void setEnabled(bool);
-
- QSimpleCanvasItem *item() const;
- void setItem(QSimpleCanvasItem *);
-Q_SIGNALS:
- void enabledChanged();
-
-protected:
-
- virtual QRectF itemBoundingRect(const QRectF &) const;
- virtual void filterGL(QSimpleCanvasItem::GLPainter &p);
- virtual void filter(QPainter &p);
-
- QGLFramebufferObject *renderToFBO(const QRectF &src = QRect(), const QPoint &offset = QPoint(), Layer = All);
- QGLFramebufferObject *renderToFBO(float scale, const QRectF &src = QRect(), const QPoint &offset = QPoint(), Layer = All);
- QGLFramebufferObject *acquireFBO(const QSize & = QSize());
- void releaseFBO(QGLFramebufferObject *);
-
- void renderToScreen(const QRectF &src = QRect(), Layer = All);
- void renderToScreen(const QSimpleCanvas::Matrix &trans, const QRectF &src = QRect(), Layer = All);
-
- void update();
-
- bool isSimpleItem(QSimpleCanvasItem **, QSimpleCanvas::Matrix *);
-
-private:
- friend class QSimpleCanvasFilterPrivate;
- friend class QSimpleCanvasItemPrivate;
- friend class QSimpleCanvasItem;
-
- QSimpleCanvasFilterPrivate *d;
-};
-
-
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-#endif
diff --git a/src/declarative/canvas/qsimplecanvasfilter_p.h b/src/declarative/canvas/qsimplecanvasfilter_p.h
deleted file mode 100644
index 1c72993..0000000
--- a/src/declarative/canvas/qsimplecanvasfilter_p.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSIMPLECANVASFILTER_P_H
-#define QSIMPLECANVASFILTER_P_H
-
-#include "qsimplecanvasitem.h"
-#include "qsimplecanvasitem_p.h"
-
-
-QT_BEGIN_NAMESPACE
-class QSimpleCanvasFilterPrivate
-{
-public:
- QSimpleCanvasFilterPrivate(QSimpleCanvasFilter *_q)
- : q(_q), item(0), enabled(true) {}
-
- QSimpleCanvasFilter *q;
-
- QSimpleCanvasItem *item;
- bool enabled;
-#if defined(QFX_RENDER_OPENGL)
- QSimpleCanvasItemPrivate::GLPaintParameters params;
-
- void doFilterGL(QSimpleCanvasItem::GLPainter &, const QSimpleCanvasItemPrivate::GLPaintParameters &);
-
- bool isSimpleItem(QSimpleCanvasItem *item, QSimpleCanvasItem **out, QSimpleCanvas::Matrix *mout);
-#endif
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp
index cbdc324..f53ae72 100644
--- a/src/declarative/canvas/qsimplecanvasitem.cpp
+++ b/src/declarative/canvas/qsimplecanvasitem.cpp
@@ -199,20 +199,6 @@ void QSimpleCanvasItem::paintContents(QPainter &)
{
}
-void QSimpleCanvasItem::paintGLContents(GLPainter &)
-{
-}
-
-uint QSimpleCanvasItem::glSimpleItemData(float *vertices, float *texVertices,
- GLTexture **texture, uint count)
-{
- Q_UNUSED(vertices);
- Q_UNUSED(texVertices);
- Q_UNUSED(texture);
- Q_UNUSED(count);
- return 0;
-}
-
void QSimpleCanvasItem::canvasChanged()
{
}
@@ -229,15 +215,6 @@ void QSimpleCanvasItem::parentChanged(QSimpleCanvasItem *, QSimpleCanvasItem *)
{
}
-GLBasicShaders *QSimpleCanvasItem::basicShaders() const
-{
-#if defined(QFX_RENDER_OPENGL2)
- return canvas()->d->basicShaders();
-#else
- return 0;
-#endif
-}
-
/*!
Returns the item's (0, 0) point relative to its parent.
*/
@@ -668,27 +645,6 @@ void QSimpleCanvasItem::remChild(QSimpleCanvasItem *c)
childrenChanged();
}
-QSimpleCanvasFilter *QSimpleCanvasItem::filter() const
-{
- Q_D(const QSimpleCanvasItem);
- return d->filter;
-}
-
-/*!
-QSimpleCanvasItem takes ownership of filter.
-*/
-void QSimpleCanvasItem::setFilter(QSimpleCanvasFilter *f)
-{
- Q_D(QSimpleCanvasItem);
- if (!d || f == d->filter)
- return;
-
- d->filter = f;
- if (d->filter)
- d->filter->setItem(this);
- update();
-}
-
const QList<QSimpleCanvasItem *> &QSimpleCanvasItem::children() const
{
Q_D(const QSimpleCanvasItem);
@@ -795,66 +751,22 @@ QRect QSimpleCanvasItem::itemBoundingRect()
QPointF QSimpleCanvasItemPrivate::adjustFrom(const QPointF &p) const
{
-#if defined(QFX_RENDER_OPENGL)
- if (!canvas)
- return p;
-
- QPointF rv(-1. + 2. * p.x() / qreal(canvas->width()),
- 1 - 2. * p.y() / qreal(canvas->height()));
-
- return rv;
-#else
return p;
-#endif
}
QRectF QSimpleCanvasItemPrivate::adjustFrom(const QRectF &r) const
{
-#if defined(QFX_RENDER_OPENGL)
- if (!canvas)
- return r;
-
- qreal width = r.width() * 2. / qreal(canvas->width());
- qreal height = r.height() * 2. / qreal(canvas->height());
- qreal x = -1. + 2. * r.x() / qreal(canvas->width());
- qreal y = 1. - 2. * r.y() / qreal(canvas->height()) - height;
-
- return QRectF(x, y, width, height);
-#else
return r;
-#endif
}
QPointF QSimpleCanvasItemPrivate::adjustTo(const QPointF &p) const
{
-#if defined(QFX_RENDER_OPENGL)
- if (!canvas)
- return p;
-
- QPointF rv(0.5 * (p.x() + 1.) * qreal(canvas->width()),
- 0.5 * (1. - p.y()) * qreal(canvas->height()));
-
- return rv;
-#else
return p;
-#endif
}
QRectF QSimpleCanvasItemPrivate::adjustTo(const QRectF &r) const
{
-#if defined(QFX_RENDER_OPENGL)
- if (!canvas)
- return r;
-
- qreal width = 0.5 * r.width() * qreal(canvas->width());
- qreal height = 0.5 * r.height() * qreal(canvas->height());
- qreal x = 0.5 * (r.x() + 1.) * qreal(canvas->width());
- qreal y = 0.5 * (1. - r.y()) * qreal(canvas->height()) - height;
-
- return QRectF(x, y, width, height);
-#else
return r;
-#endif
}
QPointF QSimpleCanvasItem::mapFromScene(const QPointF &p) const
@@ -865,20 +777,7 @@ QPointF QSimpleCanvasItem::mapFromScene(const QPointF &p) const
} else {
QPointF mp = d->adjustFrom(p);
d->freshenTransforms();
-#if defined(QFX_RENDER_OPENGL)
- // m20X + m21Y + m22Z + m23 = 1
- // Z = (1 - m23 - m20X - m21Y) / m22
-
- QMatrix4x4 inv = d->data()->transformActive.inverted();
- qreal z_s = (1 - inv(2,3) - inv(2,0) * mp.x() - inv(2, 1) * mp.y()) / inv(2, 2);
-
- QVector3D vec(mp.x(), mp.y(), z_s);
- QVector3D r = inv.map(vec);
-
- return r.toPointF();
-#else
return d->data()->transformActive.inverted().map(mp);
-#endif
}
}
@@ -890,32 +789,7 @@ QRectF QSimpleCanvasItem::mapFromScene(const QRectF &r) const
} else {
QRectF mr = d->adjustFrom(r);
d->freshenTransforms();
-#if defined(QFX_RENDER_OPENGL)
- // m20X + m21Y + m22Z + m23 = 1
- // Z = (1 - m23 - m20X - m21Y) / m22
-
- QMatrix4x4 inv = d->data()->transformActive.inverted();
- qreal tl_z_s = (1 - inv(2,3) - inv(2,0) * mr.topLeft().x() - inv(2, 1) * mr.topLeft().y()) / inv(2, 2);
- qreal tr_z_s = (1 - inv(2,3) - inv(2,0) * mr.topRight().x() - inv(2, 1) * mr.topRight().y()) / inv(2, 2);
- qreal bl_z_s = (1 - inv(2,3) - inv(2,0) * mr.bottomLeft().x() - inv(2, 1) * mr.bottomLeft().y()) / inv(2, 2);
- qreal br_z_s = (1 - inv(2,3) - inv(2,0) * mr.bottomRight().x() - inv(2, 1) * mr.bottomRight().y()) / inv(2, 2);
-
- QVector3D tl(mr.topLeft().x(), mr.topLeft().y(), tl_z_s);
- QVector3D tr(mr.topRight().x(), mr.topRight().y(), tr_z_s);
- QVector3D bl(mr.bottomLeft().x(), mr.bottomLeft().y(), bl_z_s);
- QVector3D br(mr.bottomRight().x(), mr.bottomRight().y(), br_z_s);
-
- tl = inv.map(tl); tr = inv.map(tr); bl = inv.map(bl); br = inv.map(br);
-
- qreal xmin = qMin(qMin(tl.x(), tr.x()), qMin(bl.x(), br.x()));
- qreal xmax = qMax(qMax(tl.x(), tr.x()), qMax(bl.x(), br.x()));
- qreal ymin = qMin(qMin(tl.y(), tr.y()), qMin(bl.y(), br.y()));
- qreal ymax = qMax(qMax(tl.y(), tr.y()), qMax(bl.y(), br.y()));
-
- return QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax));
-#else
return d->data()->transformActive.inverted().mapRect(mr);
-#endif
}
}
@@ -992,20 +866,12 @@ void QSimpleCanvasItemPrivate::doFreshenTransforms() const
}
Q_Q(const QSimpleCanvasItem);
-#if defined(QFX_RENDER_OPENGL)
- if (q->d_func()->data()->transformUser)
- data()->transformActive *= *q->d_func()->data()->transformUser;
-#endif
if (data()->flip) {
QRectF br = q->boundingRect();
data()->transformActive.translate(br.width() / 2., br.height() / 2);
-#if defined(QFX_RENDER_OPENGL)
- data()->transformActive.rotate(180, (data()->flip & QSimpleCanvasItem::VerticalFlip)?1:0, (data()->flip & QSimpleCanvasItem::HorizontalFlip)?1:0, 0);
-#else
data()->transformActive.scale((data()->flip & QSimpleCanvasItem::HorizontalFlip)?-1:1,
(data()->flip & QSimpleCanvasItem::VerticalFlip)?-1:1);
-#endif
data()->transformActive.translate(-br.width() / 2., -br.height() / 2);
}
}
@@ -1345,8 +1211,6 @@ QSimpleCanvasItem::~QSimpleCanvasItem()
if (prnt && d->canvas->d->focusPanelData.value(prnt) == this)
d->canvas->d->focusPanelData.remove(prnt);
}
- if (d->filter)
- delete d->filter;
qDeleteAll(children());
if (parent())
@@ -1372,8 +1236,6 @@ QSimpleCanvasItem::~QSimpleCanvasItem()
delete child;
}
- delete d->filter;
-
if (parent() && d->data_ptr && d->data()->dirty) {
QSimpleCanvasLayer *l = parent()->layer();
if (l) {
diff --git a/src/declarative/canvas/qsimplecanvasitem.h b/src/declarative/canvas/qsimplecanvasitem.h
index dce3007..74841ea 100644
--- a/src/declarative/canvas/qsimplecanvasitem.h
+++ b/src/declarative/canvas/qsimplecanvasitem.h
@@ -45,9 +45,6 @@
#include <QtDeclarative/qfxglobal.h>
#include <QtDeclarative/qmldebuggerstatus.h>
#include <QtDeclarative/qsimplecanvas.h>
-#if defined(QFX_RENDER_OPENGL)
-#include <QtDeclarative/gltexture.h>
-#endif
#include <QtCore/qobject.h>
#include <QtGui/qgraphicsitem.h>
@@ -66,9 +63,6 @@ class QSimpleCanvasLayer;
class QPointF;
class QRectF;
class QGraphicsSceneHoverEvent;
-class QSimpleCanvasFilter;
-class GLTexture;
-class QGLShaderProgram;
class Q_DECLARATIVE_EXPORT QSimpleCanvasItem : public QObject
{
@@ -168,39 +162,9 @@ public:
QRect itemBoundingRect();
- class GLPainter
- {
- public:
- GLPainter();
- GLPainter(QSimpleCanvasItem *i);
- QSimpleCanvasItem *item;
- QSimpleCanvas::Matrix activeTransform;
- qreal activeOpacity;
- QRect sceneClipRect;
-
- QGLShaderProgram *useTextureShader();
- QGLShaderProgram *useColorShader(const QColor &);
- void drawPixmap(const QPointF &, const GLTexture &);
- void drawPixmap(const QRectF &, const GLTexture &);
- void fillRect(const QRectF &, const QColor &);
-
- void invalidate();
-
- bool blendEnabled;
-
- private:
- int flags;
- GLPainter(const GLPainter &);
- GLPainter &operator=(const GLPainter &);
- };
-
-
void setPaintMargin(qreal margin);
QRectF boundingRect() const;
virtual void paintContents(QPainter &);
- virtual void paintGLContents(GLPainter &);
- virtual uint glSimpleItemData(float *vertices, float *texVertices,
- GLTexture **texture, uint count);
void update();
@@ -217,9 +181,6 @@ public:
QSimpleCanvas::Matrix transform() const;
void setTransform(const QSimpleCanvas::Matrix &);
- QSimpleCanvasFilter *filter() const;
- void setFilter(QSimpleCanvasFilter *);
-
QSimpleCanvasItem *mouseGrabberItem() const;
void ungrabMouse();
void grabMouse();
@@ -238,30 +199,6 @@ public:
static QSimpleCanvasItem *findPrevFocus(QSimpleCanvasItem *item);
static QSimpleCanvasItem *findNextFocus(QSimpleCanvasItem *item);
- GLBasicShaders *basicShaders() const;
-
-#if defined(QFX_RENDER_OPENGL)
- class CachedTexture : public GLTexture
- {
- public:
- void addRef();
- void release();
-
- int pixmapWidth() const;
- int pixmapHeight() const;
-
- private:
- CachedTexture();
- friend class QSimpleCanvasItem;
- QSimpleCanvasPrivate *d;
- QString s;
- int r, w, h;
- };
-
- CachedTexture *cachedTexture(const QString &);
- CachedTexture *cachedTexture(const QString &, const QPixmap &);
-#endif
-
static QPixmap string(const QString &, const QColor & = Qt::black, const QFont & = QFont());
protected:
@@ -299,12 +236,8 @@ private:
friend class QSimpleCanvas;
friend class QSimpleCanvasPrivate;
friend class QSimpleCanvasRootLayer;
- friend class QSimpleCanvasItem::GLPainter;
- friend class QSimpleCanvasFilter;
friend class QGraphicsQSimpleCanvasItem;
friend class QSimpleGraphicsItem;
- friend class CanvasEGLWidget;
- friend class QSimpleCanvasFilterPrivate;
public:
QSimpleCanvasItem(QSimpleCanvasItemPrivate &dd, QSimpleCanvasItem *parent);
diff --git a/src/declarative/canvas/qsimplecanvasitem_p.h b/src/declarative/canvas/qsimplecanvasitem_p.h
index 6c21d9f..a062054 100644
--- a/src/declarative/canvas/qsimplecanvasitem_p.h
+++ b/src/declarative/canvas/qsimplecanvasitem_p.h
@@ -45,11 +45,6 @@
#include "private/qobject_p.h"
#include "qsimplecanvas.h"
#include "qsimplecanvasitem.h"
-#include "qsimplecanvasfilter.h"
-
-#if defined(QFX_RENDER_OPENGL2)
-#include <glbasicshaders.h>
-#endif
#include "qgraphicsitem.h"
@@ -106,11 +101,7 @@ public:
float activeOpacity;
-#if defined(QFX_RENDER_OPENGL)
- QRectF lastPaintRect;
-#else
QRect lastPaintRect;
-#endif
};
class QSimpleCanvasItemDebuggerStatus : public QmlDebuggerStatus
@@ -129,14 +120,13 @@ public:
bool selected;
};
-class QSimpleCanvasFilter;
class QGraphicsQSimpleCanvasItem;
class QSimpleCanvasItemPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QSimpleCanvasItem)
public:
QSimpleCanvasItemPrivate()
- : parent(0), canvas(0), debuggerStatus(0), filter(0),
+ : parent(0), canvas(0), debuggerStatus(0),
clip(QSimpleCanvasItem::NoClip),
origin(QSimpleCanvasItem::TopLeft), options(QSimpleCanvasItem::NoOption),
focusable(false), wantsActiveFocusPanelPendingCanvas(false),
@@ -157,7 +147,6 @@ public:
QList<QSimpleCanvasItem *> children;
QSimpleCanvasItemDebuggerStatus *debuggerStatus;
- QSimpleCanvasFilter *filter;
QSimpleCanvasItem::ClipType clip:3;
QSimpleCanvasItem::TransformOrigin origin:4;
@@ -203,43 +192,9 @@ public:
void setParentInternal(QSimpleCanvasItem *);
void convertToGraphicsItem(QGraphicsItem * = 0);
-#if defined(QFX_RENDER_QPAINTER)
void paint(QPainter &);
void paintChild(QPainter &, QSimpleCanvasItem *);
QRect setupPainting(int version, const QRect &bounding);
-#else
- struct GLPaintParameters
- {
- QRect sceneRect;
- QRectF boundingRect;
- QRect clipRect;
-#if defined(QFX_RENDER_OPENGL2)
- uchar stencilValue;
-#endif
- float opacity;
- bool forceParamRefresh;
-
- QSimpleCanvasItem::GLPainter *painter;
- };
-#if defined(QFX_RENDER_OPENGL2)
- QRectF setupPainting(int version, int &z, QSimpleCanvasItem **);
-#elif defined(QFX_RENDER_OPENGL1)
- QRectF setupPainting(int version, const QRect &bounding, unsigned int *zero);
-#endif
- void setupChildState(QSimpleCanvasItem *);
-
- void paint(GLPaintParameters &, QSimpleCanvasFilter::Layer = QSimpleCanvasFilter::All);
-#if defined(QFX_RENDER_OPENGL1)
- void paintNoClip(GLPaintParameters &, QSimpleCanvasFilter::Layer = QSimpleCanvasFilter::All);
-#endif
- void paintChild(const GLPaintParameters &, QSimpleCanvasItem *);
- void simplePaintChild(const GLPaintParameters &, QSimpleCanvasItem *);
-
- inline GLBasicShaders *basicShaders() const;
-
- QSimpleCanvas::Matrix localTransform() const;
-
-#endif
QSimpleCanvasItem *nextOpaque;
diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
index 382f3cb..31830a0 100644
--- a/src/declarative/declarative.pro
+++ b/src/declarative/declarative.pro
@@ -26,6 +26,4 @@ include(widgets/widgets.pri)
include(test/test.pri)
include(debugger/debugger.pri)
-contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, opengles1):include(opengl/opengl.pri)
-
symbian:TARGET.UID3=0x2001E623
diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri
index 166ad58..801725d 100644
--- a/src/declarative/fx/fx.pri
+++ b/src/declarative/fx/fx.pri
@@ -2,7 +2,6 @@ HEADERS += \
fx/qfxanchors.h \
fx/qfxanchors_p.h \
fx/qfxanimatedimageitem.h \
- fx/qfxblendedimage.h \
fx/qfxcomponentinstance.h \
fx/qfxcomponentinstance_p.h \
fx/qfxcontentwrapper.h \
@@ -50,7 +49,6 @@ HEADERS += \
SOURCES += \
fx/qfxanchors.cpp \
fx/qfxanimatedimageitem.cpp \
- fx/qfxblendedimage.cpp \
fx/qfxcomponentinstance.cpp \
fx/qfxcontentwrapper.cpp \
fx/qfxevents.cpp \
diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp
deleted file mode 100644
index 0c93fef..0000000
--- a/src/declarative/fx/qfxblendedimage.cpp
+++ /dev/null
@@ -1,308 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qfxblendedimage.h"
-#include <QtDeclarative/qmlcontext.h>
-
-#if defined(QFX_RENDER_OPENGL2)
-#include <glbasicshaders.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlclass BlendedImage
- \brief The BlendedImage elements blends two different images depending on a blend ratio.
-
- This element can be used to simulate blur on slow devices by setting secondaryUrl with
- a pre-rendered blurred version of primaryUrl.
-
- Note that this class will only work under OpenGL. On the software canvas it will display
- only the primary image unless the blend is > 0.75, in which case it will display only the
- secondary image.
-*/
-
-/*!
- \internal
- \class QFxBlendedImage
- \brief The QFxBlendedImage blends two different images depending on a blend ratio.
-
- This class can be used to simulate blur on slow devices by setting secondaryUrl with
- a pre-rendered blurred version of primaryUrl.
-
- Note that this class will only work under OpenGL. On the software canvas it will display
- only the primary image unless the blend is > 0.75, in which case it will display only the
- secondary image.
-*/
-QFxBlendedImage::QFxBlendedImage(QFxItem *parent)
-: QFxItem(parent), _blend(0), _smooth(false), dirty(false)
-{
-#if defined(QFX_RENDER_OPENGL2)
- setOptions(HasContents);
-#endif
-}
-
-/*!
- Cancels any pending image loads and destroys the image.
-*/
-QFxBlendedImage::~QFxBlendedImage()
-{
- if (!primUrl.isEmpty())
- QFxPixmap::cancelGet(primUrl,this);
- if (!secUrl.isEmpty())
- QFxPixmap::cancelGet(secUrl,this);
-}
-
-/*!
- \qmlproperty string BlendedImage::primaryUrl
- The URL of the first image to be displayed in this item.
-*/
-QUrl QFxBlendedImage::primaryUrl() const
-{
- return primUrl;
-}
-
-void QFxBlendedImage::primaryLoaded()
-{
- primPix = QFxPixmap(primUrl);
- dirty = true;
- update();
-}
-
-void QFxBlendedImage::setPrimaryUrl(const QUrl &url)
-{
- if (primUrl == url)
- return;
- if (!primUrl.isEmpty())
- QFxPixmap::cancelGet(primUrl,this);
- Q_ASSERT(!url.isRelative());
- primUrl = url;
- if (!primUrl.isEmpty())
- QFxPixmap::get(qmlEngine(this), primUrl,this,SLOT(primaryLoaded()));
-}
-
-/*!
- \qmlproperty string BlendedImage::secondaryUrl
- The URL of the second image to be displayed in this item.
-*/
-QUrl QFxBlendedImage::secondaryUrl() const
-{
- return secUrl;
-}
-
-void QFxBlendedImage::secondaryLoaded()
-{
- secPix = QFxPixmap(secUrl);
- dirty = true;
- update();
-}
-
-void QFxBlendedImage::setSecondaryUrl(const QUrl &url)
-{
- if (secUrl == url)
- return;
- if (!secUrl.isEmpty())
- QFxPixmap::cancelGet(secUrl,this);
- Q_ASSERT(!url.isRelative());
- secUrl = url;
- if (!secUrl.isEmpty())
- QFxPixmap::get(qmlEngine(this), secUrl,this,SLOT(secondaryLoaded()));
-}
-
-/*!
- \qmlproperty real BlendedImage::blend
- The ratio used to blend the two images.
-
- If blend has a value of 0, only the first image will be displayed.
- If blend has a value of 1, only the second image will be displayed.
-*/
-qreal QFxBlendedImage::blend() const
-{
- return _blend;
-}
-
-void QFxBlendedImage::setBlend(qreal b)
-{
- _blend = b;
- update();
-}
-
-/*!
- \qmlproperty bool BlendedImage::smooth
-
- Set this property if you want the image to be smoothly filtered when scaled or
- transformed. Smooth filtering gives better visual quality, but is slower. If
- the BlendedImage is displayed at its natural size, this property has no visual or
- performance effect.
-
- \note Generally scaling artifacts are only visible if the image is stationary on
- the screen. A common pattern when animating an image is to disable smooth
- filtering at the beginning of the animation and reenable it at the conclusion.
- */
-bool QFxBlendedImage::smoothTransform() const
-{
- return _smooth;
-}
-
-void QFxBlendedImage::setSmoothTransform(bool s)
-{
- if (_smooth == s)
- return;
- _smooth = s;
- update();
-}
-
-#if defined(QFX_RENDER_QPAINTER)
-
-void QFxBlendedImage::paintContents(QPainter &p)
-{
- if (primUrl.isEmpty() && secUrl.isEmpty())
- return;
-
- if (_smooth) {
- p.save();
- p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, _smooth);
- }
-
- if (_blend < 0.75)
- p.drawPixmap(0, 0, primPix);
- else
- p.drawPixmap(0, 0, secPix);
-
- if (_smooth) {
- p.restore();
- }
-}
-
-#elif defined(QFX_RENDER_OPENGL2)
-
-void QFxBlendedImage::paintGLContents(GLPainter &p)
-{
- static DualTextureBlendShader *shader = 0;
- if (!shader)
- shader = new DualTextureBlendShader();
-
- if (dirty) {
- prim.clear();
- sec.clear();
- prim.setImage(primPix.toImage());
- sec.setImage(secPix.toImage());
-
- dirty = false;
- }
-
- if (prim.isNull() || sec.isNull()) {
-
- return;
- }
-
- GLfloat vertices[8];
- GLfloat texVertices[8];
-
- float widthV = width();
- float heightV = height();
- if (!widthV)
- widthV = qMax(primPix.width(), secPix.width());
- if (!heightV)
- heightV = qMax(primPix.height(), secPix.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;
-
- texVertices[0] = 0; texVertices[1] = 0;
- texVertices[2] = 1; texVertices[3] = 0;
- texVertices[4] = 0; texVertices[5] = 1;
- texVertices[6] = 1; texVertices[7] = 1;
-
- if (_blend == 0 || _blend == 1) {
- QGLShaderProgram *tshader = p.useTextureShader();
-
- GLTexture *tex = 0;
-
- if (_blend == 0)
- tex = &prim;
- else
- tex = &sec;
-
- tshader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2);
- tshader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2);
-
- glBindTexture(GL_TEXTURE_2D, tex->texture());
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
- tshader->disableAttributeArray(SingleTextureShader::Vertices);
- tshader->disableAttributeArray(SingleTextureShader::TextureCoords);
- } else {
-
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, prim.texture());
- glActiveTexture(GL_TEXTURE1);
- glBindTexture(GL_TEXTURE_2D, sec.texture());
-
- shader->enable();
- shader->setOpacity(1);
- qreal b = _blend;
- if (b > 1) b = 1;
- else if (b < 0) b = 0;
- shader->setBlend(b);
- shader->setTransform(p.activeTransform);
-
- shader->setAttributeArray(DualTextureBlendShader::Vertices, vertices, 2);
- shader->setAttributeArray(DualTextureBlendShader::TextureCoords, texVertices, 2);
- shader->setAttributeArray(DualTextureBlendShader::BlendTextureCoords, texVertices, 2);
-
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
- shader->disableAttributeArray(DualTextureBlendShader::Vertices);
- shader->disableAttributeArray(DualTextureBlendShader::TextureCoords);
- shader->disableAttributeArray(DualTextureBlendShader::BlendTextureCoords);
-
- glBindTexture(GL_TEXTURE_2D, 0);
- glActiveTexture(GL_TEXTURE0);
- }
-}
-#endif
-
-QML_DEFINE_TYPE(QFxBlendedImage,BlendedImage)
-
-QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxblendedimage.h b/src/declarative/fx/qfxblendedimage.h
deleted file mode 100644
index 248cc9d..0000000
--- a/src/declarative/fx/qfxblendedimage.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QFXBLENDEDIMAGE_H
-#define QFXBLENDEDIMAGE_H
-
-#include <QtDeclarative/qfxitem.h>
-#if defined(QFX_RENDER_OPENGL2)
-#include <gltexture.h>
-#endif
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class Q_DECLARATIVE_EXPORT QFxBlendedImage : public QFxItem
-{
- Q_OBJECT
-
- Q_PROPERTY(QUrl primaryUrl READ primaryUrl WRITE setPrimaryUrl)
- Q_PROPERTY(QUrl secondaryUrl READ secondaryUrl WRITE setSecondaryUrl)
- Q_PROPERTY(qreal blend READ blend WRITE setBlend)
- Q_PROPERTY(bool smooth READ smoothTransform WRITE setSmoothTransform)
-public:
- QFxBlendedImage(QFxItem *parent=0);
- ~QFxBlendedImage();
-
- QUrl primaryUrl() const;
- void setPrimaryUrl(const QUrl &);
-
- QUrl secondaryUrl() const;
- void setSecondaryUrl(const QUrl &);
-
- qreal blend() const;
- void setBlend(qreal);
-
- bool smoothTransform() const;
- void setSmoothTransform(bool);
-
-#if defined(QFX_RENDER_QPAINTER)
- void paintContents(QPainter &painter);
-#elif defined(QFX_RENDER_OPENGL2)
- void paintGLContents(GLPainter &);
-#endif
-
-private Q_SLOTS:
- void primaryLoaded();
- void secondaryLoaded();
-
-private:
- QUrl primUrl;
- QUrl secUrl;
-
- qreal _blend;
- bool _smooth;
- bool dirty;
-#if defined(QFX_RENDER_OPENGL2)
- GLTexture prim;
- GLTexture sec;
-#endif
- QPixmap primPix;
- QPixmap secPix;
-};
-QML_DECLARE_TYPE(QFxBlendedImage)
-
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-#endif // QFXBLENDEDIMAGE_H
diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp
index 4c02e74..0957c2f 100644
--- a/src/declarative/fx/qfxflipable.cpp
+++ b/src/declarative/fx/qfxflipable.cpp
@@ -220,21 +220,12 @@ void QFxFlipablePrivate::setBackTransform()
axisRotation.setAngle(rotation);
QSimpleCanvas::Matrix mat;
-#ifdef QFX_RENDER_OPENGL
- mat.translate(back->width()/2,back->height()/2, 0);
- if (back->width() && p1.x() >= p2.x())
- mat.rotate(180, 0, 1, 0);
- if (back->height() && p2.y() >= p3.y())
- mat.rotate(180, 1, 0, 0);
- mat.translate(-back->width()/2,-back->height()/2, 0);
-#else
mat.translate(back->width()/2,back->height()/2);
if (back->width() && p1.x() >= p2.x())
mat.rotate(180, Qt::YAxis);
if (back->height() && p2.y() >= p3.y())
mat.rotate(180, Qt::XAxis);
mat.translate(-back->width()/2,-back->height()/2);
-#endif
back->setTransform(mat);
}
@@ -318,21 +309,12 @@ void QFxFlipable::transformChanged(const QSimpleCanvas::Matrix &trans)
d->current = newSide;
if (d->current==Back) {
QSimpleCanvas::Matrix mat;
-#ifdef QFX_RENDER_OPENGL
- mat.translate(d->back->width()/2,d->back->height()/2, 0);
- if (d->back->width() && p1.x() >= p2.x())
- mat.rotate(180, 0, 1, 0);
- if (d->back->height() && p2.y() >= p3.y())
- mat.rotate(180, 1, 0, 0);
- mat.translate(-d->back->width()/2,-d->back->height()/2, 0);
-#else
mat.translate(d->back->width()/2,d->back->height()/2);
if (d->back->width() && p1.x() >= p2.x())
mat.rotate(180, Qt::YAxis);
if (d->back->height() && p2.y() >= p3.y())
mat.rotate(180, Qt::XAxis);
mat.translate(-d->back->width()/2,-d->back->height()/2);
-#endif
d->back->setTransform(mat);
}
if (d->front)
diff --git a/src/declarative/fx/qfxflipable.h b/src/declarative/fx/qfxflipable.h
index 6630633..f00e023 100644
--- a/src/declarative/fx/qfxflipable.h
+++ b/src/declarative/fx/qfxflipable.h
@@ -44,9 +44,6 @@
#include <QtCore/QObject>
#include <QtGui/QTransform>
-#if defined(QFX_RENDER_OPENGL)
-#include <QtGui/qmatrix4x4.h>
-#endif
#include <QtDeclarative/qfxitem.h>
QT_BEGIN_HEADER
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);
diff --git a/src/declarative/fx/qfximage.h b/src/declarative/fx/qfximage.h
index 35b921a..039334a 100644
--- a/src/declarative/fx/qfximage.h
+++ b/src/declarative/fx/qfximage.h
@@ -93,13 +93,7 @@ public:
virtual void dump(int depth);
virtual QString propertyInfo() const;
-#if defined(QFX_RENDER_QPAINTER)
void paintContents(QPainter &painter);
-#elif defined(QFX_RENDER_OPENGL)
- void paintGLContents(GLPainter &);
- uint glSimpleItemData(float *vertices, float *texVertices,
- GLTexture **texture, uint count);
-#endif
Q_SIGNALS:
void sourceChanged(const QUrl &);
diff --git a/src/declarative/fx/qfximage_p.h b/src/declarative/fx/qfximage_p.h
index 1785abb..e4a3a90 100644
--- a/src/declarative/fx/qfximage_p.h
+++ b/src/declarative/fx/qfximage_p.h
@@ -55,10 +55,6 @@
#include "qfxitem_p.h"
-#if defined(QFX_RENDER_OPENGL)
-#include "gltexture.h"
-#endif
-
QT_BEGIN_NAMESPACE
class QSvgRenderer;
@@ -73,9 +69,6 @@ class QFxImagePrivate : public QFxItemPrivate
public:
QFxImagePrivate()
: scaleGrid(0), tiled(false), smooth(false), opaque(false),
-#if defined(QFX_RENDER_OPENGL)
- texDirty(true), tex(0),
-#endif
status(QFxImage::Idle), sciReply(0), progress(0.0)
{
}
@@ -99,11 +92,6 @@ public:
bool tiled : 1;
bool smooth : 1;
bool opaque : 1;
-#if defined(QFX_RENDER_OPENGL)
- bool texDirty : 1;
- void checkDirty();
- QSimpleCanvasItem::CachedTexture *tex;
-#endif
QFxImage::Status status;
QUrl url;
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 079d691..b4de109 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -62,7 +62,6 @@
#include "qfxitem_p.h"
#include "qfxitem.h"
#include "qfxevents_p.h"
-#include <qsimplecanvasfilter.h>
#include <qmlcomponent.h>
@@ -73,7 +72,6 @@ QT_BEGIN_NAMESPACE
QML_DEFINE_NOCREATE_TYPE(QFxContents)
QML_DEFINE_TYPE(QFxItem,Item)
-QML_DEFINE_NOCREATE_TYPE(QSimpleCanvasFilter)
/*!
\group group_animation
@@ -1483,18 +1481,10 @@ void QFxItem::setRotation(qreal rotation)
if (d->_rotation == rotation)
return;
d->_rotation = rotation;
-#if defined(QFX_RENDER_OPENGL)
- QMatrix4x4 trans;
- QPointF to = transformOriginPoint();
- trans.translate(to.x(), to.y());
- trans.rotate(d->_rotation, 0, 0, 1);
- trans.translate(-to.x(), -to.y());
-#else
QPointF to = d->transformOrigin();
QTransform trans = QTransform::fromTranslate(to.x(), to.y());
trans.rotate(d->_rotation);
trans.translate(-to.x(), -to.y());
-#endif
setTransform(trans);
emit rotationChanged();
}
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index 3c872e1..3188516 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -131,7 +131,6 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QSimpleCanvasItem, public QmlParserS
Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged)
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
- Q_PROPERTY(QSimpleCanvasFilter *filter READ filter WRITE setFilter)
Q_PROPERTY(bool clip READ clip WRITE setClip)
Q_PROPERTY(bool focusable READ isFocusable WRITE setFocusable)
Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged)
@@ -269,8 +268,6 @@ private:
};
QML_DECLARE_TYPE(QFxItem)
-QML_DECLARE_TYPE(QSimpleCanvasFilter)
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/declarative/fx/qfxpainteditem.cpp b/src/declarative/fx/qfxpainteditem.cpp
index 44adba7..850f20a 100644
--- a/src/declarative/fx/qfxpainteditem.cpp
+++ b/src/declarative/fx/qfxpainteditem.cpp
@@ -49,11 +49,6 @@
#include <QApplication>
#include <QGraphicsSceneMouseEvent>
-#if defined(QFX_RENDER_OPENGL2)
-#include <QtOpenGL/qglframebufferobject.h>
-#include <glsave.h>
-#endif
-
QT_BEGIN_NAMESPACE
/*!
@@ -211,26 +206,16 @@ void QFxPaintedItem::init()
connect(this,SIGNAL(visibleChanged()),this,SLOT(clearCache()));
}
-#if defined(QFX_RENDER_QPAINTER)
/*!
\reimp
*/
void QFxPaintedItem::paintContents(QPainter &p)
-#elif defined(QFX_RENDER_OPENGL)
-/*!
- \reimp
-*/
-void QFxPaintedItem::paintGLContents(GLPainter &p)
-#else
-#error "What render?"
-#endif
{
Q_D(QFxPaintedItem);
const QRect content(QPoint(0,0),d->contentsSize);
if (content.width() <= 0 || content.height() <= 0)
return;
-#if defined(QFX_RENDER_QPAINTER)
bool oldAntiAliasing = p.testRenderHint(QPainter::Antialiasing);
bool oldSmoothPixmap = p.testRenderHint(QPainter::SmoothPixmapTransform);
if (d->smooth) {
@@ -243,29 +228,12 @@ void QFxPaintedItem::paintGLContents(GLPainter &p)
else
clipf = mapToScene(clipf);
-#elif defined(QFX_RENDER_OPENGL2)
- p.useTextureShader();
- const QRectF clipf = p.sceneClipRect;
-
-#elif defined(QFX_RENDER_OPENGL1)
- p.useTextureShader();
- const QRectF clipf = p.sceneClipRect;
-#endif
-
const QRect clip = mapFromScene(clipf).toRect();
QRegion topaint(clip);
topaint &= content;
QRegion uncached(content);
-#if defined(QFX_RENDER_OPENGL2)
- glEnableVertexAttribArray(SingleTextureShader::Vertices);
- glEnableVertexAttribArray(SingleTextureShader::TextureCoords);
-#elif defined(QFX_RENDER_OPENGL1)
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-#endif
-
int cachesize=0;
for (int i=0; i<d->imagecache.count(); ++i) {
QRect area = d->imagecache[i]->area;
@@ -312,29 +280,16 @@ void QFxPaintedItem::paintGLContents(GLPainter &p)
}
QFxPaintedItemPrivate::ImageCacheItem *newitem = new QFxPaintedItemPrivate::ImageCacheItem;
newitem->area = r;
-#if defined(QFX_RENDER_QPAINTER)
newitem->image = img;
-#else
- newitem->image.setImage(img.toImage());
-#endif
d->imagecache.append(newitem);
QRectF target(r.x(), r.y(), r.width(), r.height());
p.drawPixmap(target.toRect(), newitem->image);
}
}
-#if defined(QFX_RENDER_OPENGL2)
- glDisableVertexAttribArray(SingleTextureShader::Vertices);
- glDisableVertexAttribArray(SingleTextureShader::TextureCoords);
-#elif defined(QFX_RENDER_OPENGL1)
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-#endif
-#if defined(QFX_RENDER_QPAINTER)
if (d->smooth) {
p.setRenderHints(QPainter::Antialiasing, oldAntiAliasing);
p.setRenderHints(QPainter::SmoothPixmapTransform, oldSmoothPixmap);
}
-#endif
}
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxpainteditem.h b/src/declarative/fx/qfxpainteditem.h
index e086894..ed254ce 100644
--- a/src/declarative/fx/qfxpainteditem.h
+++ b/src/declarative/fx/qfxpainteditem.h
@@ -63,11 +63,7 @@ public:
Q_PROPERTY(QSize contentsSize READ contentsSize WRITE setContentsSize)
Q_PROPERTY(bool smooth READ isSmooth WRITE setSmooth)
-#if defined(QFX_RENDER_QPAINTER)
void paintContents(QPainter &painter);
-#elif defined(QFX_RENDER_OPENGL)
- void paintGLContents(GLPainter &);
-#endif
bool isSmooth() const;
QSize contentsSize() const;
diff --git a/src/declarative/fx/qfxpainteditem_p.h b/src/declarative/fx/qfxpainteditem_p.h
index d8d1a2a..ec507fb 100644
--- a/src/declarative/fx/qfxpainteditem_p.h
+++ b/src/declarative/fx/qfxpainteditem_p.h
@@ -56,10 +56,6 @@
#include <private/qfxitem_p.h>
#include <QtDeclarative/qsimplecanvas.h>
-#if defined(QFX_RENDER_OPENGL)
-#include "gltexture.h"
-#endif
-
QT_BEGIN_NAMESPACE
class QFxPaintedItemPrivate : public QFxItemPrivate
@@ -77,11 +73,7 @@ public:
~ImageCacheItem() { }
int age;
QRect area;
-#if defined(QFX_RENDER_QPAINTER)
QPixmap image;
-#else
- GLTexture image;
-#endif
};
QList<ImageCacheItem*> imagecache;
diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp
index 4cd34c4..5e84c88 100644
--- a/src/declarative/fx/qfxparticles.cpp
+++ b/src/declarative/fx/qfxparticles.cpp
@@ -40,9 +40,6 @@
****************************************************************************/
#include "qfxitem_p.h"
-#if defined(QFX_RENDER_OPENGL)
-#include "gltexture.h"
-#endif
#include <stdlib.h>
#include <math.h>
@@ -350,11 +347,7 @@ public:
maxX = minX = maxY = minY = 0;
}
-#if defined(QFX_RENDER_QPAINTER)
void paintContents(QPainter &p);
-#elif defined(QFX_RENDER_OPENGL2)
- void paintGLContents(GLPainter &);
-#endif
void updateSize();
@@ -375,9 +368,6 @@ public:
, angle(0), angleDev(0), velocity(0), velocityDev(0)
, addParticleTime(0), addParticleCount(0), lastAdvTime(0), stream(false), streamDelay(0)
, emitting(true), motion(0), clock(this)
-#if defined(QFX_RENDER_OPENGL)
- , texDirty(true)
-#endif
{
}
@@ -418,10 +408,6 @@ public:
QList<QFxParticle> particles;
QTickAnimationProxy<QFxParticlesPrivate, &QFxParticlesPrivate::tick> clock;
-#if defined(QFX_RENDER_OPENGL)
- bool texDirty;
- GLTexture tex;
-#endif
};
//TODO: Stop the clock if no visible particles and not emitting (restart on emittingChanged)
@@ -654,10 +640,6 @@ void QFxParticles::imageLoaded()
{
Q_D(QFxParticles);
d->image = QFxPixmap(d->url);
-#if defined(QFX_RENDER_OPENGL)
- d->texDirty = true;
- d->tex.clear();
-#endif
update();
}
@@ -673,10 +655,6 @@ void QFxParticles::setSource(const QUrl &name)
if (name.isEmpty()) {
d->url = name;
d->image = QPixmap();
-#if defined(QFX_RENDER_OPENGL)
- d->texDirty = true;
- d->tex.clear();
-#endif
update();
} else {
d->url = name;
@@ -1106,7 +1084,6 @@ void QFxParticlesPainter::updateSize(){
setY(myY);
}
-#if defined(QFX_RENDER_QPAINTER)
void QFxParticles::paintContents(QPainter &p)
{
Q_UNUSED(p);
@@ -1129,64 +1106,6 @@ void QFxParticlesPainter::paintContents(QPainter &p)
}
update();//Should I need this? (GV does)
}
-#elif defined(QFX_RENDER_OPENGL2)
-void QFxParticles::paintGLContents(GLPainter &)
-{
- //painting is done by the ParticlesPainter, so it can have the right size
-}
-
-void QFxParticlesPainter::paintGLContents(GLPainter &p)
-{
-
- if (d->image.isNull())
- return;
-
- updateSize();
-
- if (d->texDirty && !d->image.isNull()) {
- d->tex.setImage(d->image.toImage());
- d->tex.setHorizontalWrap(GLTexture::Repeat);
- d->tex.setVerticalWrap(GLTexture::Repeat);
- }
- d->texDirty = false;
-
- SingleTextureOpacityShader *shader = basicShaders()->singleTextureOpacity();
- shader->enable();
- shader->setTransform(p.activeTransform);
-
- glBindTexture(GL_TEXTURE_2D, d->tex.texture());
-
- const int myX = (int)(x() + parent()->x());
- const int myY = (int)(y() + parent()->y());
- float widthV = d->image.width();
- float heightV = d->image.height();
- for (int i = 0; i < d->particles.count(); ++i) {
- const QFxParticle &particle = d->particles.at(i);
- float left = particle.x - myX;
- float right = particle.x - myX + widthV;
- float top = particle.y - myY;
- float bottom = particle.y - myY + heightV;
-
- GLfloat vertices[] = { left, bottom,
- right, bottom,
- left, top,
- right, top };
-
- GLfloat texVertices[] = { 0, 0,
- 1, 0,
- 0, 1,
- 1, 1 };
-
- shader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2);
- shader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2);
- shader->setOpacity(particle.opacity * p.activeOpacity);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- }
-
- shader->disableAttributeArray(SingleTextureShader::Vertices);
- shader->disableAttributeArray(SingleTextureShader::TextureCoords);
-}
-#endif
void QFxParticles::componentComplete()
{
diff --git a/src/declarative/fx/qfxparticles.h b/src/declarative/fx/qfxparticles.h
index b3a569b..a0373d7 100644
--- a/src/declarative/fx/qfxparticles.h
+++ b/src/declarative/fx/qfxparticles.h
@@ -44,10 +44,6 @@
#include <QtDeclarative/qfxitem.h>
-#if defined(QFX_RENDER_OPENGL)
-#include "gltexture.h"
-#endif
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -214,11 +210,7 @@ public:
virtual void dump(int depth);
virtual QString propertyInfo() const;
-#if defined(QFX_RENDER_QPAINTER)
void paintContents(QPainter &p);
-#elif defined(QFX_RENDER_OPENGL2)
- void paintGLContents(GLPainter &);
-#endif
protected:
virtual void componentComplete();
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index fd8d9ca..03ab426 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -251,17 +251,8 @@ QFxRect::QFxRect(QFxRectPrivate &dd, QFxItem *parent)
void QFxRect::doUpdate()
{
-#if defined(QFX_RENDER_QPAINTER)
Q_D(QFxRect);
d->rectImage = QPixmap();
-#endif
-#if defined(QFX_RENDER_OPENGL)
- Q_D(QFxRect);
- if (d->rectTexture) {
- d->rectTexture->release();
- d->rectTexture = 0;
- }
-#endif
const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
setPaintMargin((pw+1)/2);
update();
@@ -361,14 +352,7 @@ void QFxRect::setRadius(qreal radius)
return;
d->radius = radius;
-#if defined(QFX_RENDER_QPAINTER)
d->rectImage = QPixmap();
-#elif defined(QFX_RENDER_OPENGL)
- if (d->rectTexture) {
- d->rectTexture->release();
- d->rectTexture = 0;
- }
-#endif
update();
}
@@ -412,15 +396,7 @@ void QFxRect::setColor(const QColor &c)
return;
d->color = c;
-#if defined(QFX_RENDER_QPAINTER)
d->rectImage = QPixmap();
-#endif
-#if defined(QFX_RENDER_OPENGL)
- if (d->rectTexture) {
- d->rectTexture->release();
- d->rectTexture = 0;
- }
-#endif
update();
}
@@ -488,7 +464,6 @@ QColor QFxRectPrivate::getColor()
}
-#if defined(QFX_RENDER_QPAINTER)
void QFxRect::generateRoundedRect()
{
Q_D(QFxRect);
@@ -528,65 +503,7 @@ void QFxRect::generateBorderedRect()
p.drawRect(qreal(pw+1)/2, qreal(pw+1)/2, d->rectImage.width()-(pw+1)/2*2, d->rectImage.height()-(pw+1)/2*2);
}
}
-#elif defined(QFX_RENDER_OPENGL)
-void QFxRect::generateRoundedRect()
-{
- Q_D(QFxRect);
- if (!d->rectTexture) {
- const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
- QString key = QString("QFxRect://r_%1_%2_%3_%4").arg(pw).arg(d->radius).arg((d->pen && d->pen->isValid())?d->pen->color().name():QString()).arg(d->color.name());
-
- d->rectTexture = cachedTexture(key);
-
- if (!d->rectTexture) {
- QPixmap roundRect(d->radius*2 + 4 + pw*2, d->radius*2 + 4 + pw*2);
- roundRect.fill(Qt::transparent);
- QPainter p(&roundRect);
- p.setRenderHint(QPainter::Antialiasing);
- if (d->pen && d->pen->isValid()) {
- QPen pn(QColor(pen()->color()), pen()->width());
- p.setPen(pn);
- } else {
- p.setPen(Qt::NoPen);
- }
- p.setBrush(d->color);
- p.drawRoundedRect((pw+1)/2, (pw+1)/2, roundRect.width()-(pw+1)/2*2, roundRect.height()-(pw+1)/2*2, d->radius, d->radius);
-
- d->rectTexture = cachedTexture(key, roundRect);
- }
- }
-}
-void QFxRect::generateBorderedRect()
-{
- Q_D(QFxRect);
- if (!d->rectTexture) {
- const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
- QString key = QString("QFxRect://b_%1_%2_%3_%4").arg(pw).arg(d->radius).arg((d->pen && d->pen->isValid())?d->pen->color().name():QString()).arg(d->color.name());
-
- d->rectTexture = cachedTexture(key);
-
- if (!d->rectTexture) {
- QPixmap borderedRect(pw*2 + 4, pw*2 + 4);
- borderedRect.fill(Qt::transparent);
- QPainter p(&(borderedRect));
- p.setRenderHint(QPainter::Antialiasing);
- if (d->pen && d->pen->isValid()) {
- QPen pn(QColor(pen()->color()), pen()->width());
- p.setPen(pn);
- } else {
- p.setPen(Qt::NoPen);
- }
- p.setBrush(d->color);
- p.drawRect(qreal(pw+1)/2, qreal(pw+1)/2, borderedRect.width()-(pw+1)/2*2, borderedRect.height()-(pw+1)/2*2);
- d->rectTexture = cachedTexture(key, borderedRect);
- }
- }
-}
-#endif
-
-
-#if defined(QFX_RENDER_QPAINTER)
void QFxRect::paintContents(QPainter &p)
{
Q_D(QFxRect);
@@ -687,258 +604,5 @@ void QFxRect::drawRect(QPainter &p)
QRect(d->rectImage.width()-xOffset, d->rectImage.height() - yOffset, xOffset, yOffset));
}
}
-#endif
-
-#if defined(QFX_RENDER_OPENGL2)
-#include "glbasicshaders.h"
-
-void QFxRect::paintGLContents(GLPainter &p)
-{
- Q_D(QFxRect);
- if (d->radius == 0 && (!d->pen || !d->pen->isValid())) {
- if (d->gradient) {
- float widthV = width();
- float heightV = height();
-
- GLfloat vertices[] = { 0, heightV,
- widthV, heightV,
- 0, 0,
- widthV, 0 };
-
- 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];
- }
-
- p.invalidate();
- ColorShader *shader = basicShaders()->color();
- shader->enable();
- shader->setTransform(p.activeTransform);
-
- shader->setAttributeArray(ColorShader::Vertices, vertices, 2);
- shader->setAttributeArray(ColorShader::Colors, colors, 4);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, count*2);
- shader->disableAttributeArray(ColorShader::Vertices);
- shader->disableAttributeArray(ColorShader::Colors);
- } else {
-
- p.fillRect(QRectF(0, 0, width(), height()), d->getColor());
-
- }
- } else {
- qreal offset = 0;
- qreal pw = d->pen && d->pen->isValid() ? d->pen->width() : 0.0;
-
- if (d->radius > 0) {
- generateRoundedRect();
- offset = d->radius + pw+1.5;
- } else {
- generateBorderedRect();
- offset = pw+1.5;
- }
-
- QGLShaderProgram *shader = p.useTextureShader();
-
- float texWidth = d->rectTexture->width();
- float texHeight = d->rectTexture->height();
- if (!texWidth || !texHeight)
- return;
-
- float widthV = qreal(width())+pw/2;
- float heightV = qreal(height())+pw/2;
-
- float xOffset = offset;
- bool xMiddles = true;
- if (xOffset*2 > width()+pw) {
- xMiddles = false;
- xOffset = (width()+pw)/2;
- }
- float yOffset = offset;
- bool yMiddles = true;
- if (yOffset*2 > height()+pw) {
- yMiddles = false;
- yOffset = (height()+pw)/2;
- }
-
- float texleft = xOffset / texWidth;
- float imgleft = xOffset-pw/2;
- float texright = (texWidth-xOffset) / texWidth;
- float imgright = widthV - xOffset;
-
- float textop = yOffset / texHeight;
- float imgtop = yOffset-pw/2;
- float texbottom = (texHeight-yOffset) / texHeight;
- float imgbottom = heightV - yOffset;
-
- //Bug 231768: Inappropriate interpolation was occuring on 3x3 textures
- if (offset==1)
- texleft=texright=textop=texbottom=0.5;
-
- texleft *= d->rectTexture->glWidth();
- texright *= d->rectTexture->glWidth();
- textop *= d->rectTexture->glHeight();
- texbottom *= d->rectTexture->glHeight();
-
- float vert1[] = { -pw/2, -pw/2,
- -pw/2, imgtop,
- imgleft, -pw/2,
-
- -pw/2, imgtop,
- imgleft, -pw/2,
- imgleft, imgtop,
-
- imgleft, -pw/2,
- imgleft, imgtop,
- imgright, -pw/2,
-
- imgleft, imgtop,
- imgright, -pw/2,
- imgright, imgtop,
-
- imgright, -pw/2,
- imgright, imgtop,
- widthV, -pw/2,
-
- imgright, imgtop,
- widthV, -pw/2,
- widthV, imgtop,
-
- -pw/2, heightV,
- -pw/2, imgbottom,
- imgleft, heightV,
-
- -pw/2, imgbottom,
- imgleft, heightV,
- imgleft, imgbottom,
-
- imgleft, heightV,
- imgleft, imgbottom,
- imgright, heightV,
-
- imgleft, imgbottom,
- imgright, heightV,
- imgright, imgbottom,
-
- imgright, heightV,
- imgright, imgbottom,
- widthV, heightV,
-
- imgright, imgbottom,
- widthV, heightV,
- widthV, imgbottom,
-
- -pw/2, imgtop,
- -pw/2, imgbottom,
- imgleft, imgtop,
-
- -pw/2, 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 };
-
-
- float tex1[] = { 0, 0,
- 0, textop,
- texleft, 0,
-
- 0, textop,
- texleft, 0,
- texleft, textop,
-
- texleft, 0,
- texleft, textop,
- texright, 0,
-
- texleft, textop,
- texright, 0,
- texright, textop,
-
- texright, 0,
- texright, textop,
- d->rectTexture->glWidth(), 0,
-
- texright, textop,
- d->rectTexture->glWidth(), 0,
- d->rectTexture->glWidth(), textop,
-
- 0, d->rectTexture->glHeight(),
- 0, texbottom,
- texleft, d->rectTexture->glHeight(),
-
- 0, texbottom,
- texleft, d->rectTexture->glHeight(),
- texleft, texbottom,
-
- texleft, d->rectTexture->glHeight(),
- texleft, texbottom,
- texright, d->rectTexture->glHeight(),
-
- texleft, texbottom,
- texright, d->rectTexture->glHeight(),
- texright, texbottom,
-
- texright, d->rectTexture->glHeight(),
- texright, texbottom,
- d->rectTexture->glWidth(), d->rectTexture->glHeight(),
-
- texright, texbottom,
- d->rectTexture->glWidth(), d->rectTexture->glHeight(),
- d->rectTexture->glWidth(), texbottom,
-
- 0, textop,
- 0, texbottom,
- texleft, textop,
-
- 0, texbottom,
- texleft, textop,
- texleft, texbottom,
-
- texleft, textop,
- texleft, texbottom,
- texright, textop,
-
- texleft, texbottom,
- texright, textop,
- texright, texbottom,
-
- texright, textop,
- texright, texbottom,
- d->rectTexture->glWidth(), textop,
-
- texright, texbottom,
- d->rectTexture->glWidth(), textop,
- d->rectTexture->glWidth(), texbottom };
-
-
-
- glBindTexture(GL_TEXTURE_2D, d->rectTexture->texture());
-
- shader->setAttributeArray(SingleTextureShader::Vertices, vert1, 2);
- shader->setAttributeArray(SingleTextureShader::TextureCoords, tex1, 2);
- glDrawArrays(GL_TRIANGLES, 0, 36 + (yMiddles?18:0));
- }
-}
-#endif
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h
index c279a1c..d232328 100644
--- a/src/declarative/fx/qfxrect.h
+++ b/src/declarative/fx/qfxrect.h
@@ -160,13 +160,7 @@ public:
void setRadius(qreal radius);
virtual void dump(int depth);
-#if defined(QFX_RENDER_QPAINTER)
void paintContents(QPainter &painter);
-#endif
-
-#if defined(QFX_RENDER_OPENGL)
- void paintGLContents(GLPainter &);
-#endif
private Q_SLOTS:
void doUpdate();
diff --git a/src/declarative/fx/qfxrect_p.h b/src/declarative/fx/qfxrect_p.h
index 23bb944..3544d36 100644
--- a/src/declarative/fx/qfxrect_p.h
+++ b/src/declarative/fx/qfxrect_p.h
@@ -55,10 +55,6 @@
#include "qfxitem_p.h"
-#if defined(QFX_RENDER_OPENGL)
-#include "gltexture.h"
-#endif
-
QT_BEGIN_NAMESPACE
class QFxGradient;
@@ -69,9 +65,6 @@ class QFxRectPrivate : public QFxItemPrivate
public:
QFxRectPrivate() :
-#if defined(QFX_RENDER_OPENGL)
- rectTexture(0),
-#endif //QFX_RENDER_OPENGL
color(Qt::white), gradient(0), pen(0), radius(0)
{
}
@@ -85,9 +78,6 @@ public:
{
}
-#if defined(QFX_RENDER_OPENGL)
- QSimpleCanvasItem::CachedTexture *rectTexture;
-#endif
QColor getColor();
QColor color;
QFxGradient *gradient;
diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp
index 031c0f8..a5361e1 100644
--- a/src/declarative/fx/qfxtext.cpp
+++ b/src/declarative/fx/qfxtext.cpp
@@ -44,10 +44,6 @@
#include <private/qtextcontrol_p.h>
-#if defined(QFX_RENDER_OPENGL2)
-#include "glbasicshaders.h"
-#endif
-
#include <qfxperf.h>
#include <QTextLayout>
#include <QTextLine>
@@ -695,14 +691,9 @@ void QFxTextPrivate::checkImgCache()
break;
}
-#if defined(QFX_RENDER_OPENGL)
- tex.setImage(imgCache.toImage(), GLTexture::PowerOfTwo);
-#endif
-
imgDirty = false;
}
-#if defined(QFX_RENDER_QPAINTER)
void QFxText::paintContents(QPainter &p)
{
Q_D(QFxText);
@@ -752,85 +743,6 @@ void QFxText::paintContents(QPainter &p)
p.restore();
}
-#elif defined(QFX_RENDER_OPENGL2)
-void QFxText::paintGLContents(GLPainter &p)
-{
- //return;
- Q_D(QFxText);
- d->checkImgCache();
- if (d->imgCache.isNull())
- return;
-
- int w = width();
- int h = height();
-
- float x = 0;
- float y = 0;
-
- switch (d->hAlign) {
- case AlignLeft:
- x = 0;
- break;
- case AlignRight:
- x = w - d->imgCache.width();
- break;
- case AlignHCenter:
- x = (w - d->imgCache.width()) / 2;
- break;
- }
-
- switch (d->vAlign) {
- case AlignTop:
- y = 0;
- break;
- case AlignBottom:
- y = h - d->imgCache.height();
- break;
- case AlignVCenter:
- y = (h - d->imgCache.height()) / 2;
- break;
- }
-
- float widthV = d->imgCache.width();
- float heightV = d->imgCache.height();
- float glWidth = d->tex.glWidth();
- float glHeight = d->tex.glHeight();
-
- QGLShaderProgram *shader = p.useTextureShader();
-
- float deltaX = 0.5 / qreal(d->tex.glSize().width());
- float deltaY = 0.5 / qreal(d->tex.glSize().height());
- glWidth -= deltaX;
- glHeight -= deltaY;
-
- GLfloat vertices[] = { x, y + heightV,
- x + widthV, y + heightV,
- x, y,
-
- x + widthV, y + heightV,
- x, y,
- x + widthV, y };
-
- GLfloat texVertices[] = { deltaX, deltaY,
- glWidth, deltaY,
- deltaX, glHeight,
-
- glWidth, deltaY,
- deltaX, glHeight,
- glWidth, glHeight };
-
- shader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2);
- shader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2);
-
- glBindTexture(GL_TEXTURE_2D, d->tex.texture());
- glDrawArrays(GL_TRIANGLES, 0, 6);
-
- shader->disableAttributeArray(SingleTextureShader::Vertices);
- shader->disableAttributeArray(SingleTextureShader::TextureCoords);
-}
-
-#endif
-
void QFxText::componentComplete()
{
Q_D(QFxText);
diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h
index 99ab2be..35e8b03 100644
--- a/src/declarative/fx/qfxtext.h
+++ b/src/declarative/fx/qfxtext.h
@@ -117,11 +117,7 @@ public:
virtual void dump(int depth);
virtual QString propertyInfo() const;
-#if defined(QFX_RENDER_QPAINTER)
void paintContents(QPainter &p);
-#elif defined(QFX_RENDER_OPENGL)
- void paintGLContents(GLPainter &);
-#endif
virtual void componentComplete();
diff --git a/src/declarative/fx/qfxtext_p.h b/src/declarative/fx/qfxtext_p.h
index dfaef63..e0b1909 100644
--- a/src/declarative/fx/qfxtext_p.h
+++ b/src/declarative/fx/qfxtext_p.h
@@ -58,10 +58,6 @@
#include "qml.h"
#include <QtGui/qtextlayout.h>
-#if defined(QFX_RENDER_OPENGL)
-#include "gltexture.h"
-#endif
-
QT_BEGIN_NAMESPACE
class QTextLayout;
@@ -115,9 +111,6 @@ public:
QColor styleColor;
QString activeLink;
bool imgDirty;
-#if defined(QFX_RENDER_OPENGL)
- GLTexture tex;
-#endif
QPixmap imgCache;
QPixmap imgStyleCache;
QFxText::HAlignment hAlign;
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index 5f2f36c..3c117ee 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -44,10 +44,6 @@
#include <private/qtextcontrol_p.h>
-#if defined(QFX_RENDER_OPENGL2)
-#include "glbasicshaders.h"
-#endif
-
#include <qfxperf.h>
#include "qfxevents_p.h"
#include <QTextLayout>
diff --git a/src/declarative/fx/qfxtextedit_p.h b/src/declarative/fx/qfxtextedit_p.h
index f733a4c..403bd18 100644
--- a/src/declarative/fx/qfxtextedit_p.h
+++ b/src/declarative/fx/qfxtextedit_p.h
@@ -86,9 +86,6 @@ public:
QString style;
QColor styleColor;
bool imgDirty;
-#if defined(QFX_RENDER_OPENGL)
- GLTexture texture;
-#endif
QPixmap imgCache;
QPixmap imgStyleCache;
QFxTextEdit::HAlignment hAlign;
diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp
index a4c5d22..8d9084f 100644
--- a/src/declarative/fx/qfxtransform.cpp
+++ b/src/declarative/fx/qfxtransform.cpp
@@ -254,7 +254,6 @@ bool QFxRotation::isIdentity() const
return (_angle == 0.);
}
-#if defined(QFX_RENDER_QPAINTER)
QTransform QFxRotation::transform() const
{
if (_dirty) {
@@ -266,19 +265,6 @@ QTransform QFxRotation::transform() const
}
return _transform;
}
-#elif defined(QFX_RENDER_OPENGL)
-QMatrix4x4 QFxRotation::transform() const
-{
- if (_dirty) {
- _transform = QMatrix4x4();
- _dirty = false;
- _transform.translate(_originX, _originY);
- _transform.rotate(_angle, 0, 0, 1);
- _transform.translate(-_originX, -_originY);
- }
- return _transform;
-}
-#endif
void QFxRotation::update()
{
@@ -351,7 +337,6 @@ bool QFxRotation3D::isIdentity() const
return (_angle == 0.) || (_axis.endZ() == 0. && _axis.endY() == _axis.startY() && _axis.endX() == _axis.startX());
}
-#if defined(QFX_RENDER_QPAINTER)
const qreal inv_dist_to_plane = 1. / 1024.;
QTransform QFxRotation3D::transform() const
{
@@ -396,29 +381,6 @@ QTransform QFxRotation3D::transform() const
return _transform;
}
-#elif defined(QFX_RENDER_OPENGL)
-QMatrix4x4 QFxRotation3D::transform() const
-{
- if (_dirty) {
- _dirty = false;
- _transform = QMatrix4x4();
-
- if (!isIdentity()) {
- if (angle() != 0.) {
- qreal x = _axis.endX() - _axis.startX();
- qreal y = _axis.endY() - _axis.startY();
- qreal z = _axis.endZ();
-
- _transform.translate(_axis.startX(), _axis.startY(), 0);
- _transform.rotate(angle(), x, y, z);
- _transform.translate(-_axis.startX(), -_axis.startY(), 0);
- }
- }
- }
-
- return _transform;
-}
-#endif
void QFxRotation3D::update()
{
@@ -506,7 +468,6 @@ bool QFxTranslation3D::isIdentity() const
return (_distance == 0.) || (_axis.endZ() == 0. && _axis.endY() == _axis.startY() && _axis.endX() == _axis.startX());
}
-#if defined(QFX_RENDER_QPAINTER)
QTransform QFxTranslation3D::transform() const
{
if (_dirty) {
@@ -526,35 +487,14 @@ QTransform QFxTranslation3D::transform() const
return _transform;
}
-#elif defined(QFX_RENDER_OPENGL)
-QMatrix4x4 QFxTranslation3D::transform() const
-{
- if (_dirty) {
- _dirty = false;
- _transform = QMatrix4x4();
-
- if (!isIdentity()) {
- if (distance() != 0.)
- _transform.translate((_axis.endX() - _axis.startX()) * distance(),
- (_axis.endY() - _axis.startY()) * distance(),
- (_axis.endZ()) * distance());
-
- }
- }
-
- return _transform;
-}
-#endif
void QFxTranslation3D::update()
{
_dirty = true;
-#if !defined(QFX_RENDER_OPENGL)
if (_axis.endZ() != 0. && distance() != 0.) {
qmlInfo(this) << "QTransform cannot translate along Z-axis.";
}
-#endif
QFxTransform::update();
}
@@ -579,24 +519,6 @@ QFxPerspective::~QFxPerspective()
{
}
-#if defined(QFX_RENDER_OPENGL)
-bool QFxPerspective::isIdentity() const
-{
- return false;
-}
-
-QMatrix4x4 QFxPerspective::transform() const
-{
- QMatrix4x4 rv;
- rv.translate(_x, _y);
- rv.perspective(_angle, _aspect, 1, 1024 * 1024);
- rv.translate(-_x, -_y, -1);
- rv.scale(1, 1, 1. / _scale);
-
- return rv;
-}
-#endif
-
/*!
\qmlproperty real Perspective::angle
*/
@@ -863,7 +785,6 @@ bool QFxSquish::isIdentity() const
return false;
}
-#if defined(QFX_RENDER_QPAINTER)
QTransform QFxSquish::transform() const
{
QPolygonF poly;
@@ -875,21 +796,5 @@ QTransform QFxSquish::transform() const
QTransform::quadToQuad(poly, poly2, t);
return t;
}
-#elif defined(QFX_RENDER_OPENGL)
-QMatrix4x4 QFxSquish::transform() const
-{
- QPolygonF poly;
- poly << p << QPointF(p.x() + s.width(), p.y()) << QPointF(p.x() + s.width(), p.y() + s.height()) << QPointF(p.x(), p.y() + s.height());
- QPolygonF poly2;
- poly2 << p1 << p2 << p4 << p3;
-
- QTransform t;
- QMatrix4x4 rv;
- if (QTransform::quadToQuad(poly, poly2, t))
- rv = QMatrix4x4(t);
-
- return rv;
-}
-#endif
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxtransform.h b/src/declarative/fx/qfxtransform.h
index 7be8adc..0a17917 100644
--- a/src/declarative/fx/qfxtransform.h
+++ b/src/declarative/fx/qfxtransform.h
@@ -44,9 +44,6 @@
#include <QtCore/QObject>
#include <QtGui/QTransform>
-#if defined(QFX_RENDER_OPENGL)
-#include <QtGui/qmatrix4x4.h>
-#endif
#include <QtDeclarative/qfxitem.h>
QT_BEGIN_HEADER
@@ -233,10 +230,6 @@ public:
qreal scale() const { return _scale; }
void setScale(qreal v) { _scale = v; update(); }
-#if defined(QFX_RENDER_OPENGL)
- virtual bool isIdentity() const;
- virtual QMatrix4x4 transform() const;
-#endif
private:
qreal _scale;
qreal _x;
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index dc7f60e..91579e9 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -58,16 +58,7 @@
#include "qsimplecanvas.h"
#include "qlistmodelinterface.h"
-#if defined(QFX_RENDER_OPENGL2)
-#include <QtOpenGL/qglframebufferobject.h>
-#include <glsave.h>
-#endif
-#if defined(QFX_RENDER_OPENGL)
-#include <gltexture.h>
-#endif
-
#include "qfxwebview.h"
-#include <qsimplecanvasfilter.h>
#include <private/qfxpainteditem_p.h>
QT_BEGIN_NAMESPACE
@@ -160,11 +151,7 @@ public:
~ImageCacheItem() { }
int age;
QRect area;
-#if defined(QFX_RENDER_QPAINTER)
QPixmap image;
-#else
- GLTexture image;
-#endif
};
QList<ImageCacheItem*> imagecache;
void dirtyCache(const QRect& dirt)
diff --git a/src/declarative/opengl/glbasicshaders.cpp b/src/declarative/opengl/glbasicshaders.cpp
deleted file mode 100644
index 7c1d730..0000000
--- a/src/declarative/opengl/glbasicshaders.cpp
+++ /dev/null
@@ -1,707 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "glbasicshaders.h"
-#include <QDebug>
-#include <QColor>
-
-
-QT_BEGIN_NAMESPACE
-SingleTextureVertexOpacityShader::SingleTextureVertexOpacityShader()
-{
- QGLShader vert(QGLShader::VertexShader);
- QGLShader frag(QGLShader::FragmentShader);
-
- vert.compile("\
- attribute highp vec4 myVertex;\
- attribute lowp float myOpacity;\
- attribute mediump vec4 myUV;\
- uniform mediump mat4 myPMVMatrix;\
- varying mediump vec2 myTexCoord;\
- varying lowp float myFragOpacity;\
- void main(void)\
- {\
- gl_Position = myPMVMatrix * myVertex;\
- myTexCoord = myUV.st;\
- myFragOpacity = myOpacity;\
- }"
- );
-
- frag.compile("\
- uniform sampler2D sampler2d;\
- varying mediump vec2 myTexCoord;\
- varying lowp float myFragOpacity;\
- void main(void)\
- {\
- mediump vec4 frag = texture2D(sampler2d,myTexCoord);\
- gl_FragColor = vec4(frag.rgb, frag.a * myFragOpacity);\
- }"
- );
-
- addShader(&vert);
- addShader(&frag);
-
- bindAttributeLocation("myVertex", Vertices);
- bindAttributeLocation("myUV", TextureCoords);
- bindAttributeLocation("myOpacity", OpacityCoords);
-}
-
-bool SingleTextureVertexOpacityShader::link()
-{
- if (!QGLShaderProgram::link())
- return false;
- transform = uniformLocation("myPMVMatrix");
- enable();
- setUniformValue("sampler2d", 0);
- disable();
- return true;
-}
-
-void SingleTextureVertexOpacityShader::setTransform(const QMatrix4x4 &matrix)
-{
- setUniformValue(transform, matrix);
-}
-
-BlurTextureShader::BlurTextureShader()
-{
- QGLShader vert(QGLShader::VertexShader);
- QGLShader frag(QGLShader::FragmentShader);
-
- vert.compile("\
- attribute highp vec4 myVertex;\
- attribute mediump vec4 myUV;\
- uniform mediump mat4 myPMVMatrix;\
- varying mediump vec2 myTexCoord;\
- void main(void)\
- {\
- gl_Position = myPMVMatrix * myVertex;\
- myTexCoord = myUV.st;\
- }"
- );
-
-#if 0
- frag.compile("\
- uniform sampler2D sampler2d;\
- uniform bool horizontal; \
- uniform mediump float blurStep; \
- varying mediump vec2 myTexCoord;\
- void main(void)\
- {\
- mediump vec4 accum = vec4(0, 0, 0, 0); \
- mediump vec2 offset; \
- if (horizontal) \
- offset = vec2(blurStep, 0); \
- else \
- offset = vec2(0, blurStep); \
- accum += texture2D(sampler2d, myTexCoord + 2.0 * offset); \
- accum += 2.0 * texture2D(sampler2d, myTexCoord + 1.0 * offset); \
- accum += 4.0 * texture2D(sampler2d, myTexCoord + 0.0 * offset); \
- accum += 2.0 * texture2D(sampler2d, myTexCoord - 1.0 * offset); \
- accum += texture2D(sampler2d, myTexCoord - 2.0 * offset); \
- gl_FragColor = accum / 10.0; \
- }"
- );
-#else
- frag.compile("\
- uniform sampler2D sampler2d;\
- uniform bool horizontal; \
- uniform mediump float blurStep; \
- uniform int blurSteps; \
- varying mediump vec2 myTexCoord;\
- void main(void)\
- {\
- mediump vec4 accum = vec4(0, 0, 0, 0); \
- mediump vec2 offset; \
- if (horizontal) \
- offset = vec2(blurStep, 0); \
- else \
- offset = vec2(0, blurStep); \
- mediump float sum = 0.0; \
- for (int ii = 0; ii < blurSteps; ++ii) { \
- mediump float frac = float(blurSteps - ii) / float(blurSteps); \
- mediump vec2 coord = myTexCoord + -float(ii) * offset; \
- if (coord.x >= 0.0 && coord.y >= 0.0 && coord.y <= 1.0 && coord.x <=1.0) \
- accum += texture2D(sampler2d, coord) * frac; \
- sum += frac; \
- } \
- for (int ii = 1; ii < blurSteps; ++ii) { \
- mediump float frac = float(blurSteps - ii) / float(blurSteps); \
- mediump vec2 coord = myTexCoord + float(ii) * offset; \
- if (coord.x <= 1.0 && coord.y <= 1.0 && coord.x >= 0.0 && coord.y >= 0.0) \
- accum += texture2D(sampler2d, coord) * frac; \
- sum += frac; \
- } \
- gl_FragColor = accum / sum; \
- }"
- );
-#endif
-
- addShader(&vert);
- addShader(&frag);
-
- bindAttributeLocation("myVertex", Vertices);
- bindAttributeLocation("myUV", TextureCoords);
-}
-
-bool BlurTextureShader::link()
-{
- if (!QGLShaderProgram::link())
- return false;
- transform = uniformLocation("myPMVMatrix");
- mode = uniformLocation("horizontal");
- step = uniformLocation("blurStep");
- steps = uniformLocation("blurSteps");
- enable();
- setUniformValue("sampler2d", 0);
- disable();
- return true;
-}
-
-void BlurTextureShader::setStep(float f)
-{
- setUniformValue(step, f);
-}
-
-void BlurTextureShader::setSteps(int s)
-{
- setUniformValue(steps, s);
-}
-
-void BlurTextureShader::setMode(Mode m)
-{
- if (m == Horizontal)
- setUniformValue(mode, 1);
- else
- setUniformValue(mode, 0);
-}
-
-void BlurTextureShader::setTransform(const QMatrix4x4 &matrix)
-{
- setUniformValue(transform, matrix);
-}
-
-DualTextureBlendShader::DualTextureBlendShader()
-{
- QGLShader vert(QGLShader::VertexShader);
- QGLShader frag(QGLShader::FragmentShader);
-
- vert.compile("\
- attribute highp vec4 myVertex;\
- attribute mediump vec4 myUV;\
- attribute mediump vec4 myBlendUV;\
- uniform mediump mat4 myPMVMatrix;\
- varying mediump vec2 myTexCoord;\
- varying mediump vec2 myBlendTexCoord;\
- void main(void)\
- {\
- gl_Position = myPMVMatrix * myVertex;\
- myTexCoord = myUV.st;\
- myBlendTexCoord = myBlendUV.st;\
- }"
- );
-
- frag.compile("\
- uniform sampler2D sampler2d;\
- uniform sampler2D sampler2dBlend;\
- uniform lowp float myOpacity;\
- uniform lowp float myBlend; \
- varying mediump vec2 myTexCoord;\
- varying mediump vec2 myBlendTexCoord;\
- void main(void)\
- {\
- mediump vec4 tex = texture2D(sampler2d,myTexCoord);\
- mediump vec4 blendtex = texture2D(sampler2dBlend, myBlendTexCoord);\
- gl_FragColor = mix(tex, blendtex, myBlend) * myOpacity; \
- }"
- );
-
- addShader(&vert);
- addShader(&frag);
-
- bindAttributeLocation("myVertex", Vertices);
- bindAttributeLocation("myUV", TextureCoords);
- bindAttributeLocation("myBlendUV", BlendTextureCoords);
-}
-
-bool DualTextureBlendShader::link()
-{
- if (!QGLShaderProgram::link())
- return false;
- transform = uniformLocation("myPMVMatrix");
- opacity = uniformLocation("myOpacity");
- blend = uniformLocation("myBlend");
- enable();
- setUniformValue("sampler2d", 0);
- setUniformValue("sampler2dBlend", 1);
- disable();
- return true;
-}
-
-void DualTextureBlendShader::setOpacity(GLfloat o)
-{
- setUniformValue(opacity, o);
-}
-
-void DualTextureBlendShader::setBlend(GLfloat b)
-{
- setUniformValue(blend, b);
-}
-
-void DualTextureBlendShader::setTransform(const QMatrix4x4 &matrix)
-{
- setUniformValue(transform, matrix);
-}
-
-DualTextureAddShader::DualTextureAddShader()
-{
- QGLShader vert(QGLShader::VertexShader);
- QGLShader frag(QGLShader::FragmentShader);
-
- vert.compile("\
- attribute highp vec4 myVertex;\
- attribute mediump vec4 myUV;\
- attribute mediump vec4 myAddUV;\
- uniform mediump mat4 myPMVMatrix;\
- varying mediump vec2 myTexCoord;\
- varying mediump vec2 myAddTexCoord;\
- void main(void)\
- {\
- gl_Position = myPMVMatrix * myVertex;\
- myTexCoord = myUV.st;\
- myAddTexCoord = myAddUV.st;\
- }"
- );
-
- frag.compile("\
- uniform sampler2D sampler2d;\
- uniform sampler2D sampler2dAdd;\
- uniform lowp float myOpacity;\
- varying mediump vec2 myTexCoord;\
- varying mediump vec2 myAddTexCoord;\
- void main(void)\
- {\
- mediump vec4 tex = texture2D(sampler2d,myTexCoord);\
- mediump vec4 addtex = texture2D(sampler2dAdd, myAddTexCoord);\
- tex = tex + vec4(addtex.rgb * addtex.a * tex.a, 0); \
- tex = min(tex, vec4(1, 1, 1, 1)); \
- gl_FragColor = vec4(tex.rgb, tex.a) * myOpacity;\
- }"
- );
-
- addShader(&vert);
- addShader(&frag);
-
- bindAttributeLocation("myVertex", Vertices);
- bindAttributeLocation("myUV", TextureCoords);
- bindAttributeLocation("myAddUV", AddTextureCoords);
-}
-
-void DualTextureAddShader::setOpacity(GLfloat f)
-{
- setUniformValue(opacity, f);
-}
-
-void DualTextureAddShader::setTransform(const QMatrix4x4 &matrix)
-{
- setUniformValue(transform, matrix);
-}
-
-bool DualTextureAddShader::link()
-{
- if (!QGLShaderProgram::link())
- return false;
- transform = uniformLocation("myPMVMatrix");
- opacity = uniformLocation("myOpacity");
- enable();
- setUniformValue("sampler2d", 0);
- setUniformValue("sampler2dAdd", 1);
- disable();
- return true;
-}
-
-SingleTextureShader::SingleTextureShader()
-{
- QGLShader vert(QGLShader::VertexShader);
- QGLShader frag(QGLShader::FragmentShader);
-
- vert.compile("\
- attribute highp vec4 myVertex;\
- attribute mediump vec4 myUV;\
- uniform mediump mat4 myPMVMatrix;\
- varying mediump vec2 myTexCoord;\
- void main(void)\
- {\
- gl_Position = myPMVMatrix * myVertex;\
- myTexCoord = myUV.st;\
- }"
- );
-
- frag.compile("\
- uniform sampler2D sampler2d;\
- varying mediump vec2 myTexCoord;\
- void main(void)\
- {\
- gl_FragColor = texture2D(sampler2d,myTexCoord);\
- }"
- );
-
- addShader(&vert);
- addShader(&frag);
-
- bindAttributeLocation("myVertex", Vertices);
- bindAttributeLocation("myUV", TextureCoords);
-}
-
-bool SingleTextureShader::link()
-{
- if (!QGLShaderProgram::link())
- return false;
- transform = uniformLocation("myPMVMatrix");
- enable();
- setUniformValue("sampler2d", 0);
- disable();
- return true;
-}
-
-void SingleTextureShader::setTransform(const QMatrix4x4 &matrix)
-{
- setUniformValue(transform, matrix);
-}
-
-ConstantColorShader::ConstantColorShader()
-{
- QGLShader vert(QGLShader::VertexShader);
- QGLShader frag(QGLShader::FragmentShader);
-
- vert.compile("\
- uniform mediump mat4 myPMVMatrix;\
- attribute highp vec4 myVertex;\
- void main(void)\
- {\
- gl_Position = myPMVMatrix * myVertex; \
- }"
- );
-
- frag.compile("\
- uniform lowp vec4 myColor;\
- void main(void)\
- {\
- gl_FragColor = myColor;\
- }"
- );
-
- addShader(&vert);
- addShader(&frag);
-
- bindAttributeLocation("myVertex", Vertices);
-}
-
-void ConstantColorShader::setColor(const QColor &c)
-{
- setUniformValue(color, c);
-}
-
-void ConstantColorShader::setTransform(const QMatrix4x4 &matrix)
-{
- setUniformValue(transform, matrix);
-}
-
-bool ConstantColorShader::link()
-{
- if (!QGLShaderProgram::link())
- return false;
- transform = uniformLocation("myPMVMatrix");
- color = uniformLocation("myColor");
- return true;
-}
-
-ColorShader::ColorShader()
-{
- QGLShader vert(QGLShader::VertexShader);
- QGLShader frag(QGLShader::FragmentShader);
-
- vert.compile("\
- uniform mediump mat4 myPMVMatrix;\
- attribute highp vec4 myVertex;\
- attribute lowp vec4 myColors;\
- varying lowp vec4 myColor;\
- void main(void)\
- {\
- gl_Position = myPMVMatrix * myVertex; \
- myColor = myColors; \
- }"
- );
-
- frag.compile("\
- varying lowp vec4 myColor;\
- void main(void)\
- {\
- gl_FragColor = myColor;\
- }"
- );
-
- addShader(&vert);
- addShader(&frag);
-
- bindAttributeLocation("myVertex", Vertices);
- bindAttributeLocation("myColors", Colors);
-}
-
-void ColorShader::setTransform(const QMatrix4x4 &matrix)
-{
- setUniformValue(transform, matrix);
-}
-
-bool ColorShader::link()
-{
- if (!QGLShaderProgram::link())
- return false;
- transform = uniformLocation("myPMVMatrix");
- return true;
-}
-
-class GLBasicShadersPrivate
-{
-public:
- GLBasicShadersPrivate();
- ~GLBasicShadersPrivate();
-
- BlurTextureShader *blurTexture;
- SingleTextureShader *singleTexture;
- SingleTextureOpacityShader *singleTextureOpacity;
- DualTextureAddShader *dualTextureAdd;
- SingleTextureShadowShader *singleTextureShadow;
- SingleTextureVertexOpacityShader *singleTextureVertexOpacity;
- ConstantColorShader *constantColor;
- ColorShader *color;
-};
-
-GLBasicShadersPrivate::GLBasicShadersPrivate()
-: blurTexture(0), singleTexture(0), singleTextureOpacity(0),
- dualTextureAdd(0), singleTextureShadow(0), singleTextureVertexOpacity(0),
- constantColor(0), color(0)
-{
-}
-
-GLBasicShadersPrivate::~GLBasicShadersPrivate()
-{
- delete blurTexture;
- delete singleTexture;
- delete singleTextureOpacity;
- delete dualTextureAdd;
- delete singleTextureVertexOpacity;
- delete singleTextureShadow;
- delete constantColor;
- delete color;
-}
-
-GLBasicShaders::GLBasicShaders()
-: d(new GLBasicShadersPrivate)
-{
-}
-
-GLBasicShaders::~GLBasicShaders()
-{
- delete d;
-}
-
-BlurTextureShader *GLBasicShaders::blurTexture()
-{
- if (!d->blurTexture) d->blurTexture = new BlurTextureShader();
- return d->blurTexture;
-}
-
-SingleTextureShader *GLBasicShaders::singleTexture()
-{
- if (!d->singleTexture) d->singleTexture = new SingleTextureShader();
- return d->singleTexture;
-}
-
-SingleTextureOpacityShader *GLBasicShaders::singleTextureOpacity()
-{
- if (!d->singleTextureOpacity) d->singleTextureOpacity = new SingleTextureOpacityShader();
- return d->singleTextureOpacity;
-}
-
-DualTextureAddShader *GLBasicShaders::dualTextureAdd()
-{
- if (!d->dualTextureAdd) d->dualTextureAdd = new DualTextureAddShader();
- return d->dualTextureAdd;
-}
-
-SingleTextureVertexOpacityShader *GLBasicShaders::singleTextureVertexOpacity()
-{
- if (!d->singleTextureVertexOpacity) d->singleTextureVertexOpacity = new SingleTextureVertexOpacityShader();
- return d->singleTextureVertexOpacity;
-}
-
-SingleTextureShadowShader *GLBasicShaders::singleTextureShadow()
-{
- if (!d->singleTextureShadow) d->singleTextureShadow = new SingleTextureShadowShader();
- return d->singleTextureShadow;
-}
-
-ConstantColorShader *GLBasicShaders::constantColor()
-{
- if (!d->constantColor) d->constantColor = new ConstantColorShader();
- return d->constantColor;
-}
-
-ColorShader *GLBasicShaders::color()
-{
- if (!d->color) d->color = new ColorShader();
- return d->color;
-}
-
-SingleTextureOpacityShader::SingleTextureOpacityShader()
-{
- QGLShader vert(QGLShader::VertexShader);
- QGLShader frag(QGLShader::FragmentShader);
-
- vert.compile("\
- attribute highp vec4 myVertex;\
- attribute mediump vec4 myUV;\
- uniform mediump mat4 myPMVMatrix;\
- varying mediump vec2 myTexCoord;\
- void main(void)\
- {\
- gl_Position = myPMVMatrix * myVertex;\
- myTexCoord = myUV.st;\
- }"
- );
-
- frag.compile("\
- uniform sampler2D sampler2d;\
- uniform lowp float myOpacity;\
- varying mediump vec2 myTexCoord;\
- void main(void)\
- {\
- mediump vec4 tex = texture2D(sampler2d,myTexCoord);\
- gl_FragColor = vec4(tex.rgb, myOpacity * tex.a);\
- }"
- );
-
- addShader(&vert);
- addShader(&frag);
-
- bindAttributeLocation("myVertex", Vertices);
- bindAttributeLocation("myUV", TextureCoords);
-}
-
-bool SingleTextureOpacityShader::link()
-{
- if (!QGLShaderProgram::link())
- return false;
- transform = uniformLocation("myPMVMatrix");
- opacity = uniformLocation("myOpacity");
- enable();
- setUniformValue("sampler2d", 0);
- disable();
- return true;
-}
-
-void SingleTextureOpacityShader::setTransform(const QMatrix4x4 &matrix)
-{
- setUniformValue(transform, matrix);
-}
-
-void SingleTextureOpacityShader::setOpacity(GLfloat f)
-{
- setUniformValue(opacity, f);
-}
-
-SingleTextureShadowShader::SingleTextureShadowShader()
-{
- QGLShader vert(QGLShader::VertexShader);
- QGLShader frag(QGLShader::FragmentShader);
-
- vert.compile("\
- attribute highp vec4 myVertex;\
- attribute mediump vec4 myUV;\
- uniform mediump mat4 myPMVMatrix;\
- varying mediump vec2 myTexCoord;\
- void main(void)\
- {\
- gl_Position = myPMVMatrix * myVertex;\
- myTexCoord = myUV.st;\
- }"
- );
-
- frag.compile("\
- uniform sampler2D sampler2d;\
- uniform lowp float myOpacity;\
- varying mediump vec2 myTexCoord;\
- void main(void)\
- {\
- mediump vec4 tex = texture2D(sampler2d,myTexCoord);\
- gl_FragColor = vec4(0, 0, 0, myOpacity * tex.a * .75);\
- }"
- );
-
- addShader(&vert);
- addShader(&frag);
-
- bindAttributeLocation("myVertex", Vertices);
- bindAttributeLocation("myUV", TextureCoords);
-}
-
-bool SingleTextureShadowShader::link()
-{
- if (!QGLShaderProgram::link())
- return false;
- transform = uniformLocation("myPMVMatrix");
- opacity = uniformLocation("myOpacity");
- enable();
- setUniformValue("sampler2d", 0);
- disable();
- return true;
-}
-
-void SingleTextureShadowShader::setTransform(const QMatrix4x4 &matrix)
-{
- setUniformValue(transform, matrix);
-}
-
-void SingleTextureShadowShader::setOpacity(GLfloat f)
-{
- setUniformValue(opacity, f);
-}
-QT_END_NAMESPACE
diff --git a/src/declarative/opengl/glbasicshaders.h b/src/declarative/opengl/glbasicshaders.h
deleted file mode 100644
index 7d358d8..0000000
--- a/src/declarative/opengl/glbasicshaders.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef _GLBASICSHADERS_H_
-#define _GLBASICSHADERS_H_
-
-#include <QtOpenGL/qglshaderprogram.h>
-#include <QtGui/qmatrix4x4.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-class BlurTextureShader : public QGLShaderProgram
-{
- Q_OBJECT
-public:
- BlurTextureShader();
-
- enum { Vertices = 0,
- TextureCoords = 1 };
-
- enum Mode { Horizontal, Vertical };
- void setMode(Mode);
- void setStep(float);
- void setSteps(int);
- void setTransform(const QMatrix4x4 &);
- virtual bool link();
-
-private:
- GLint mode;
- GLint step;
- GLint steps;
- GLint transform;
-};
-
-class SingleTextureShader : public QGLShaderProgram
-{
- Q_OBJECT
-public:
- SingleTextureShader();
-
- enum { Vertices = 0,
- TextureCoords = 1 };
-
- void setTransform(const QMatrix4x4 &);
- virtual bool link();
-
-private:
- GLint transform;
-};
-
-class DualTextureBlendShader : public QGLShaderProgram
-{
- Q_OBJECT
-public:
- DualTextureBlendShader();
- enum { Vertices = 0,
- TextureCoords = 1,
- BlendTextureCoords = 2 };
-
- void setOpacity(GLfloat);
- void setBlend(GLfloat);
- void setTransform(const QMatrix4x4 &);
- virtual bool link();
-
-private:
- GLint transform;
- GLint opacity;
- GLint blend;
-};
-
-class DualTextureAddShader : public QGLShaderProgram
-{
- Q_OBJECT
-public:
- DualTextureAddShader();
- enum { Vertices = 0,
- TextureCoords = 1,
- AddTextureCoords = 2 };
-
- void setOpacity(GLfloat);
- void setTransform(const QMatrix4x4 &);
- virtual bool link();
-
-private:
- GLint transform;
- GLint opacity;
-};
-
-class SingleTextureOpacityShader : public QGLShaderProgram
-{
- Q_OBJECT
-public:
- SingleTextureOpacityShader();
-
- enum { Vertices = 0,
- TextureCoords = 1 };
-
- void setOpacity(GLfloat);
- void setTransform(const QMatrix4x4 &);
- virtual bool link();
-
-private:
- GLint transform;
- GLint opacity;
-};
-
-class SingleTextureVertexOpacityShader : public QGLShaderProgram
-{
- Q_OBJECT
-public:
- SingleTextureVertexOpacityShader();
-
- enum { Vertices = 0,
- TextureCoords = 1,
- OpacityCoords = 2 };
-
- void setTransform(const QMatrix4x4 &);
- virtual bool link();
-
-private:
- GLint transform;
-};
-
-
-class SingleTextureShadowShader : public QGLShaderProgram
-{
- Q_OBJECT
-public:
- SingleTextureShadowShader();
-
- enum { Vertices = 0,
- TextureCoords = 1 };
-
- void setOpacity(GLfloat);
- void setTransform(const QMatrix4x4 &);
- virtual bool link();
-
-private:
- GLint transform;
- GLint opacity;
-};
-
-
-class QColor;
-class ConstantColorShader : public QGLShaderProgram
-{
- Q_OBJECT
-public:
- ConstantColorShader();
-
- enum { Vertices = 0 };
-
- void setColor(const QColor &);
- void setTransform(const QMatrix4x4 &);
- virtual bool link();
-
-private:
- GLint transform;
- GLint color;
-};
-
-class ColorShader : public QGLShaderProgram
-{
- Q_OBJECT
-public:
- ColorShader();
-
- enum { Vertices = 0, Colors = 1 };
-
- void setTransform(const QMatrix4x4 &);
- virtual bool link();
-
-private:
- GLint transform;
-};
-
-class GLBasicShadersPrivate;
-class GLBasicShaders
-{
-public:
- GLBasicShaders();
- virtual ~GLBasicShaders();
-
- BlurTextureShader *blurTexture();
- SingleTextureShader *singleTexture();
- SingleTextureOpacityShader *singleTextureOpacity();
- DualTextureAddShader *dualTextureAdd();
- SingleTextureVertexOpacityShader *singleTextureVertexOpacity();
- SingleTextureShadowShader *singleTextureShadow();
- ConstantColorShader *constantColor();
- ColorShader *color();
-
-private:
- GLBasicShadersPrivate *d;
-};
-
-#endif // _GLBASICSHADERS_H_
-
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
diff --git a/src/declarative/opengl/glheaders.h b/src/declarative/opengl/glheaders.h
deleted file mode 100644
index fd1da18..0000000
--- a/src/declarative/opengl/glheaders.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef _GLHEADERS_H_
-#define _GLHEADERS_H_
-
-#include <QtDeclarative/qfxglobal.h>
-#define GL_GLEXT_PROTOTYPES 1
-#include <QtOpenGL/qgl.h>
-
-#endif // _GLHEADERS_H_
diff --git a/src/declarative/opengl/glsave.cpp b/src/declarative/opengl/glsave.cpp
deleted file mode 100644
index 125e81b..0000000
--- a/src/declarative/opengl/glsave.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "glsave.h"
diff --git a/src/declarative/opengl/glsave.h b/src/declarative/opengl/glsave.h
deleted file mode 100644
index ad6c0ec..0000000
--- a/src/declarative/opengl/glsave.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef _GLSAVE_H_
-#define _GLSAVE_H_
-
-#include <QtCore/qglobal.h>
-#include <QtDeclarative/qfxglobal.h>
-#include <QtCore/QRect>
-#include "glheaders.h"
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-class GLSaveViewport
-{
-public:
- GLSaveViewport()
- {
- glGetIntegerv(GL_VIEWPORT, viewport);
- }
-
- ~GLSaveViewport()
- {
- glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
- }
-
-private:
- Q_DISABLE_COPY(GLSaveViewport)
- GLint viewport[4];
-};
-
-class GLSaveScissor
-{
-public:
- GLSaveScissor()
- {
- enabled = glIsEnabled(GL_SCISSOR_TEST);
- glGetIntegerv(GL_SCISSOR_BOX, box);
- }
-
- ~GLSaveScissor()
- {
- if (enabled)
- glEnable(GL_SCISSOR_TEST);
- else
- glDisable(GL_SCISSOR_TEST);
- glScissor(box[0], box[1], box[2], box[3]);
- }
-
- bool wasEnabled() const
- {
- return enabled == GL_TRUE;
- }
-
- QRect rect() const
- {
- return QRect(box[0], box[1], box[2], box[3]);
- }
-
-private:
- Q_DISABLE_COPY(GLSaveScissor)
- GLint box[4];
- GLboolean enabled;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-#endif // _GLSAVE_H_
diff --git a/src/declarative/opengl/gltexture.cpp b/src/declarative/opengl/gltexture.cpp
deleted file mode 100644
index c2a02df..0000000
--- a/src/declarative/opengl/gltexture.cpp
+++ /dev/null
@@ -1,384 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "gltexture.h"
-#include <QImage>
-
-
-QT_BEGIN_NAMESPACE
-/*!
- \internal
- \class GLTexture
- \brief The GLTexture class simplifies the use of OpenGL textures.
-*/
-
-// Copied from QGLWidget::convertToGLFormat
-static QImage QGLWidget_convertToGLFormat(const QImage& img)
-{
- QImage res = img.convertToFormat(QImage::Format_ARGB32);
- res = res.mirrored();
-
- if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
- // Qt has ARGB; OpenGL wants RGBA
- for (int i=0; i < res.height(); i++) {
- uint *p = (uint*)res.scanLine(i);
- uint *end = p + res.width();
- while (p < end) {
- *p = (*p << 8) | ((*p >> 24) & 0xFF);
- p++;
- }
- }
- }
- else {
- // Qt has ARGB; OpenGL wants ABGR (i.e. RGBA backwards)
- res = res.rgbSwapped();
- }
- return res;
-}
-class GLTexturePrivate
-{
-public:
- GLTexturePrivate(GLTexture *_q)
- : q(_q), texture(0), width(0), height(0),
- horizWrap(GLTexture::Repeat), vertWrap(GLTexture::Repeat),
- minFilter(GLTexture::Linear), magFilter(GLTexture::Linear),
- glWidth(1.), glHeight(1.)
- {
- }
-
- GLTexture *q;
- GLuint texture;
- int width;
- int height;
- GLTexture::WrapMode horizWrap;
- GLTexture::WrapMode vertWrap;
- GLTexture::FilterMode minFilter;
- GLTexture::FilterMode magFilter;
-
- qreal glWidth;
- qreal glHeight;
- QSize glSize;
-
- void genTexture();
-};
-
-void GLTexturePrivate::genTexture()
-{
- if (texture)
- return;
-
- glGenTextures(1, &texture);
- glBindTexture(GL_TEXTURE_2D, texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter);
- q->setHorizontalWrap(horizWrap);
- q->setVerticalWrap(vertWrap);
-}
-
-GLTexture::GLTexture()
-: d(new GLTexturePrivate(this))
-{
-}
-
-GLTexture::GLTexture(const QString &file)
-: d(new GLTexturePrivate(this))
-{
- QImage img(file);
- if (!img.isNull())
- setImage(img);
-}
-
-GLTexture::GLTexture(const QImage &img)
-: d(new GLTexturePrivate(this))
-{
- setImage(img);
-}
-
-GLTexture::~GLTexture()
-{
- if (d->texture)
- glDeleteTextures(1, &d->texture);
- delete d;
- d = 0;
-}
-
-bool GLTexture::isNull() const
-{
- return d->texture == 0;
-}
-
-void GLTexture::clear()
-{
- if (d->texture) {
- glDeleteTextures(1, &d->texture);
- d->texture = 0;
- d->width = 0;
- d->height = 0;
- }
-}
-
-static inline int npot(int size)
-{
- size--;
- size |= size >> 1;
- size |= size >> 2;
- size |= size >> 4;
- size |= size >> 8;
- size |= size >> 16;
- size++;
- return size;
-}
-
-/*!
- Set the texture to \a img. If the texture has already been created (either
- by explicitly setting the size, or by previously setting an image), it will
- be destroyed and a new texture created with \a img's contents and size.
- */
-void GLTexture::setImage(const QImage &img, ImageMode mode)
-{
- if (img.isNull())
- return;
-
- d->genTexture();
-
- glBindTexture(GL_TEXTURE_2D, d->texture);
-
- if (mode == NonPowerOfTwo) {
-
- if (img.format() == QImage::Format_RGB16) {
- QImage dataImage = img.mirrored();
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, dataImage.width(),
- dataImage.height(), 0,
- GL_RGB,
- GL_UNSIGNED_SHORT_5_6_5, dataImage.bits());
- } else {
- QImage dataImage = QGLWidget_convertToGLFormat(img);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dataImage.width(),
- dataImage.height(), 0,
- (dataImage.format() == QImage::Format_ARGB32)?GL_RGBA:GL_RGB,
- GL_UNSIGNED_BYTE, dataImage.bits());
- }
- d->glWidth = 1.;
- d->glHeight = 1.;
- d->glSize = img.size();
-
- } else {
- // mode == PowerOfTwo
- int max = (img.width() > img.height())?img.width():img.height();
- max = npot(max);
-
- if (img.format() == QImage::Format_RGB16) {
- QImage dataImage = img.mirrored();
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, max,
- max, 0,
- GL_RGB,
- GL_UNSIGNED_SHORT_5_6_5, 0);
-
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, dataImage.width(),
- dataImage.height(), GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
- dataImage.bits());
-
- } else {
- QImage dataImage = QGLWidget_convertToGLFormat(img);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, max,
- max, 0,
- (dataImage.format() == QImage::Format_ARGB32)?GL_RGBA:GL_RGB,
- GL_UNSIGNED_BYTE, 0);
-
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, dataImage.width(),
- dataImage.height(),
- (dataImage.format() == QImage::Format_ARGB32)?GL_RGBA:GL_RGB,
- GL_UNSIGNED_BYTE, dataImage.bits());
- }
-
- d->glWidth = qreal(img.width()) / qreal(max);
- d->glHeight = qreal(img.height()) / qreal(max);
- d->glSize = QSize(max, max);
- }
-
- d->width = img.width();
- d->height = img.height();
-}
-
-void GLTexture::copyImage(const QImage &img, const QPoint &point,
- const QRect &srcRect)
-{
- qFatal("Not implemented");
- Q_UNUSED(img);
- Q_UNUSED(point);
- Q_UNUSED(srcRect);
-}
-
-QSize GLTexture::size() const
-{
- return QSize(d->width, d->height);
-}
-
-int GLTexture::width() const
-{
- return d->width;
-}
-
-int GLTexture::height() const
-{
- return d->height;
-}
-
-qreal GLTexture::glWidth() const
-{
- return d->glWidth;
-}
-
-qreal GLTexture::glHeight() const
-{
- return d->glHeight;
-}
-
-QSize GLTexture::glSize() const
-{
- return d->glSize;
-}
-
-/*!
- Sets the \a size of the texture. This will destroy the current contents of
- the texture. If an image has been assigned, it will need to be reassigned
- using either setImage() or copyImage().
-
- If size is invalid (width or height is less than or equal to 0) the texture
- will be destroyed. This is equivalent to calling clear().
-*/
-void GLTexture::setSize(const QSize &size)
-{
- if (size.width() <= 0 || size.height() <= 0) {
- clear();
- return;
- }
-
- d->genTexture();
- glBindTexture(GL_TEXTURE_2D, d->texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
- d->width = size.width();
- d->height = size.height();
-}
-
-GLTexture::WrapMode GLTexture::horizontalWrap() const
-{
- return d->horizWrap;
-}
-
-GLTexture::WrapMode GLTexture::verticalWrap() const
-{
- return d->vertWrap;
-}
-
-void GLTexture::setHorizontalWrap(WrapMode mode)
-{
- d->horizWrap = mode;
- if (d->texture) {
- GLint last;
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &last);
- if (GLuint(last) != d->texture)
- glBindTexture(GL_TEXTURE_2D, d->texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, mode);
- if (GLuint(last) != d->texture)
- glBindTexture(GL_TEXTURE_2D, last);
- }
-}
-
-/*!
- Set the veritcal wrap mode to \a mode.
- */
-void GLTexture::setVerticalWrap(WrapMode mode)
-{
- d->vertWrap = mode;
- if (d->texture) {
- GLint last;
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &last);
- if (GLuint(last) != d->texture)
- glBindTexture(GL_TEXTURE_2D, d->texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, mode);
- if (GLuint(last) != d->texture)
- glBindTexture(GL_TEXTURE_2D, last);
- }
-}
-
-GLTexture::FilterMode GLTexture::minFilter() const
-{
- return d->minFilter;
-}
-
-GLTexture::FilterMode GLTexture::magFilter() const
-{
- return d->magFilter;
-}
-
-void GLTexture::setMinFilter(FilterMode f)
-{
- if (d->minFilter == f)
- return;
- d->minFilter = f;
- if (d->texture) {
- glBindTexture(GL_TEXTURE_2D, d->texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, d->minFilter);
- }
-}
-
-void GLTexture::setMagFilter(FilterMode f)
-{
- if (d->magFilter == f)
- return;
- d->magFilter = f;
- if (d->texture) {
- glBindTexture(GL_TEXTURE_2D, d->texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, d->magFilter);
- }
-}
-
-GLuint GLTexture::texture() const
-{
- return d->texture;
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/opengl/gltexture.h b/src/declarative/opengl/gltexture.h
deleted file mode 100644
index c08d68f..0000000
--- a/src/declarative/opengl/gltexture.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef _GLTEXTURE_H_
-#define _GLTEXTURE_H_
-
-#include <QtDeclarative/qfxglobal.h>
-
-#include <QtCore/QRect>
-#include <QtCore/QPoint>
-#include "glheaders.h"
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QString;
-class QImage;
-class GLTexturePrivate;
-class Q_DECLARATIVE_EXPORT GLTexture
-{
-public:
- GLTexture();
- GLTexture(const QString &file);
- GLTexture(const QImage &img);
- virtual ~GLTexture();
-
- bool isNull() const;
- void clear();
-
- enum ImageMode { NonPowerOfTwo, PowerOfTwo };
- void setImage(const QImage &, ImageMode = NonPowerOfTwo);
- void copyImage(const QImage &, const QPoint & = QPoint(0, 0), const QRect & = QRect());
-
- int width() const;
- int height() const;
- qreal glWidth() const;
- qreal glHeight() const;
- QSize glSize() const;
- QSize size() const;
- void setSize(const QSize &);
-
- enum WrapMode {
- Repeat = GL_REPEAT,
- ClampToEdge = GL_CLAMP_TO_EDGE,
-#if defined(QFX_RENDER_OPENGL2)
- MirroredRepeat = GL_MIRRORED_REPEAT,
-#else
- MirroredRepeat = Repeat
-#endif
- };
-
- WrapMode horizontalWrap() const;
- WrapMode verticalWrap() const;
- void setHorizontalWrap(WrapMode);
- void setVerticalWrap(WrapMode);
-
- enum FilterMode {
- Nearest = GL_NEAREST,
- Linear = GL_LINEAR,
- MipmapLinear = GL_LINEAR_MIPMAP_LINEAR
- };
-
- FilterMode minFilter() const;
- FilterMode magFilter() const;
- void setMinFilter(FilterMode);
- void setMagFilter(FilterMode);
-
- GLuint texture() const;
-private:
- Q_DISABLE_COPY(GLTexture)
- GLTexturePrivate *d;
-};
-
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-#endif // _GLTEXTURE_H_
diff --git a/src/declarative/opengl/opengl.pri b/src/declarative/opengl/opengl.pri
deleted file mode 100644
index c9ccefb..0000000
--- a/src/declarative/opengl/opengl.pri
+++ /dev/null
@@ -1,20 +0,0 @@
-DEPENDPATH += opengl
-INCLUDEPATH += opengl
-INCLUDEPATH += $$QMAKE_INCDIR_OPENGL
-QT += opengl
-
-contains(QT_CONFIG, opengles1) {
- SOURCES += gltexture.cpp \
- glsave.cpp
-
- HEADERS += gltexture.h \
- glsave.h
-} else:contains(QT_CONFIG, opengles2) {
- SOURCES += gltexture.cpp \
- glbasicshaders.cpp \
- glsave.cpp
-
- HEADERS += gltexture.h \
- glbasicshaders.h \
- glsave.h
-}
diff --git a/src/declarative/util/qfxglobal.h b/src/declarative/util/qfxglobal.h
index 6ba9409..1f3d561f 100644
--- a/src/declarative/util/qfxglobal.h
+++ b/src/declarative/util/qfxglobal.h
@@ -51,39 +51,10 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-#if defined(QT_OPENGL_ES_1)
-#define QFX_CONFIGURATION_OPENGL1
-#elif defined(QT_OPENGL_ES_2)
-#define QFX_CONFIGURATION_OPENGL2
-#else
-#define QFX_CONFIGURATION_SOFTWARE
-#endif
-
-/*
- The choices of renderer are:
- QFX_RENDER_QPAINTER
- QFX_RENDER_OPENGL1
- QFX_RENDER_OPENGL2
- To simplify code, if either of the OpenGL renderers are used,
- QFX_RENDER_OPENGL is also defined.
-*/
-
-#if defined(QFX_CONFIGURATION_OPENGL2)
-
-#define QFX_RENDER_OPENGL
-#define QFX_RENDER_OPENGL2
-
-#elif defined(QFX_CONFIGURATION_OPENGL1)
-
-#define QFX_RENDER_OPENGL
-#define QFX_RENDER_OPENGL1
-
-#elif defined(QFX_CONFIGURATION_SOFTWARE)
+#define QFX_CONFIGURATION_SOFTWARE
#define QFX_RENDER_QPAINTER
-#endif
-
#define DEFINE_BOOL_CONFIG_OPTION(name, var) \
static bool name() \
{ \