| Differences between
and this patch
- a/Source/WebCore/ChangeLog +27 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-04-10  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
2
3
        [Qt] Fix issues when using the WebView as ShaderEffectSource
4
        https://bugs.webkit.org/show_bug.cgi?id=83587
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        - Make sure that the bound frame buffer is preserved instead of binding
9
          to the default one
10
        - Accept a "mirrored" flag in beginPainting that we're applying on the
11
          projection matrix just as with internal FBOs
12
13
        The "flip" logic in createProjectionMatrix has been reversed and renamed to
14
        mirrored so that FBO rendering is considered the special case and not the
15
        other way around just like within Qt.
16
17
        * platform/graphics/texmap/TextureMapper.h:
18
        (WebCore::TextureMapper::beginPainting):
19
        * platform/graphics/texmap/TextureMapperGL.cpp:
20
        (WebCore::TextureMapperGLData::TextureMapperGLData):
21
        (TextureMapperGLData):
22
        (WebCore::TextureMapperGL::beginPainting):
23
        (WebCore::createProjectionMatrix):
24
        (WebCore::BitmapTextureGL::bind):
25
        (WebCore::TextureMapperGL::bindSurface):
26
        * platform/graphics/texmap/TextureMapperGL.h:
27
1
2012-04-10  Ilya Tikhonovsky  <loislo@chromium.org>
28
2012-04-10  Ilya Tikhonovsky  <loislo@chromium.org>
2
29
3
        Web Inspector: use maxJSObjectId that is provided by back-end.
30
        Web Inspector: use maxJSObjectId that is provided by back-end.
- a/Source/WebKit2/ChangeLog +18 lines
Lines 1-5 a/Source/WebKit2/ChangeLog_sec1
1
2012-04-10  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
1
2012-04-10  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
2
2
3
        [Qt] Fix issues when using the WebView as ShaderEffectSource
4
        https://bugs.webkit.org/show_bug.cgi?id=83587
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Qt is going to mirror the projection matrix when the shader effect source
9
        is grabbed. Detect that the matrix is mirrored and pass on this information
10
        to TextureMapper so that it can do the same.
11
12
        * UIProcess/WebLayerTreeRenderer.cpp:
13
        (WebKit::WebLayerTreeRenderer::paintToCurrentGLContext):
14
        * UIProcess/WebLayerTreeRenderer.h:
15
        (WebLayerTreeRenderer):
16
        * UIProcess/qt/QtWebPageSGNode.cpp:
17
        (WebKit::ContentsSGNode::render):
18
19
2012-04-10  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
20
3
        [Qt] Remove unnecessary rendering code
21
        [Qt] Remove unnecessary rendering code
4
        https://bugs.webkit.org/show_bug.cgi?id=83591
22
        https://bugs.webkit.org/show_bug.cgi?id=83591
