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

thakis at chromium.org thakis at chromium.org
Wed Dec 22 13:24:55 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 77be5cd0814661430d04173c80d605792d7d8712
Author: thakis at chromium.org <thakis at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 14 21:02:06 2010 +0000

    2010-09-14  Nico Weber  <thakis at chromium.org>
    
            Reviewed by Kenneth Russell.
    
            [chromium]: On Mac, let image layer data row order match skia.
            https://bugs.webkit.org/show_bug.cgi?id=45400
    
            Make CoreGraphics texture row order match skia's row order, remove all
            code that worked around this difference. This also fixes a problem where
            image layers would be drawn upside down.
    
            Covered by existing layout tests, but we don't run these with
            compositing yet.
    
            * platform/graphics/chromium/ContentLayerChromium.cpp:
            (WebCore::ContentLayerChromium::SharedValues::SharedValues):
            (WebCore::ContentLayerChromium::updateContents):
            (WebCore::ContentLayerChromium::updateTextureRect):
            * platform/graphics/chromium/LayerRendererChromium.cpp:
            (WebCore::LayerRendererChromium::setRootLayerCanvasSize):
            (WebCore::LayerRendererChromium::drawLayers):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67493 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b05e980..1dff5d6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-09-14  Nico Weber  <thakis at chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        [chromium]: On Mac, let image layer data row order match skia.
+        https://bugs.webkit.org/show_bug.cgi?id=45400
+
+        Make CoreGraphics texture row order match skia's row order, remove all
+        code that worked around this difference. This also fixes a problem where
+        image layers would be drawn upside down.
+
+        Covered by existing layout tests, but we don't run these with
+        compositing yet.
+
+        * platform/graphics/chromium/ContentLayerChromium.cpp:
+        (WebCore::ContentLayerChromium::SharedValues::SharedValues):
+        (WebCore::ContentLayerChromium::updateContents):
+        (WebCore::ContentLayerChromium::updateTextureRect):
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::setRootLayerCanvasSize):
+        (WebCore::LayerRendererChromium::drawLayers):
+
 2010-09-14  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Tony Chang.
diff --git a/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
index 48119bb..4928898 100644
--- a/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
@@ -71,8 +71,8 @@ ContentLayerChromium::SharedValues::SharedValues()
         "}                            \n";
 
     // Note differences between Skia and Core Graphics versions:
-    //  - Skia uses BGRA and origin is upper left
-    //  - Core Graphics uses RGBA and origin is lower left
+    //  - Skia uses BGRA
+    //  - Core Graphics uses RGBA
     char fragmentShaderString[] =
         "precision mediump float;                            \n"
         "varying vec2 v_texCoord;                            \n"
@@ -80,11 +80,10 @@ ContentLayerChromium::SharedValues::SharedValues()
         "uniform float alpha;                                \n"
         "void main()                                         \n"
         "{                                                   \n"
-#if PLATFORM(SKIA)
         "  vec4 texColor = texture2D(s_texture, v_texCoord); \n"
+#if PLATFORM(SKIA)
         "  gl_FragColor = vec4(texColor.z, texColor.y, texColor.x, texColor.w) * alpha; \n"
 #elif PLATFORM(CG)
-        "  vec4 texColor = texture2D(s_texture, vec2(v_texCoord.x, 1.0 - v_texCoord.y)); \n"
         "  gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w) * alpha; \n"
 #else
 #error "Need to implement for your platform."
@@ -207,11 +206,13 @@ void ContentLayerChromium::updateContents()
                                                                      dirtyRect.width(), dirtyRect.height(), 8, rowBytes,
                                                                      colorSpace.get(),
                                                                      kCGImageAlphaPremultipliedLast));
+    CGContextTranslateCTM(contextCG.get(), 0, dirtyRect.height());
+    CGContextScaleCTM(contextCG.get(), 1, -1);
 
     GraphicsContext graphicsContext(contextCG.get());
     LocalCurrentGraphicsContext scopedNSGraphicsContext(&graphicsContext);
 
-    // Translate the graphics contxt into the coordinate system of the dirty rect.
+    // Translate the graphics context into the coordinate system of the dirty rect.
     graphicsContext.translate(-dirtyRect.x(), -dirtyRect.y());
 
     m_owner->paintGraphicsLayerContents(graphicsContext, dirtyRect);
