[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

senorblanco at chromium.org senorblanco at chromium.org
Wed Dec 22 12:26:45 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b65a8617ff4f35f33718ae1470ed74a49d851acd
Author: senorblanco at chromium.org <senorblanco at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 23 22:23:42 2010 +0000

    2010-08-20  Stephen White  <senorblanco at chromium.org>
    
            Reviewed by Kenneth Russell.
    
            [CHROMIUM] Fix some failing layout tests w/ACCELERATED_2D_CANVAS
            https://bugs.webkit.org/show_bug.cgi?id=44346
    
            LayoutTests/fast/canvas/canvas-incremental-repaint.html (top middle
            pane).
            Failing because we were not applying the CTM in clearRect().  Now using
            the fast path when the CTM is identity, and a fillRect() for the rest.
            LayoutTests/fast/canvas/canvas-strokeRect.html
            LayoutTests/fast/canvas/shadow-offset-[1-7].html
            Failing because we weren't switching to the software path when a
            shadow is present.
            Also refactor the two versions of fillRect(), and use TRIANGLE_STRIP
            strip instead of TRIANGLES, which lets us get rid of the element array
            and use drawArrays() instead of drawElements().
    
            Covered by the above layout tests.
    
            * platform/graphics/chromium/GLES2Canvas.cpp:
            (WebCore::GLES2Canvas::GLES2Canvas):
            (WebCore::GLES2Canvas::~GLES2Canvas):
            Remove m_quadIndices (now unused).
            (WebCore::GLES2Canvas::clearRect):
            Use a glClear() fast path for the identity-CTM clear, and fillRect()
            for the rest.
            (WebCore::GLES2Canvas::fillRect):
            Refactor the two versions of fillRect().
            (WebCore::GLES2Canvas::drawTexturedRect):
            (WebCore::GLES2Canvas::drawTexturedRectTile):
            Get rid of the ELEMENT_ARRAY_BUFFER bind.  Use drawArrays() instead of
            drawElements().
            (WebCore::GLES2Canvas::getQuadVertices):
            Re-order the vertices so they form a triangle strip.
            * platform/graphics/chromium/GLES2Canvas.h:
            Remove m_quadIndices (now unused).
            * platform/graphics/skia/GraphicsContextSkia.cpp:
            (WebCore::GraphicsContext::fillRect):
            Check for a draw looper (shadow), and drop to the software path.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65836 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7425b04..1946383 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,45 @@
+2010-08-20  Stephen White  <senorblanco at chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        [CHROMIUM] Fix some failing layout tests w/ACCELERATED_2D_CANVAS
+        https://bugs.webkit.org/show_bug.cgi?id=44346
+
+        LayoutTests/fast/canvas/canvas-incremental-repaint.html (top middle
+        pane).
+        Failing because we were not applying the CTM in clearRect().  Now using
+        the fast path when the CTM is identity, and a fillRect() for the rest.
+        LayoutTests/fast/canvas/canvas-strokeRect.html
+        LayoutTests/fast/canvas/shadow-offset-[1-7].html
+        Failing because we weren't switching to the software path when a 
+        shadow is present.
+        Also refactor the two versions of fillRect(), and use TRIANGLE_STRIP
+        strip instead of TRIANGLES, which lets us get rid of the element array
+        and use drawArrays() instead of drawElements().
+
+        Covered by the above layout tests.
+
+        * platform/graphics/chromium/GLES2Canvas.cpp:
+        (WebCore::GLES2Canvas::GLES2Canvas):
+        (WebCore::GLES2Canvas::~GLES2Canvas):
+        Remove m_quadIndices (now unused).
+        (WebCore::GLES2Canvas::clearRect):
+        Use a glClear() fast path for the identity-CTM clear, and fillRect()
+        for the rest.
+        (WebCore::GLES2Canvas::fillRect):
+        Refactor the two versions of fillRect().
+        (WebCore::GLES2Canvas::drawTexturedRect):
+        (WebCore::GLES2Canvas::drawTexturedRectTile):
+        Get rid of the ELEMENT_ARRAY_BUFFER bind.  Use drawArrays() instead of
+        drawElements().
+        (WebCore::GLES2Canvas::getQuadVertices):
+        Re-order the vertices so they form a triangle strip.
+        * platform/graphics/chromium/GLES2Canvas.h:
+        Remove m_quadIndices (now unused).
+        * platform/graphics/skia/GraphicsContextSkia.cpp:
+        (WebCore::GraphicsContext::fillRect):
+        Check for a draw looper (shadow), and drop to the software path.
+
 2010-08-23  Patrick Gansterer  <paroga at paroga.com>
 
         Reviewed by Adam Roben.
diff --git a/WebCore/platform/graphics/chromium/GLES2Canvas.cpp b/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
index 534de7b..24e1f98 100644
--- a/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
+++ b/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
@@ -79,7 +79,6 @@ struct GLES2Canvas::State {
 GLES2Canvas::GLES2Canvas(GraphicsContext3D* context, const IntSize& size)
     : m_context(context)
     , m_quadVertices(0)
-    , m_quadIndices(0)
     , m_simpleProgram(0)
     , m_texProgram(0)
     , m_simpleMatrixLocation(-1)
@@ -111,40 +110,33 @@ GLES2Canvas::~GLES2Canvas()
     m_context->deleteProgram(m_simpleProgram);
     m_context->deleteProgram(m_texProgram);
     m_context->deleteBuffer(m_quadVertices);
-    m_context->deleteBuffer(m_quadIndices);
 }
 
 void GLES2Canvas::clearRect(const FloatRect& rect)
 {
-    m_context->scissor(rect.x(), rect.y(), rect.width(), rect.height());
-    m_context->enable(GraphicsContext3D::SCISSOR_TEST);
-    m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
-    m_context->disable(GraphicsContext3D::SCISSOR_TEST);
+    if (m_state->m_ctm.isIdentity()) {
+        m_context->scissor(rect.x(), rect.y(), rect.width(), rect.height());
+        m_context->enable(GraphicsContext3D::SCISSOR_TEST);
+        m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
+        m_context->disable(GraphicsContext3D::SCISSOR_TEST);
+    } else {
+        save();
+        setCompositeOperation(CompositeClear);
+        fillRect(rect, Color(RGBA32(0)), DeviceColorSpace);
+        restore();
+    }
 }
 
 void GLES2Canvas::fillRect(const FloatRect& rect, const Color& color, ColorSpace colorSpace)
 {
-    m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, getQuadVertices());
-    m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, getQuadIndices());
-
-    float rgba[4];
-    color.getRGBA(rgba[0], rgba[1], rgba[2], rgba[3]);
-    m_context->uniform4f(m_simpleColorLocation, rgba[0] * rgba[3], rgba[1] * rgba[3], rgba[2] * rgba[3], rgba[3]);
-
-    m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0);
-}
-
-void GLES2Canvas::fillRect(const FloatRect& rect)
-{
     applyCompositeOperator(m_state->m_compositeOp);
 
     m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, getQuadVertices());
