aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-09-13 12:23:27 +0200
committerGunnar Sletta <gunnar.sletta@nokia.com>2011-09-13 12:29:19 +0200
commite47ade5e86c96eef95f43bb181ace17524acb19c (patch)
tree0ab99639f4d80087cd6c0f50a7acb10fb089807d /src
parentce5ac7d67b59deb7c0e261e9ee21a475e6cb2e41 (diff)
fix declarative to work after broken refactor
Diffstat (limited to 'src')
-rw-r--r--src/declarative/items/context2d/qsgcontext2d.cpp29
-rw-r--r--src/declarative/items/context2d/qsgcontext2dcommandbuffer.cpp3
-rw-r--r--src/declarative/items/context2d/qsgcontext2dtexture.cpp22
-rw-r--r--src/declarative/items/context2d/qsgcontext2dtexture_p.h7
-rw-r--r--src/declarative/items/context2d/qsgcontext2dtile.cpp23
-rw-r--r--src/declarative/items/context2d/qsgcontext2dtile_p.h15
-rw-r--r--src/declarative/particles/qsgcustomparticle.cpp8
7 files changed, 62 insertions, 45 deletions
diff --git a/src/declarative/items/context2d/qsgcontext2d.cpp b/src/declarative/items/context2d/qsgcontext2d.cpp
index 50ce1e4bd4..af2676f0e3 100644
--- a/src/declarative/items/context2d/qsgcontext2d.cpp
+++ b/src/declarative/items/context2d/qsgcontext2d.cpp
@@ -58,8 +58,6 @@
#include <QtCore/qmath.h>
#include "qv8engine_p.h"
-#include <QtOpenGL/QGLFramebufferObjectFormat>
-#include <QtOpenGL/QGLFramebufferObject>
#include "qdeclarativeengine.h"
QT_BEGIN_NAMESPACE
/*!
@@ -344,12 +342,15 @@ static QImage qt_texture_to_image(QSGTexture* texture)
{
if (!texture || !texture->textureId())
return QImage();
- QGLFramebufferObjectFormat format;
- format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
+ QOpenGLFramebufferObjectFormat format;
+ format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
format.setInternalTextureFormat(GL_RGBA);
format.setMipmap(false);
- QGLFramebufferObject* fbo = new QGLFramebufferObject(texture->textureSize(), format);
+ QOpenGLFramebufferObject* fbo = new QOpenGLFramebufferObject(texture->textureSize(), format);
+#if 0
+ // ### refactor
fbo->drawTexture(QPointF(0,0), texture->textureId(), GL_TEXTURE_2D);
+#endif
return fbo->toImage();
}
@@ -723,15 +724,7 @@ static v8::Handle<v8::Value> ctx2d_globalAlpha(v8::Local<v8::String>, const v8::
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This());
CHECK_CONTEXT(r)
-
-<<<<<<< HEAD
return v8::Number::New(r->context->state.globalAlpha);
-=======
- QV8Engine *engine = V8ENGINE_ACCESSOR();
- Q_UNUSED(engine)
-
- return v8::Boolean::New(r->context->valid());
->>>>>>> refactor
}
static void ctx2d_globalAlpha_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info)
@@ -2171,13 +2164,12 @@ static v8::Handle<v8::Value> ctx2d_imageData_mirror(const v8::Arguments &args)
return v8::Undefined();
}
-<<<<<<< HEAD
if (args.Length() == 1) {
horizontal = args[0]->BooleanValue();
} else if (args.Length() == 2) {
horizontal = args[0]->BooleanValue();
vertical = args[1]->BooleanValue();
-=======
+ }
#if 0
// ### refactor
// blur the alpha channel
@@ -2188,7 +2180,6 @@ static v8::Handle<v8::Value> ctx2d_imageData_mirror(const v8::Arguments &args)
qt_blurImage(&blurPainter, shadowImg, state.shadowBlur, false, true);
blurPainter.end();
shadowImg = blurred;
->>>>>>> refactor
}
#endif
@@ -2266,7 +2257,9 @@ static v8::Handle<v8::Value> ctx2d_imageData_filter(const v8::Arguments &args)
blurred.fill(Qt::transparent);
QPainter blurPainter(&blurred);
+#if 0
qt_blurImage(&blurPainter, r->image, blur, true, false);
+#endif
blurPainter.end();
r->image = blurred;
}
@@ -2832,9 +2825,9 @@ static int textAlignOffset(QSGContext2D::TextAlignType value, const QFontMetrics
{
int offset = 0;
if (value == QSGContext2D::Start)
- value = QApplication::layoutDirection() == Qt::LeftToRight ? QSGContext2D::Left : QSGContext2D::Right;
+ value = QGuiApplication::layoutDirection() == Qt::LeftToRight ? QSGContext2D::Left : QSGContext2D::Right;
else if (value == QSGContext2D::End)
- value = QApplication::layoutDirection() == Qt::LeftToRight ? QSGContext2D::Right: QSGContext2D::Left;
+ value = QGuiApplication::layoutDirection() == Qt::LeftToRight ? QSGContext2D::Right: QSGContext2D::Left;
switch (value) {
case QSGContext2D::QSGContext2D::Center:
offset = metrics.width(text)/2;
diff --git a/src/declarative/items/context2d/qsgcontext2dcommandbuffer.cpp b/src/declarative/items/context2d/qsgcontext2dcommandbuffer.cpp
index 8eb9513433..0448fa01c7 100644
--- a/src/declarative/items/context2d/qsgcontext2dcommandbuffer.cpp
+++ b/src/declarative/items/context2d/qsgcontext2dcommandbuffer.cpp
@@ -42,7 +42,6 @@
#include "qsgcontext2dcommandbuffer_p.h"
#include "qsgcanvasitem_p.h"
#include "qdeclarative.h"
-#include <QtGui/QApplication>
#include <QtCore/QMutex>
#define HAS_SHADOW(offsetX, offsetY, blur, color) (color.isValid() && color.alpha() && (blur || offsetX || offsetY))
@@ -65,7 +64,9 @@ static QImage makeShadowImage(const QImage& image, qreal offsetX, qreal offsetY,
QImage blurred(shadowImg.size(), QImage::Format_ARGB32);
blurred.fill(0);
QPainter blurPainter(&blurred);
+#if 0
qt_blurImage(&blurPainter, shadowImg, blur, true, false);
+#endif
blurPainter.end();
shadowImg = blurred;
}
diff --git a/src/declarative/items/context2d/qsgcontext2dtexture.cpp b/src/declarative/items/context2d/qsgcontext2dtexture.cpp
index 6e2c7c3e3c..920ab9b0f1 100644
--- a/src/declarative/items/context2d/qsgcontext2dtexture.cpp
+++ b/src/declarative/items/context2d/qsgcontext2dtexture.cpp
@@ -4,9 +4,10 @@
#include "qsgitem_p.h"
#include "private/qsgtexture_p.h"
#include "qsgcontext2dcommandbuffer_p.h"
+#include <QOpenGLPaintDevice>
-#include <QtOpenGL/QGLFramebufferObject>
-#include <QtOpenGL/QGLFramebufferObjectFormat>
+#include <QOpenGLFramebufferObject>
+#include <QOpenGLFramebufferObjectFormat>
#include <QtCore/QThread>
#define QT_MINIMUM_FBO_SIZE 64
@@ -361,6 +362,7 @@ void QSGContext2DTexture::clearTiles()
QSGContext2DFBOTexture::QSGContext2DFBOTexture()
: QSGContext2DTexture()
, m_fbo(0)
+ , m_paint_device(0)
{
m_threadRendering = false;
}
@@ -492,7 +494,7 @@ void QSGContext2DFBOTexture::compositeTile(QSGContext2DTile* tile)
source.moveTo(source.topLeft() - t->rect().topLeft());
target.moveTo(target.topLeft() - m_canvasWindow.topLeft());
- QGLFramebufferObject::blitFramebuffer(m_fbo, target, t->fbo(), source);
+ QOpenGLFramebufferObject::blitFramebuffer(m_fbo, target, t->fbo(), source);
}
}
QSGCanvasItem::RenderTarget QSGContext2DFBOTexture::renderTarget() const
@@ -507,8 +509,8 @@ QPaintDevice* QSGContext2DFBOTexture::beginPainting()
delete m_fbo;
m_fbo = 0;
} else if (!m_fbo || m_fbo->size() != m_fboSize) {
- QGLFramebufferObjectFormat format;
- format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
+ QOpenGLFramebufferObjectFormat format;
+ format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
format.setInternalTextureFormat(GL_RGBA);
format.setMipmap(false);
format.setTextureTarget(GL_TEXTURE_2D);
@@ -516,11 +518,17 @@ QPaintDevice* QSGContext2DFBOTexture::beginPainting()
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
- m_fbo = new QGLFramebufferObject(m_fboSize, format);
+ m_fbo = new QOpenGLFramebufferObject(m_fboSize, format);
glBindTexture(GL_TEXTURE_2D, m_fbo->texture());
updateBindOptions(false);
}
- return m_fbo;
+
+ m_fbo->bind();
+
+ if (!m_paint_device)
+ m_paint_device = new QOpenGLPaintDevice(m_fbo->size());
+
+ return m_paint_device;
}
void qt_quit_context2d_render_thread()
diff --git a/src/declarative/items/context2d/qsgcontext2dtexture_p.h b/src/declarative/items/context2d/qsgcontext2dtexture_p.h
index 50e5be774d..0fb315497a 100644
--- a/src/declarative/items/context2d/qsgcontext2dtexture_p.h
+++ b/src/declarative/items/context2d/qsgcontext2dtexture_p.h
@@ -46,8 +46,8 @@
#include "qsgcanvasitem_p.h"
#include "qsgcontext2d_p.h"
-#include <QtOpenGL/QGLContext>
-#include <QtOpenGL/QGLFramebufferObject>
+#include <QOpenGLContext>
+#include <QOpenGLFramebufferObject>
#include <QtCore/QMutex>
#include <QtCore/QWaitCondition>
@@ -152,10 +152,11 @@ private Q_SLOTS:
private:
QImage m_grabedImage;
- QGLFramebufferObject *m_fbo;
+ QOpenGLFramebufferObject *m_fbo;
QMutex m_mutex;
QWaitCondition m_condition;
QSize m_fboSize;
+ QPaintDevice *m_paint_device;
};
class QSGPlainTexture;
diff --git a/src/declarative/items/context2d/qsgcontext2dtile.cpp b/src/declarative/items/context2d/qsgcontext2dtile.cpp
index 695c30f211..14051b62c1 100644
--- a/src/declarative/items/context2d/qsgcontext2dtile.cpp
+++ b/src/declarative/items/context2d/qsgcontext2dtile.cpp
@@ -41,8 +41,9 @@
#include "qsgcontext2dtile_p.h"
-#include <QtOpenGL/QGLFramebufferObject>
-#include <QtOpenGL/QGLFramebufferObjectFormat>
+#include <QOpenGLFramebufferObject>
+#include <QOpenGLFramebufferObjectFormat>
+#include <QOpenGLPaintDevice>
QSGContext2DTile::QSGContext2DTile()
: m_dirty(true)
@@ -63,6 +64,7 @@ QPainter* QSGContext2DTile::createPainter(bool smooth)
m_painter.end();
if (m_device) {
+ aboutToDraw();
m_painter.begin(m_device);
m_painter.resetTransform();
m_painter.setCompositionMode(QPainter::CompositionMode_Source);
@@ -97,11 +99,21 @@ QSGContext2DFBOTile::QSGContext2DFBOTile()
{
}
+
QSGContext2DFBOTile::~QSGContext2DFBOTile()
{
delete m_fbo;
}
+void QSGContext2DFBOTile::aboutToDraw()
+{
+ m_fbo->bind();
+ if (!m_device) {
+ m_device = new QOpenGLPaintDevice(rect().size());
+ }
+}
+
+
void QSGContext2DFBOTile::setRect(const QRect& r)
{
if (m_rect == r)
@@ -109,8 +121,8 @@ void QSGContext2DFBOTile::setRect(const QRect& r)
m_rect = r;
m_dirty = true;
if (!m_fbo || m_fbo->size() != r.size()) {
- QGLFramebufferObjectFormat format;
- format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
+ QOpenGLFramebufferObjectFormat format;
+ format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
format.setInternalTextureFormat(GL_RGBA);
format.setMipmap(false);
@@ -118,9 +130,8 @@ void QSGContext2DFBOTile::setRect(const QRect& r)
m_painter.end();
delete m_fbo;
- m_fbo = new QGLFramebufferObject(r.size(), format);
+ m_fbo = new QOpenGLFramebufferObject(r.size(), format);
}
- m_device = m_fbo;
}
diff --git a/src/declarative/items/context2d/qsgcontext2dtile_p.h b/src/declarative/items/context2d/qsgcontext2dtile_p.h
index cee2125f73..d5317f9357 100644
--- a/src/declarative/items/context2d/qsgcontext2dtile_p.h
+++ b/src/declarative/items/context2d/qsgcontext2dtile_p.h
@@ -43,7 +43,7 @@
#define QSGCONTEXT2DTILE_P_H
#include "qsgcontext2d_p.h"
-#include <QtOpenGL/QGLFramebufferObject>
+#include <QOpenGLFramebufferObject>
QT_BEGIN_HEADER
@@ -68,7 +68,10 @@ public:
virtual void setRect(const QRect& r) = 0;
virtual QPainter* createPainter(bool smooth = false);
+
protected:
+ virtual void aboutToDraw() {}
+
uint m_dirty : 1;
QRect m_rect;
QPaintDevice* m_device;
@@ -82,9 +85,15 @@ public:
QSGContext2DFBOTile();
~QSGContext2DFBOTile();
virtual void setRect(const QRect& r);
- QGLFramebufferObject* fbo() const {return m_fbo;}
+ QOpenGLFramebufferObject* fbo() const {return m_fbo;}
+
+protected:
+ void aboutToDraw();
+
private:
- QGLFramebufferObject *m_fbo;
+
+
+ QOpenGLFramebufferObject *m_fbo;
};
class QSGContext2DImageTile : public QSGContext2DTile
diff --git a/src/declarative/particles/qsgcustomparticle.cpp b/src/declarative/particles/qsgcustomparticle.cpp
index e0bbf28862..174942d7ff 100644
--- a/src/declarative/particles/qsgcustomparticle.cpp
+++ b/src/declarative/particles/qsgcustomparticle.cpp
@@ -477,14 +477,8 @@ QSGShaderEffectNode* QSGCustomParticle::buildCustomNodes()
}
s.vertexCode = qt_particles_template_vertex_code + s.vertexCode;
-<<<<<<< HEAD
- m_material.setProgramSource(s);
- foreach (const QString &str, m_groups){
-=======
m_material->setProgramSource(s);
-
- foreach (const QString &str, m_particles){
->>>>>>> refactor
+ foreach (const QString &str, m_groups){
int gIdx = m_system->m_groupIds[str];
int count = m_system->m_groupData[gIdx]->size();
//Create Particle Geometry