[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:18:01 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 894b553f8005b916a610f7632def1fc4423affc5
Author: senorblanco at chromium.org <senorblanco at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 18 18:11:17 2010 +0000

    2010-08-17  Stephen White  <senorblanco at chromium.org>
    
            Reviewed by Darin Fisher.
    
            [CHROMIUM] Eliminate a memcpy() from the canvas.drawImage(canvas, ...) path.
            https://bugs.webkit.org/show_bug.cgi?id=44115
    
            This is the Skia followup to Dave Hyatt's patch in r65449.
            Covered by canvas layout tests.
    
            * platform/graphics/skia/BitmapImageSingleFrameSkia.h:
            Add a "copyPixels" argument to the create() static to indicate if
            the caller wants the pixels to be copied or ref'ed.
            * platform/graphics/skia/ImageBufferSkia.cpp:
            (WebCore::ImageBuffer::drawsUsingCopy):
            We don't use the always-copy path anymore, so return false.
            (WebCore::ImageBuffer::copyImage):
            Force a copy here.
            (WebCore::ImageBuffer::draw):
            (WebCore::ImageBuffer::drawPattern):
            Create a temporary BitampImageSingleFrameSkia wrapped around the
            canvas's bitmap, and draw with it immediately.  If drawing to our own
            canvas, copy the pixels, otherwise just shallow copy.
            * platform/graphics/skia/ImageSkia.cpp:
            (WebCore::BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia):
            Make the constructor take an SkBitmap to be wrapped.
            (WebCore::BitmapImageSingleFrameSkia::create):
            Implement the "copyPixels" flag:  if true, do a deep copy, otherwise
            do a shallow copy.
            * platform/graphics/skia/NativeImageSkia.cpp:
            (WebCore::NativeImageSkia::NativeImageSkia):
            * platform/graphics/skia/NativeImageSkia.h:
            Implement a new constructor that shallow-copies the given SkBitmap.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65617 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 21a5891..6b4155e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,73 @@
+2010-08-17  Stephen White  <senorblanco at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [CHROMIUM] Eliminate a memcpy() from the canvas.drawImage(canvas, ...) path.
+        https://bugs.webkit.org/show_bug.cgi?id=44115
+
+        This is the Skia followup to Dave Hyatt's patch in r65449.
+        Covered by canvas layout tests.
+
+        * platform/graphics/skia/BitmapImageSingleFrameSkia.h:
+        Add a "copyPixels" argument to the create() static to indicate if
+        the caller wants the pixels to be copied or ref'ed.
+        * platform/graphics/skia/ImageBufferSkia.cpp:
+        (WebCore::ImageBuffer::drawsUsingCopy):
+        We don't use the always-copy path anymore, so return false.
+        (WebCore::ImageBuffer::copyImage):
+        Force a copy here.
+        (WebCore::ImageBuffer::draw):
+        (WebCore::ImageBuffer::drawPattern):
+        Create a temporary BitampImageSingleFrameSkia wrapped around the
+        canvas's bitmap, and draw with it immediately.  If drawing to our own
+        canvas, copy the pixels, otherwise just shallow copy.
+        * platform/graphics/skia/ImageSkia.cpp:
+        (WebCore::BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia):
+        Make the constructor take an SkBitmap to be wrapped.
+        (WebCore::BitmapImageSingleFrameSkia::create):
+        Implement the "copyPixels" flag:  if true, do a deep copy, otherwise
+        do a shallow copy.
+        * platform/graphics/skia/NativeImageSkia.cpp:
+        (WebCore::NativeImageSkia::NativeImageSkia):
+        * platform/graphics/skia/NativeImageSkia.h:
+        Implement a new constructor that shallow-copies the given SkBitmap.
+
+<<<<<<< .mine
+2010-08-17  Stephen White  <senorblanco at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [CHROMIUM] Eliminate a memcpy() from the canvas.drawImage(canvas, ...) path.
+        https://bugs.webkit.org/show_bug.cgi?id=44115
+        This is the Skia followup to Dave Hyatt's patch in r65449.
+
+        Covered by canvas layout tests.
+
+        * platform/graphics/skia/BitmapImageSingleFrameSkia.h:
+        Add a "copyPixels" argument to the create() static to indicate if
+        the caller wants the pixels to be copied or ref'ed.
+        * platform/graphics/skia/ImageBufferSkia.cpp:
+        (WebCore::ImageBuffer::drawsUsingCopy):
+        We don't use the always-copy path anymore, so return false.
+        (WebCore::ImageBuffer::copyImage):
+        Force a copy here.
+        (WebCore::ImageBuffer::draw):
+        (WebCore::ImageBuffer::drawPattern):
+        Create a temporary BitampImageSingleFrameSkia wrapped around the
+        canvas's bitmap, and draw with it immediately.  If drawing to our own
+        canvas, copy the pixels, otherwise just shallow copy.
+        * platform/graphics/skia/ImageSkia.cpp:
+        (WebCore::BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia):
+        Make the constructor take an SkBitmap to be wrapped.
+        (WebCore::BitmapImageSingleFrameSkia::create):
+        Implement the "copyPixels" flag:  if true, do a deep copy, otherwise
+        do a shallow copy.
+        * platform/graphics/skia/NativeImageSkia.cpp:
+        (WebCore::NativeImageSkia::NativeImageSkia):
+        * platform/graphics/skia/NativeImageSkia.h:
+        Implement a new constructor that shallow-copies the given SkBitmap.
+
+=======
 2010-08-18  Mahesh Kulkarni  <mahesh.kulkarni at nokia.com>
 
         Reviewed by Steve Block.
@@ -592,6 +662,7 @@
         * rendering/RenderBlock.cpp:
         (WebCore::RenderBlock::removeChild):
 
+>>>>>>> .r65561
 2010-08-17  Darin Fisher  <darin at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h b/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h
index 9fb6a8b..553f203 100644
--- a/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h
+++ b/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h
@@ -46,9 +46,10 @@ namespace WebCore {
 // is that NativeImagePtr = NativeImageSkia, yet callers have SkBitmap.
 class BitmapImageSingleFrameSkia : public Image {
 public:
-    // Creates a new Image, by copying the pixel values out of |bitmap|.
-    // If creation failed, returns null.
-    static PassRefPtr<BitmapImageSingleFrameSkia> create(const SkBitmap&);
+    // Creates a new Image from the given SkBitmap.  If "copyPixels" is true, a
+    // deep copy is done.  Otherwise, a shallow copy is done (pixel data is
+    // ref'ed).
+    static PassRefPtr<BitmapImageSingleFrameSkia> create(const SkBitmap&, bool copyPixels);
 
     virtual bool isBitmapImage() const { return true; }
 
@@ -77,8 +78,8 @@ protected:
 private:
     NativeImageSkia m_nativeImage;
 
-    // Use create().
-    BitmapImageSingleFrameSkia() { }
+    // Creates a new Image from the given SkBitmap, using a shallow copy.
+    explicit BitmapImageSingleFrameSkia(const SkBitmap&);
 };
 
 } // namespace WebCore
diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
index a63eec5..19cf0f0 100644
--- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
@@ -89,12 +89,12 @@ GraphicsContext* ImageBuffer::context() const
 
 bool ImageBuffer::drawsUsingCopy() const
 {
-    return true;
+    return false;
 }
 
 PassRefPtr<Image> ImageBuffer::copyImage() const
 {
-    return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap());
+    return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), true);
 }
 
 void ImageBuffer::clip(GraphicsContext* context, const FloatRect& rect) const