5
23
- a/Source/WebCore/platform/graphics/texmap/TextureMapper.h -1 / +6 lines
Lines 103-108 class TextureMapper { a/Source/WebCore/platform/graphics/texmap/TextureMapper.h_sec1
103
103
104
public:
104
public:
105
    enum AccelerationMode { SoftwareMode, OpenGLMode };
105
    enum AccelerationMode { SoftwareMode, OpenGLMode };
106
    enum PaintingFlag {
107
        PaintingMirrored = 1 << 0,
108
    };
109
    typedef unsigned PaintingFlags;
110
106
    static PassOwnPtr<TextureMapper> create(AccelerationMode newMode = SoftwareMode);
111
    static PassOwnPtr<TextureMapper> create(AccelerationMode newMode = SoftwareMode);
107
    virtual ~TextureMapper() { }
112
    virtual ~TextureMapper() { }
108
113
Lines 123-129 public: a/Source/WebCore/platform/graphics/texmap/TextureMapper.h_sec2
123
    TextDrawingModeFlags textDrawingMode() const { return m_textDrawingMode; }
128
    TextDrawingModeFlags textDrawingMode() const { return m_textDrawingMode; }
124
    virtual AccelerationMode accelerationMode() const = 0;
129
    virtual AccelerationMode accelerationMode() const = 0;
125
130
126
    virtual void beginPainting() { }
131
    virtual void beginPainting(PaintingFlags flags = 0) { }
127
    virtual void endPainting() { }
132
    virtual void endPainting() { }
128
133
129
    virtual IntSize maxTextureSize() const { return IntSize(INT_MAX, INT_MAX); }
134
    virtual IntSize maxTextureSize() const { return IntSize(INT_MAX, INT_MAX); }
- a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp -8 / +18 lines
Lines 187-193 struct TextureMapperGLData { a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec1
187
    void initializeStencil();
187
    void initializeStencil();
188
188
189
    TextureMapperGLData()
189
    TextureMapperGLData()
190
        : previousProgram(0)
190
        : paintingFlags(0)
191
        , previousProgram(0)
192
        , targetFrameBuffer(0)
191
        , didModifyStencil(false)
193
        , didModifyStencil(false)
192
        , previousScissorState(0)
194
        , previousScissorState(0)
193
        , previousDepthState(0)
195
        , previousDepthState(0)
Lines 195-201 struct TextureMapperGLData { a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec2
195
    { }
197
    { }
196
198
197
    TransformationMatrix projectionMatrix;
199
    TransformationMatrix projectionMatrix;
200
    TextureMapper::PaintingFlags paintingFlags;
198
    GLint previousProgram;
201
    GLint previousProgram;
202
    GLint targetFrameBuffer;
199
    bool didModifyStencil;
203
    bool didModifyStencil;
200
    GLint previousScissorState;
204
    GLint previousScissorState;
201
    GLint previousDepthState;
205
    GLint previousDepthState;
Lines 226-232 TextureMapperGL::TextureMapperGL() a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec3
226
{
230
{
227
}
231
}
228
232
229
void TextureMapperGL::beginPainting()
233
void TextureMapperGL::beginPainting(PaintingFlags flags)
230
{
234
{
231
    // Make sure that no GL error code stays from previous operations.
235
    // Make sure that no GL error code stays from previous operations.
232
    glGetError();
236
    glGetError();
Lines 251-256 void TextureMapperGL::beginPainting() a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec4
251
    GL_CMD(glGetIntegerv(GL_SCISSOR_BOX, data().previousScissor));
255
    GL_CMD(glGetIntegerv(GL_SCISSOR_BOX, data().previousScissor));
252
    data().sharedGLData().clipState.stencilIndex = 1;
256
    data().sharedGLData().clipState.stencilIndex = 1;
253
    data().sharedGLData().clipState.scissorBox = IntRect(0, 0, data().viewport[2], data().viewport[3]);
257
    data().sharedGLData().clipState.scissorBox = IntRect(0, 0, data().viewport[2], data().viewport[3]);
258
    glGetIntegerv(GL_FRAMEBUFFER_BINDING, &data().targetFrameBuffer);
259
    data().paintingFlags = flags;
254
    bindSurface(0);
260
    bindSurface(0);
255
}
261
}
256
262
Lines 491-505 void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect, co a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec5
491
497
492
}
498
}
493
499
494
static inline TransformationMatrix createProjectionMatrix(const IntSize& size, bool flip)
500
static inline TransformationMatrix createProjectionMatrix(const IntSize& size, bool mirrored)
495
{
501
{
496
    const float near = 9999999;
502
    const float near = 9999999;
497
    const float far = -99999;
503
    const float far = -99999;
498
504
499
    return TransformationMatrix(2.0 / float(size.width()), 0, 0, 0,
505
    return TransformationMatrix(2.0 / float(size.width()), 0, 0, 0,
500
                                0, (flip ? -2.0 : 2.0) / float(size.height()), 0, 0,
506
                                0, (mirrored ? 2.0 : -2.0) / float(size.height()), 0, 0,
501
                                0, 0, -2.f / (far - near), 0,
507
                                0, 0, -2.f / (far - near), 0,
502
                                -1, flip ? 1 : -1, -(far + near) / (far - near), 1);
508
                                -1, mirrored ? -1 : 1, -(far + near) / (far - near), 1);
503
}
509
}
504
510
505
void BitmapTextureGL::initializeStencil()
511
void BitmapTextureGL::initializeStencil()
Lines 534-540 void BitmapTextureGL::bind() a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec6
534
        GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo));
