2010-08-17 Sheriff Bot <webkit.review.bot@gmail.com>
authorsenorblanco@chromium.org <senorblanco@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Aug 2010 19:51:11 +0000 (19:51 +0000)
committersenorblanco@chromium.org <senorblanco@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Aug 2010 19:51:11 +0000 (19:51 +0000)
        Unreviewed, rolling out r65528.
        http://trac.webkit.org/changeset/65528
        https://bugs.webkit.org/show_bug.cgi?id=44123

        "Broke a bunch of canvas tests on Chrome win/linux."
        (Requested by senorblanco on #webkit).

        * platform/graphics/skia/BitmapImageSingleFrameSkia.h:
        (WebCore::BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia):
        * platform/graphics/skia/ImageBufferSkia.cpp:
        (WebCore::ImageBuffer::drawsUsingCopy):
        (WebCore::ImageBuffer::copyImage):
        (WebCore::ImageBuffer::draw):
        (WebCore::ImageBuffer::drawPattern):
        * platform/graphics/skia/ImageSkia.cpp:
        (WebCore::BitmapImageSingleFrameSkia::create):
        * platform/graphics/skia/NativeImageSkia.cpp:
        * platform/graphics/skia/NativeImageSkia.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@65531 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h
WebCore/platform/graphics/skia/ImageBufferSkia.cpp
WebCore/platform/graphics/skia/ImageSkia.cpp
WebCore/platform/graphics/skia/NativeImageSkia.cpp
WebCore/platform/graphics/skia/NativeImageSkia.h

index 2481b9f..83126b1 100644 (file)
@@ -1,3 +1,24 @@
+2010-08-17  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r65528.
+        http://trac.webkit.org/changeset/65528
+        https://bugs.webkit.org/show_bug.cgi?id=44123
+
+        "Broke a bunch of canvas tests on Chrome win/linux."
+        (Requested by senorblanco on #webkit).
+
+        * platform/graphics/skia/BitmapImageSingleFrameSkia.h:
+        (WebCore::BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia):
+        * platform/graphics/skia/ImageBufferSkia.cpp:
+        (WebCore::ImageBuffer::drawsUsingCopy):
+        (WebCore::ImageBuffer::copyImage):
+        (WebCore::ImageBuffer::draw):
+        (WebCore::ImageBuffer::drawPattern):
+        * platform/graphics/skia/ImageSkia.cpp:
+        (WebCore::BitmapImageSingleFrameSkia::create):
+        * platform/graphics/skia/NativeImageSkia.cpp:
+        * platform/graphics/skia/NativeImageSkia.h:
+
 2010-08-17  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by David Hyatt.
index 553f203..9fb6a8b 100644 (file)
@@ -46,10 +46,9 @@ namespace WebCore {
 // is that NativeImagePtr = NativeImageSkia, yet callers have SkBitmap.
 class BitmapImageSingleFrameSkia : public Image {
 public:
-    // 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);
+    // Creates a new Image, by copying the pixel values out of |bitmap|.
+    // If creation failed, returns null.
+    static PassRefPtr<BitmapImageSingleFrameSkia> create(const SkBitmap&);
 
     virtual bool isBitmapImage() const { return true; }
 
@@ -78,8 +77,8 @@ protected:
 private:
     NativeImageSkia m_nativeImage;
 
-    // Creates a new Image from the given SkBitmap, using a shallow copy.
-    explicit BitmapImageSingleFrameSkia(const SkBitmap&);
+    // Use create().
+    BitmapImageSingleFrameSkia() { }
 };
 
 } // namespace WebCore
index 1d3d5cb..a63eec5 100644 (file)
@@ -89,13 +89,12 @@ GraphicsContext* ImageBuffer::context() const
 
 bool ImageBuffer::drawsUsingCopy() const
 {
-    return false;
+    return true;
 }
 
 PassRefPtr<Image> ImageBuffer::copyImage() const
 {
-    ASSERT_NOT_REACHED();
-    return 0;
+    return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap());
 }
 
 void ImageBuffer::clip(GraphicsContext* context, const FloatRect& rect) const
@@ -108,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> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context);
-    context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale);
+    RefPtr<Image> imageCopy = copyImage();
+    context->drawImage(imageCopy.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> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context);
-    image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
+    RefPtr<Image> imageCopy = copyImage();
+    imageCopy->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
 }
 
 void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable)
index 6bbad5e..b514b1a 100644 (file)
@@ -516,19 +516,11 @@ void BitmapImageSingleFrameSkia::draw(GraphicsContext* ctxt,
                   WebCoreCompositeToSkiaComposite(compositeOp));
 }
 
-BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia(const SkBitmap& bitmap)
-    : m_nativeImage(bitmap)
+PassRefPtr<BitmapImageSingleFrameSkia> BitmapImageSingleFrameSkia::create(const SkBitmap& bitmap)
 {
-}
-
-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));
+    RefPtr<BitmapImageSingleFrameSkia> image(adoptRef(new BitmapImageSingleFrameSkia()));
+    bitmap.copyTo(&image->m_nativeImage, bitmap.config());
+    return image.release();
 }
 
 }  // namespace WebCore
index 9effa5c..0c62c16 100644 (file)
@@ -44,14 +44,6 @@ 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();
index e26a5ea..0718836 100644 (file)
@@ -43,11 +43,6 @@ 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;