[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

senorblanco at chromium.org senorblanco at chromium.org
Sun Feb 20 22:45:54 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 2b5f85a38ed8a306021e0c7ca6a10c6bc0245d33
Author: senorblanco at chromium.org <senorblanco at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 11 03:29:15 2011 +0000

    2011-01-10  Stephen White  <senorblanco at chromium.org>
    
            Reviewed by James Robinson.
    
            Fix canvas->canvas draws on the GPU path.
            https://bugs.webkit.org/show_bug.cgi?id=52141
    
            Two problems:  according to the canvas spec, both source and
            destination rects can have negative width or height, but this shouldn't
            cause the image to be flipped.  So we need to normalize the rects (in
            the software path, this is done by BitmapImage*::draw).  Secondly, in
            the FBO->FBO path, the image needs to be flipped vertically, since it
            is drawn upside down.  We were doing this by flipping the destination
            rect, but this doesn't work if the source rect is not the entire image,
            since we extract the wrong part of the image.  Fixed by flipping the
            source rect instead (and flipping it within the image buffer's height,
            not the source rect's height).
    
            Covered by fast/canvas/drawImage-with-negative-source-destination.html.
    
    
            * platform/graphics/skia/BitmapImageSingleFrameSkia.h:
            Put normalizeRect() in global scope.
            * platform/graphics/skia/ImageBufferSkia.cpp:
            (WebCore::ImageBuffer::draw):
            Fix as above:  normalize both source and dest rects, and flip the
            source rect instead of the dest rect.
            * platform/graphics/skia/ImageSkia.cpp:
            (WebCore::normalizeRect):
            Put normalizeRect() in global scope.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75469 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 9a5e9b7..a10239d 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,34 @@
+2011-01-10  Stephen White  <senorblanco at chromium.org>
+
+        Reviewed by James Robinson.
+
+        Fix canvas->canvas draws on the GPU path.
+        https://bugs.webkit.org/show_bug.cgi?id=52141
+        
+        Two problems:  according to the canvas spec, both source and
+        destination rects can have negative width or height, but this shouldn't
+        cause the image to be flipped.  So we need to normalize the rects (in
+        the software path, this is done by BitmapImage*::draw).  Secondly, in
+        the FBO->FBO path, the image needs to be flipped vertically, since it
+        is drawn upside down.  We were doing this by flipping the destination
+        rect, but this doesn't work if the source rect is not the entire image,
+        since we extract the wrong part of the image.  Fixed by flipping the
+        source rect instead (and flipping it within the image buffer's height,
+        not the source rect's height).
+
+        Covered by fast/canvas/drawImage-with-negative-source-destination.html.
+
+
+        * platform/graphics/skia/BitmapImageSingleFrameSkia.h:
+        Put normalizeRect() in global scope.
+        * platform/graphics/skia/ImageBufferSkia.cpp:
+        (WebCore::ImageBuffer::draw):
+        Fix as above:  normalize both source and dest rects, and flip the
+        source rect instead of the dest rect.
+        * platform/graphics/skia/ImageSkia.cpp:
+        (WebCore::normalizeRect):
+        Put normalizeRect() in global scope.
+
 2011-01-10  Laszlo Gombos  <laszlo.1.gombos at nokia.com>
 
         Reviewed by Csaba Osztrogonác.
diff --git a/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h b/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h
index 553f203..974f126 100644
--- a/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h
+++ b/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h
@@ -82,6 +82,8 @@ private:
     explicit BitmapImageSingleFrameSkia(const SkBitmap&);
 };
 
+FloatRect normalizeRect(const FloatRect&);
+
 } // namespace WebCore
 
 #endif  // BitmapImageSingleFrameSkia_h
diff --git a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
index a9f6d3c..b65b5bd 100644
--- a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
+++ b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
@@ -114,11 +114,12 @@ void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, con
         if (context->platformContext()->canAccelerate()) {
             DrawingBuffer* sourceDrawingBuffer = m_data.m_platformContext.gpuCanvas()->drawingBuffer();
             unsigned sourceTexture = static_cast<unsigned>(sourceDrawingBuffer->platformColorBuffer());
-            FloatRect destRectFlipped(destRect);
-            destRectFlipped.setY(destRect.y() + destRect.height());
-            destRectFlipped.setHeight(-destRect.height());
+            FloatRect destRectNormalized(normalizeRect(destRect));
+            FloatRect srcRectFlipped(normalizeRect(srcRect));
+            srcRectFlipped.setY(m_size.height() - srcRect.y());
+            srcRectFlipped.setHeight(-srcRect.height());
             context->platformContext()->prepareForHardwareDraw();
-            context->platformContext()->gpuCanvas()->drawTexturedRect(sourceTexture, m_size, srcRect, destRectFlipped, styleColorSpace, op);
+            context->platformContext()->gpuCanvas()->drawTexturedRect(sourceTexture, m_size, srcRectFlipped, destRectNormalized, styleColorSpace, op);
             return;
         }
         m_data.m_platformContext.syncSoftwareCanvas();
diff --git a/Source/WebCore/platform/graphics/skia/ImageSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageSkia.cpp
index c7fa6f4..91a4e4f 100644
--- a/Source/WebCore/platform/graphics/skia/ImageSkia.cpp
+++ b/Source/WebCore/platform/graphics/skia/ImageSkia.cpp
@@ -298,7 +298,7 @@ static void TransformDimensions(const SkMatrix& matrix, float srcWidth, float sr
 }
 
 // A helper method for translating negative width and height values.
-static FloatRect normalizeRect(const FloatRect& rect)
+FloatRect normalizeRect(const FloatRect& rect)
 {
     FloatRect norm = rect;
     if (norm.width() < 0) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list