540
        GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo));
535
541
536
    GL_CMD(glViewport(0, 0, size().width(), size().height()));
542
    GL_CMD(glViewport(0, 0, size().width(), size().height()));
537
    m_textureMapper->data().projectionMatrix = createProjectionMatrix(size(), false);
543
    const bool mirrored = true;
544
    m_textureMapper->data().projectionMatrix = createProjectionMatrix(size(), mirrored);
538
    m_textureMapper->beginClip(TransformationMatrix(), FloatRect(IntPoint::zero(), contentSize()));
545
    m_textureMapper->beginClip(TransformationMatrix(), FloatRect(IntPoint::zero(), contentSize()));
539
}
546
}
540
547
Lines 570-579 void TextureMapperGL::bindSurface(BitmapTexture *surfacePointer) a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec7
570
    BitmapTextureGL* surface = static_cast<BitmapTextureGL*>(surfacePointer);
577
    BitmapTextureGL* surface = static_cast<BitmapTextureGL*>(surfacePointer);
571
578
572
    if (!surface) {
579
    if (!surface) {
580
        GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, data().targetFrameBuffer));
581
573
        IntSize viewportSize(data().viewport[2], data().viewport[3]);
582
        IntSize viewportSize(data().viewport[2], data().viewport[3]);
574
        GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, 0));
583
        const bool mirorred = data().paintingFlags & PaintingMirrored;
575
        data().projectionMatrix = createProjectionMatrix(viewportSize, true);
584
        data().projectionMatrix = createProjectionMatrix(viewportSize, mirorred);
576
        GL_CMD(glViewport(0, 0, viewportSize.width(), viewportSize.height()));
585
        GL_CMD(glViewport(0, 0, viewportSize.width(), viewportSize.height()));
586
577
        if (data().currentSurface)
587
        if (data().currentSurface)
578
            endClip();
588
            endClip();
579
        data().currentSurface.clear();
589
        data().currentSurface.clear();
- a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h -1 / +1 lines
Lines 52-58 public: a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h_sec1
52
    virtual void drawTexture(uint32_t texture, Flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, const BitmapTexture* maskTexture);
52
    virtual void drawTexture(uint32_t texture, Flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, const BitmapTexture* maskTexture);
53
    virtual void bindSurface(BitmapTexture* surface);
53
    virtual void bindSurface(BitmapTexture* surface);
54
    virtual void beginClip(const TransformationMatrix&, const FloatRect&);
54
    virtual void beginClip(const TransformationMatrix&, const FloatRect&);
55
    virtual void beginPainting();
55
    virtual void beginPainting(PaintingFlags = 0);
56
    virtual void endPainting();
56
    virtual void endPainting();
57
    virtual void endClip();
57
    virtual void endClip();
58
    virtual IntSize maxTextureSize() { return IntSize(2000, 2000); }
58
    virtual IntSize maxTextureSize() { return IntSize(2000, 2000); }
- a/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp -2 / +2 lines
Lines 91-97 PassOwnPtr<GraphicsLayer> WebLayerTreeRenderer::createLayer(WebLayerID layerID) a/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp_sec1
91
    return adoptPtr(newLayer);
91
    return adoptPtr(newLayer);
