diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-09-09 10:20:41 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-09-09 10:20:41 (GMT) |
commit | 94bdab6ac2b47f4e4301dff83f43e1b68d587a61 (patch) | |
tree | 34089f7b4b7c532ab0929ddf7d9d9c6ec3c7c284 /src | |
parent | 6fd22a76e8e687cbe9b78b8810a7bedef38c9995 (diff) | |
parent | 5a242e8a8cd1c23991da3df288c4e91b06532d43 (diff) | |
download | Qt-94bdab6ac2b47f4e4301dff83f43e1b68d587a61.zip Qt-94bdab6ac2b47f4e4301dff83f43e1b68d587a61.tar.gz Qt-94bdab6ac2b47f4e4301dff83f43e1b68d587a61.tar.bz2 |
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp | 3 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 5 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 2 | ||||
-rw-r--r-- | src/opengl/qglframebufferobject.cpp | 4 | ||||
-rw-r--r-- | src/opengl/qpaintengine_opengl.cpp | 48 | ||||
-rw-r--r-- | src/opengl/qpaintengine_opengl_p.h | 3 |
6 files changed, 47 insertions, 18 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp index 3af4a29..c538eb1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp @@ -586,13 +586,14 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV unsigned bytecodeOffsetTemp = bytecodeOffset; CodeBlock *codeBlockTemp = codeBlock; while (!(handler = codeBlockTemp->handlerForBytecodeOffset(bytecodeOffsetTemp))) { + void* returnPC = callFrameTemp->returnPC(); callFrameTemp = callFrameTemp->callerFrame(); if (callFrameTemp->hasHostCallFrameFlag()) { hasHandler = false; break; } else { codeBlockTemp = callFrameTemp->codeBlock(); - bytecodeOffsetTemp = bytecodeOffsetForPC(callFrameTemp, codeBlockTemp, callFrameTemp->returnPC()); + bytecodeOffsetTemp = bytecodeOffsetForPC(callFrameTemp, codeBlockTemp, returnPC); } } if (debugger) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 78d184f..c87941b 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -423,8 +423,9 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() const QPixmap& texPixmap = currentBrush->texture(); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); + QGLTexture *tex = ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); + textureInvertedY = tex->options & QGLContext::InvertedYBindOption ? -1 : 1; } brushTextureDirty = false; } @@ -517,7 +518,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); } - QSizeF invertedTextureSize( 1.0 / texPixmap.width(), 1.0 / texPixmap.height() ); + QSizeF invertedTextureSize(1.0 / texPixmap.width(), 1.0 * textureInvertedY / texPixmap.height()); shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::InvertedTextureSize), invertedTextureSize); QVector2D halfViewportSize(width*0.5, height*0.5); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index da16e47..34f4eb8 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -262,6 +262,8 @@ public: bool needsSync; bool inRenderText; + + float textureInvertedY; }; QT_END_NAMESPACE diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index f14fa4d..094f675 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -382,7 +382,6 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, { QGLContext *currentContext = const_cast<QGLContext *>(QGLContext::currentContext()); ctx = QGLContextPrivate::contextGroup(currentContext); - glDevice.setFBO(q); bool ext_detected = (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject); if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(currentContext))) @@ -644,7 +643,6 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, GLenum target) : d_ptr(new QGLFramebufferObjectPrivate) { Q_D(QGLFramebufferObject); - d->glDevice.setFBO(this); d->init(this, size, NoAttachment, target, DEFAULT_FORMAT); } @@ -654,7 +652,7 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, QMacCompatGLenum t : d_ptr(new QGLFramebufferObjectPrivate) { Q_D(QGLFramebufferObject); - d->init(size, NoAttachment, target, DEFAULT_FORMAT); + d->init(this, size, NoAttachment, target, DEFAULT_FORMAT); } #endif diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index f1169fd..15cfcfc 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4300,8 +4300,10 @@ void QOpenGLPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QR else { GLenum target = qt_gl_preferredTextureTarget(); d->flushDrawQueue(); - d->device->context()->bindTexture(pm, target); - drawTextureRect(pm.width(), pm.height(), r, sr, target); + QGLTexture *tex = + d->device->context()->d_func()->bindTexture(pm, target, GL_RGBA, + QGLContext::InternalBindOption); + drawTextureRect(pm.width(), pm.height(), r, sr, target, tex); } } @@ -4333,10 +4335,13 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con } else { d->flushDrawQueue(); + QGLTexture *tex; if (scaled.isNull()) - d->device->context()->bindTexture(pm); + tex = d->device->context()->d_func()->bindTexture(pm, GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption); else - d->device->context()->bindTexture(scaled); + tex = d->device->context()->d_func()->bindTexture(scaled, GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, d->use_smooth_pixmap_transform); #ifndef QT_OPENGL_ES @@ -4349,6 +4354,15 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con GLdouble tc_w = r.width()/pm.width(); GLdouble tc_h = r.height()/pm.height(); + // Rotate the texture so that it is aligned correctly and the + // wrapping is done correctly + if (tex->options & QGLContext::InvertedYBindOption) { + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glRotatef(180.0, 0.0, 1.0, 0.0); + glRotatef(180.0, 0.0, 0.0, 1.0); + } + q_vertexType vertexArray[4*2]; q_vertexType texCoordArray[4*2]; @@ -4367,6 +4381,8 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); + if (tex->options & QGLContext::InvertedYBindOption) + glPopMatrix(); glDisable(GL_TEXTURE_2D); #ifndef QT_OPENGL_ES @@ -4402,13 +4418,15 @@ void QOpenGLPaintEngine::drawImage(const QRectF &r, const QImage &image, const Q else { GLenum target = qt_gl_preferredTextureTarget(); d->flushDrawQueue(); - d->device->context()->bindTexture(image, target); - drawTextureRect(image.width(), image.height(), r, sr, target); + QGLTexture *tex = + d->device->context()->d_func()->bindTexture(image, target, GL_RGBA, + QGLContext::InternalBindOption); + drawTextureRect(image.width(), image.height(), r, sr, target, tex); } } void QOpenGLPaintEngine::drawTextureRect(int tx_width, int tx_height, const QRectF &r, - const QRectF &sr, GLenum target) + const QRectF &sr, GLenum target, QGLTexture *tex) { Q_D(QOpenGLPaintEngine); #ifndef QT_OPENGL_ES @@ -4423,8 +4441,13 @@ void QOpenGLPaintEngine::drawTextureRect(int tx_width, int tx_height, const QRec if (target == GL_TEXTURE_2D) { x1 = sr.x() / tx_width; x2 = x1 + sr.width() / tx_width; - y1 = 1 - (sr.bottom() / tx_height); - y2 = 1 - (sr.y() / tx_height); + if (tex->options & QGLContext::InvertedYBindOption) { + y1 = 1 - (sr.bottom() / tx_height); + y2 = 1 - (sr.y() / tx_height); + } else { + y1 = sr.bottom() / tx_height; + y2 = sr.y() / tx_height; + } } else { x1 = sr.x(); x2 = sr.right(); @@ -5179,9 +5202,12 @@ void QOpenGLPaintEnginePrivate::composite(GLuint primitive, const q_vertexType * glActiveTexture(GL_TEXTURE0 + brush_texture_location); if (current_style == Qt::TexturePattern) - device->context()->bindTexture(cbrush.textureImage()); + device->context()->d_func()->bindTexture(cbrush.textureImage(), GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption); else - device->context()->bindTexture(qt_imageForBrush(current_style, true)); + device->context()->d_func()->bindTexture(qt_imageForBrush(current_style, true), + GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, use_smooth_pixmap_transform); } diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h index 1cac3ad..13299da 100644 --- a/src/opengl/qpaintengine_opengl_p.h +++ b/src/opengl/qpaintengine_opengl_p.h @@ -146,7 +146,8 @@ public: private: void drawPolyInternal(const QPolygonF &pa, bool close = true); - void drawTextureRect(int tx_width, int tx_height, const QRectF &r, const QRectF &sr, GLenum target); + void drawTextureRect(int tx_width, int tx_height, const QRectF &r, const QRectF &sr, + GLenum target, QGLTexture *tex); Q_DISABLE_COPY(QOpenGLPaintEngine) }; |