-    m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, getQuadIndices());
 
     m_context->useProgram(getSimpleProgram());
 
     float rgba[4];
-    m_state->m_fillColor.getRGBA(rgba[0], rgba[1], rgba[2], rgba[3]);
+    color.getRGBA(rgba[0], rgba[1], rgba[2], rgba[3]);
     m_context->uniform4f(m_simpleColorLocation, rgba[0] * rgba[3], rgba[1] * rgba[3], rgba[2] * rgba[3], rgba[3]);
 
     AffineTransform matrix(m_flipMatrix);
@@ -159,7 +151,12 @@ void GLES2Canvas::fillRect(const FloatRect& rect)
 
     m_context->enableVertexAttribArray(m_simplePositionLocation);
 
-    m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0);
+    m_context->drawArrays(GraphicsContext3D::TRIANGLE_STRIP, 0, 4);
+}
+
+void GLES2Canvas::fillRect(const FloatRect& rect)
+{
+    fillRect(rect, m_state->m_fillColor, DeviceColorSpace);
 }
 
 void GLES2Canvas::setFillColor(const Color& color, ColorSpace colorSpace)
@@ -215,7 +212,6 @@ void GLES2Canvas::drawTexturedRect(GLES2Texture* texture, const FloatRect& srcRe
     applyCompositeOperator(compositeOp);
 
     m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, getQuadVertices());