92
}
92
}
93
93
94
void WebLayerTreeRenderer::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect)
94
void WebLayerTreeRenderer::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect, TextureMapper::PaintingFlags paintingFlags)
95
{
95
{
96
    if (!m_textureMapper)
96
    if (!m_textureMapper)
97
        m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
97
        m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
Lines 108-114 void WebLayerTreeRenderer::paintToCurrentGLContext(const TransformationMatrix& m a/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp_sec2
108
        return;
108
        return;
109
109
110
    layer->setTextureMapper(m_textureMapper.get());
110
    layer->setTextureMapper(m_textureMapper.get());
111
    m_textureMapper->beginPainting();
111
    m_textureMapper->beginPainting(paintingFlags);
112
    m_textureMapper->beginClip(TransformationMatrix(), clipRect);
112
    m_textureMapper->beginClip(TransformationMatrix(), clipRect);
113
113
114
    if (currentRootLayer->opacity() != opacity || currentRootLayer->transform() != matrix) {
114
    if (currentRootLayer->opacity() != opacity || currentRootLayer->transform() != matrix) {
- a/Source/WebKit2/UIProcess/WebLayerTreeRenderer.h -1 / +1 lines
Lines 61-67 public: a/Source/WebKit2/UIProcess/WebLayerTreeRenderer.h_sec1
61
    WebLayerTreeRenderer(LayerTreeHostProxy*);
61
    WebLayerTreeRenderer(LayerTreeHostProxy*);
62
    virtual ~WebLayerTreeRenderer();
62
    virtual ~WebLayerTreeRenderer();
63
    void purgeGLResources();
63
    void purgeGLResources();
64
    void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float, const WebCore::FloatRect&);
64
    void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float, const WebCore::FloatRect&, WebCore::TextureMapper::PaintingFlags = 0);
65
    void paintToGraphicsContext(BackingStore::PlatformGraphicsContext);
65
    void paintToGraphicsContext(BackingStore::PlatformGraphicsContext);
66
    void syncRemoteContent();
66
    void syncRemoteContent();
67
    void setVisibleContentsRect(const WebCore::IntRect&, float scale);
67
    void setVisibleContentsRect(const WebCore::IntRect&, float scale);
- a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp -2 / +9 lines
Lines 26-31 a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp_sec1
26
#include <QtQuick/QSGSimpleRectNode>
26
#include <QtQuick/QSGSimpleRectNode>
27
#include <private/qsgrendernode_p.h>
27
#include <private/qsgrendernode_p.h>
28
28
29
using namespace WebCore;
30
29
namespace WebKit {
31
namespace WebKit {
30
32
31
class ContentsSGNode : public QSGRenderNode {
33
class ContentsSGNode : public QSGRenderNode {
Lines 40-51 public: a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp_sec2
40
        return StateFlags(StencilState) | ColorState | BlendState;
42
        return StateFlags(StencilState) | ColorState | BlendState;
41
    }
43
    }
42
44
43
    virtual void render(const RenderState&)
45
    virtual void render(const RenderState& state)
44
    {
46
    {
45
        QMatrix4x4 renderMatrix = matrix() ? *matrix() : QMatrix4x4();
47
        QMatrix4x4 renderMatrix = matrix() ? *matrix() : QMatrix4x4();
46
48
49
        // When rendering to an intermediate surface, Qt will
50
        // mirror the projection matrix to fit on the destination coordinate system.
51
        const QMatrix4x4* projection = state.projectionMatrix;
52
        bool mirrored = projection && (*projection)(0, 0) * (*projection)(1, 1) - (*projection)(0, 1) * (*projection)(1, 0) > 0;
53
47
        // FIXME: Support non-rectangular clippings.
54
        // FIXME: Support non-rectangular clippings.
48
        layerTreeRenderer()->paintToCurrentGLContext(renderMatrix, inheritedOpacity(), clipRect());
55
        layerTreeRenderer()->paintToCurrentGLContext(renderMatrix, inheritedOpacity(), clipRect(), mirrored ? TextureMapper::PaintingMirrored : 0);
49
    }
56
    }
50
57
51
    ~ContentsSGNode()
58
    ~ContentsSGNode()

Return to Bug 83587