@@ -248,17 +249,7 @@ void ContentLayerChromium::updateTextureRect(void* pixels, const IntSize& bitmap
     } else {
         ASSERT(updateRect.width() <= m_allocatedTextureSize.width() && updateRect.height() <= m_allocatedTextureSize.height());
         ASSERT(updateRect.width() == bitmapSize.width() && updateRect.height() == bitmapSize.height());
-#if PLATFORM(CG)
-        // The origin is at the lower left in Core Graphics' coordinate system. We need to correct for this here.
-        GLC(glTexSubImage2D(GL_TEXTURE_2D, 0,
-                            updateRect.x(), m_allocatedTextureSize.height() - updateRect.height() - updateRect.y(),
-                            updateRect.width(), updateRect.height(),
-                            GL_RGBA, GL_UNSIGNED_BYTE, pixels));
-#elif PLATFORM(SKIA)
         GLC(glTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, pixels));
-#else
-#error "Need to implement for your platform."
-#endif
     }
 
     m_dirtyRect.setSize(FloatSize());
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index 51c0e49..79df7b4 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -138,6 +138,8 @@ void LayerRendererChromium::setRootLayerCanvasSize(const IntSize& size)
                                                        size.width(), size.height(), 8, rowBytes,
                                                        colorSpace.get(),
                                                        kCGImageAlphaPremultipliedLast));
+    CGContextTranslateCTM(m_rootLayerCGContext.get(), 0, size.height());
+    CGContextScaleCTM(m_rootLayerCGContext.get(), 1, -1);
     m_rootLayerGraphicsContext = new GraphicsContext(m_rootLayerCGContext.get());
 #else
 #error "Need to implement for your platform."
@@ -204,19 +206,9 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons
         // pixels of the content area (visible area excluding the scroll bars) back into the
         // root layer texture. The newly exposed area will be filled by a subsequent drawLayersIntoRect call
         TransformationMatrix scrolledLayerMatrix;
-#if PLATFORM(SKIA)
-        float scaleFactor = 1.0f;
-#elif PLATFORM(CG)
-        // Because the contents of the OpenGL texture are inverted
-        // vertically compared to the Skia backend, we need to move
-        // the backing store in the opposite direction.
-        float scaleFactor = -1.0f;
-#else
-#error "Need to implement for your platform."
-#endif
 
         scrolledLayerMatrix.translate3d(0.5 * visibleRect.width() - scrollDelta.x(),
-            0.5 * visibleRect.height() + scaleFactor * scrollDelta.y(), 0);
+            0.5 * visibleRect.height() + scrollDelta.y(), 0);
         scrolledLayerMatrix.scale3d(1, -1, 1);
 
         useShader(m_scrollShaderProgram);
@@ -265,22 +257,15 @@ void LayerRendererChromium::updateRootLayerTextureRect(const IntRect& updateRect
     int bitmapHeight = bitmap.height();
     ASSERT(bitmapWidth == updateRect.width() && bitmapHeight == updateRect.height());
     void* pixels = bitmap.getPixels();
-    // Copy the contents of the updated rect to the root layer texture.
-    GLC(glTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, pixels));
 #elif PLATFORM(CG)
     // Get the contents of the updated rect.
     ASSERT(static_cast<int>(CGBitmapContextGetWidth(m_rootLayerCGContext.get())) == updateRect.width() && static_cast<int>(CGBitmapContextGetHeight(m_rootLayerCGContext.get())) == updateRect.height());
     void* pixels = m_rootLayerBackingStore.data();
-
-    // Copy the contents of the updated rect to the root layer texture.
-    // The origin is at the lower left in Core Graphics' coordinate system. We need to correct for this here.
-    GLC(glTexSubImage2D(GL_TEXTURE_2D, 0,
-                        updateRect.x(), m_rootLayerTextureHeight - updateRect.y() - updateRect.height(),
-                        updateRect.width(), updateRect.height(),
-                        GL_RGBA, GL_UNSIGNED_BYTE, pixels));
 #else
 #error "Need to implement for your platform."
 #endif
+    // Copy the contents of the updated rect to the root layer texture.
+    GLC(glTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, pixels));
 }
 
 void LayerRendererChromium::drawLayers(const IntRect& visibleRect, const IntRect& contentRect)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list