-    m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, getQuadIndices());
     checkGLError("glBindBuffer");
 
     m_context->useProgram(getTexProgram());
@@ -275,8 +271,8 @@ void GLES2Canvas::drawTexturedRectTile(GLES2Texture* texture, int tile, const Fl
     m_context->uniformMatrix3fv(m_texTexMatrixLocation, false /*transpose*/, texMat, 1 /*count*/);
     checkGLError("glUniformMatrix3fv");
 
-    m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0);
-    checkGLError("glDrawElements");
+    m_context->drawArrays(GraphicsContext3D::TRIANGLE_STRIP, 0, 4);
+    checkGLError("glDrawArrays");
 }
 
 void GLES2Canvas::setCompositeOperation(CompositeOperator op)
@@ -351,8 +347,8 @@ unsigned GLES2Canvas::getQuadVertices()
     if (!m_quadVertices) {
         float vertices[] = { 0.0f, 0.0f, 1.0f,
                              1.0f, 0.0f, 1.0f,
-                             1.0f, 1.0f, 1.0f,
-                             0.0f, 1.0f, 1.0f };
+                             0.0f, 1.0f, 1.0f,
+                             1.0f, 1.0f, 1.0f };
         m_quadVertices = m_context->createBuffer();
         RefPtr<Float32Array> vertexArray = Float32Array::create(vertices, sizeof(vertices) / sizeof(float));
         m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_quadVertices);
@@ -362,19 +358,6 @@ unsigned GLES2Canvas::getQuadVertices()
 }
 
 
-unsigned GLES2Canvas::getQuadIndices()
-{
-    if (!m_quadIndices) {
-        unsigned short indices[] = { 0, 1, 2, 0, 2, 3};
-
-        m_quadIndices = m_context->createBuffer();
-        RefPtr<Uint16Array> indexArray = Uint16Array::create(indices, sizeof(indices) / sizeof(unsigned short));
-        m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, m_quadIndices);
-        m_context->bufferData(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, indexArray.get(), GraphicsContext3D::STATIC_DRAW);
-    }
-    return m_quadIndices;
-}
-
 static unsigned loadShader(GraphicsContext3D* context, unsigned type, const char* shaderSource)
 {
     unsigned shader = context->createShader(type);
diff --git a/WebCore/platform/graphics/chromium/GLES2Canvas.h b/WebCore/platform/graphics/chromium/GLES2Canvas.h
index 0ad07fc..d00510a 100644
--- a/WebCore/platform/graphics/chromium/GLES2Canvas.h
+++ b/WebCore/platform/graphics/chromium/GLES2Canvas.h
@@ -85,7 +85,6 @@ private:
     void applyCompositeOperator(CompositeOperator);
     void checkGLError(const char* header);
     unsigned getQuadVertices();
-    unsigned getQuadIndices();
     unsigned getSimpleProgram();
     unsigned getTexProgram();
 
@@ -94,7 +93,6 @@ private:
     WTF::Vector<State> m_stateStack;
     State* m_state;
     unsigned m_quadVertices;
-    unsigned m_quadIndices;
     unsigned m_simpleProgram;
     unsigned m_texProgram;
     int m_simpleMatrixLocation;
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index da687ba..1b20e26 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -781,7 +781,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
     }
 
 #if USE(GLES2_RENDERING)
-    if (platformContext()->useGPU() && !m_common->state.fillPattern && !m_common->state.fillGradient) {
+    if (platformContext()->useGPU() && !m_common->state.fillPattern && !m_common->state.fillGradient && !platformContext()->getDrawLooper()) {
         platformContext()->prepareForHardwareDraw();
         platformContext()->gpuCanvas()->fillRect(rect);
         return;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list