@@ -107,15 +107,15 @@ void ImageBuffer::clip(GraphicsContext* context, const FloatRect& rect) const
 void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect,
                        CompositeOperator op, bool useLowQualityScale)
 {
-    RefPtr<Image> imageCopy = copyImage();
-    context->drawImage(imageCopy.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale);
+    RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context);
+    context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale);
 }
 
 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
                               const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
 {
-    RefPtr<Image> imageCopy = copyImage();
-    imageCopy->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
+    RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context);
+    image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
 }
 
 void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable)
diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp
index b514b1a..6bbad5e 100644
--- a/WebCore/platform/graphics/skia/ImageSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageSkia.cpp
@@ -516,11 +516,19 @@ void BitmapImageSingleFrameSkia::draw(GraphicsContext* ctxt,
                   WebCoreCompositeToSkiaComposite(compositeOp));
 }
 
-PassRefPtr<BitmapImageSingleFrameSkia> BitmapImageSingleFrameSkia::create(const SkBitmap& bitmap)
+BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia(const SkBitmap& bitmap)
+    : m_nativeImage(bitmap)
 {
-    RefPtr<BitmapImageSingleFrameSkia> image(adoptRef(new BitmapImageSingleFrameSkia()));
-    bitmap.copyTo(&image->m_nativeImage, bitmap.config());
-    return image.release();
+}
+
+PassRefPtr<BitmapImageSingleFrameSkia> BitmapImageSingleFrameSkia::create(const SkBitmap& bitmap, bool copyPixels)
+{
+    if (copyPixels) {
+        SkBitmap temp;
+        bitmap.copyTo(&temp, bitmap.config());
+        return adoptRef(new BitmapImageSingleFrameSkia(temp));
+    }
+    return adoptRef(new BitmapImageSingleFrameSkia(bitmap));
 }
 
 }  // namespace WebCore
diff --git a/WebCore/platform/graphics/skia/NativeImageSkia.cpp b/WebCore/platform/graphics/skia/NativeImageSkia.cpp
index 0c62c16..9effa5c 100644
--- a/WebCore/platform/graphics/skia/NativeImageSkia.cpp
+++ b/WebCore/platform/graphics/skia/NativeImageSkia.cpp
@@ -44,6 +44,14 @@ NativeImageSkia::NativeImageSkia()
 {
 }
 
+NativeImageSkia::NativeImageSkia(const SkBitmap& other)
+    : SkBitmap(other),
+      m_isDataComplete(false),
+      m_lastRequestSize(0, 0),
+      m_resizeRequests(0)
+{
+}
+
 int NativeImageSkia::decodedSize() const
 {
     return getSize() + m_resizedImage.getSize();
diff --git a/WebCore/platform/graphics/skia/NativeImageSkia.h b/WebCore/platform/graphics/skia/NativeImageSkia.h
index 0718836..e26a5ea 100644
--- a/WebCore/platform/graphics/skia/NativeImageSkia.h
+++ b/WebCore/platform/graphics/skia/NativeImageSkia.h
@@ -43,6 +43,11 @@ class NativeImageSkia : public SkBitmap {
 public:
     NativeImageSkia();
 
+    // This constructor does a shallow copy of the passed-in SkBitmap (ie., it
+    // references the same pixel data and bumps the refcount).  Use only when
+    // you want sharing semantics.
+    explicit NativeImageSkia(const SkBitmap&);
+
     // Returns the number of bytes of image data. This includes the cached
     // resized version if there is one.
     int decodedSize() const;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list