[Chromium] Bad cast from BitmapImageSingleFrameSkia to BitmapImage
authorch.dumez@sisa.samsung.com <ch.dumez@sisa.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Apr 2013 21:08:30 +0000 (21:08 +0000)
committerch.dumez@sisa.samsung.com <ch.dumez@sisa.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Apr 2013 21:08:30 +0000 (21:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=113492

Reviewed by Stephen White.

Source/WebCore:

Remove BitmapImageSingleFrameSkia and have ImageBufferSkia construct
BitmapImage objects instead via an intermediate NativeImageSkia.

No new tests, covered by existing tests.

* WebCore.gypi:
* platform/graphics/filters/skia/FEGaussianBlurSkia.cpp: Remove
include for BitmapImageSingleFrameSkia.h header.
* platform/graphics/skia/BitmapImageSingleFrameSkia.cpp: Removed.
* platform/graphics/skia/BitmapImageSingleFrameSkia.h: Removed.
* platform/graphics/skia/ImageBufferSkia.cpp: Construct BitmapImage
objects instead of BitmapImageSingleFrameSkia ones.
(WebCore::ImageBuffer::copyImage):
(WebCore::drawNeedsCopy):
(WebCore::ImageBuffer::draw):
(WebCore::ImageBuffer::drawPattern):
* platform/graphics/skia/ImageSkia.cpp:
(WebCore::BitmapImage::BitmapImage): Implement BitmapImage constructor
that takes an NativeImageSkia* in argument.
(WebCore):
(WebCore::BitmapImage::draw): Remove m_source.initialized() check as
this will return false for BitmapImage objects constructed from a
NativeImageSkia, due to the lack of decoder.
* platform/graphics/skia/NativeImageSkia.cpp:
(WebCore::NativeImageSkia::NativeImageSkia): Add parameter to the
NativeImageSkia constructor so that the caller can request a deep copy
instead of a shallow one. This is needed by the ImageBuffer.
* platform/graphics/skia/NativeImageSkia.h:
* platform/image-decoders/ImageDecoder.h:
(WebCore::ImageFrame::setSkBitmap):

Source/WebKit/chromium:

Update test now that BitmapImageSingleFrameSkia no longer exists.
BitmapImage is now used instead.

* tests/PlatformContextSkiaTest.cpp:
(WebCore::TEST):

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

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/platform/graphics/filters/skia/FEGaussianBlurSkia.cpp
Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.cpp [deleted file]
Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h [deleted file]
Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
Source/WebCore/platform/graphics/skia/ImageSkia.cpp
Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp
Source/WebCore/platform/graphics/skia/NativeImageSkia.h
Source/WebCore/platform/image-decoders/ImageDecoder.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp

index 8bc2f66..61eebf7 100644 (file)
@@ -1,3 +1,41 @@
+2013-04-03  Christophe Dumez  <ch.dumez@sisa.samsung.com>
+
+        [Chromium] Bad cast from BitmapImageSingleFrameSkia to BitmapImage
+        https://bugs.webkit.org/show_bug.cgi?id=113492
+
+        Reviewed by Stephen White.
+
+        Remove BitmapImageSingleFrameSkia and have ImageBufferSkia construct
+        BitmapImage objects instead via an intermediate NativeImageSkia.
+
+        No new tests, covered by existing tests.
+
+        * WebCore.gypi:
+        * platform/graphics/filters/skia/FEGaussianBlurSkia.cpp: Remove
+        include for BitmapImageSingleFrameSkia.h header.
+        * platform/graphics/skia/BitmapImageSingleFrameSkia.cpp: Removed.
+        * platform/graphics/skia/BitmapImageSingleFrameSkia.h: Removed.
+        * platform/graphics/skia/ImageBufferSkia.cpp: Construct BitmapImage
+        objects instead of BitmapImageSingleFrameSkia ones.
+        (WebCore::ImageBuffer::copyImage):
+        (WebCore::drawNeedsCopy):
+        (WebCore::ImageBuffer::draw):
+        (WebCore::ImageBuffer::drawPattern):
+        * platform/graphics/skia/ImageSkia.cpp:
+        (WebCore::BitmapImage::BitmapImage): Implement BitmapImage constructor
+        that takes an NativeImageSkia* in argument.
+        (WebCore):
+        (WebCore::BitmapImage::draw): Remove m_source.initialized() check as
+        this will return false for BitmapImage objects constructed from a
+        NativeImageSkia, due to the lack of decoder.
+        * platform/graphics/skia/NativeImageSkia.cpp:
+        (WebCore::NativeImageSkia::NativeImageSkia): Add parameter to the
+        NativeImageSkia constructor so that the caller can request a deep copy
+        instead of a shallow one. This is needed by the ImageBuffer.
+        * platform/graphics/skia/NativeImageSkia.h:
+        * platform/image-decoders/ImageDecoder.h:
+        (WebCore::ImageFrame::setSkBitmap):
+
 2013-04-03  David Vest  <davve@opera.com>
 
         ASSERTION FAILED: resultAnimationElement->m_animatedType
index c3d2926..cd74770 100644 (file)
             'platform/graphics/openvg/TiledImageOpenVG.h',
             'platform/graphics/openvg/VGUtils.cpp',
             'platform/graphics/openvg/VGUtils.h',
-            'platform/graphics/skia/BitmapImageSingleFrameSkia.cpp',
-            'platform/graphics/skia/BitmapImageSingleFrameSkia.h',
             'platform/graphics/skia/FloatPointSkia.cpp',
             'platform/graphics/skia/FloatRectSkia.cpp',
             'platform/graphics/skia/FontCacheSkia.cpp',
index f5f46da..bc2b2ed 100644 (file)
@@ -27,7 +27,6 @@
 #if USE(SKIA)
 #include "FEGaussianBlur.h"
 
-#include "BitmapImageSingleFrameSkia.h"
 #include "SkBlurImageFilter.h"
 #include "SkiaImageFilterBuilder.h"
 
diff --git a/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.cpp b/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.cpp
deleted file mode 100644 (file)
index fb66155..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "config.h"
-
-#include "BitmapImageSingleFrameSkia.h"
-
-namespace WebCore {
-
-bool BitmapImageSingleFrameSkia::isBitmapImage() const
-{
-    return true;
-}
-
-bool BitmapImageSingleFrameSkia::currentFrameKnownToBeOpaque()
-{
-    return m_nativeImage.bitmap().isOpaque();
-}
-
-IntSize BitmapImageSingleFrameSkia::size() const
-{
-    return IntSize(m_nativeImage.bitmap().width(), m_nativeImage.bitmap().height());
-}
-
-// Do nothing, as we only have the one representation of data (decoded).
-void BitmapImageSingleFrameSkia::destroyDecodedData(bool destroyAll)
-{
-
-}
-
-unsigned BitmapImageSingleFrameSkia::decodedSize() const
-{
-    return m_nativeImage.decodedSize();
-}
-
-// We only have a single frame.
-NativeImagePtr BitmapImageSingleFrameSkia::nativeImageForCurrentFrame()
-{
-    return &m_nativeImage;
-}
-
-#if !ASSERT_DISABLED
-bool BitmapImageSingleFrameSkia::notSolidColor()
-{
-    return m_nativeImage.bitmap().width() != 1 || m_nativeImage.bitmap().height() != 1;
-}
-#endif
-
-} // namespace WebCore
-
diff --git a/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h b/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h
deleted file mode 100644 (file)
index 56ebe3a..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BitmapImageSingleFrameSkia_h
-#define BitmapImageSingleFrameSkia_h
-
-#include "Image.h"
-#include "NativeImageSkia.h"
-
-namespace WebCore {
-
-// This image class can be used in places which need an Image, but have
-// raw pixel data rather than undecoded image data.
-// The Image is simpler than a BitmapImage, as it does not have image
-// observers, animation, multiple frames, or non-decoded data.
-// Therefore trimming the decoded data (destroyDecodedData()) has no effect.
-//
-// The difficulty with putting this in BitmapImage::create(NativeImagePtr)
-// 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, float resolutionScale = 1);
-
-    virtual bool isBitmapImage() const;
-
-    virtual bool currentFrameKnownToBeOpaque() OVERRIDE;
-
-    virtual IntSize size() const;
-
-    // Do nothing, as we only have the one representation of data (decoded).
-    virtual void destroyDecodedData(bool destroyAll = true);
-
-    virtual unsigned decodedSize() const;
-
-    // We only have a single frame.
-    virtual NativeImagePtr nativeImageForCurrentFrame();
-
-#if !ASSERT_DISABLED
-    virtual bool notSolidColor();
-#endif
-
-protected:
-    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode);
-
-private:
-    NativeImageSkia m_nativeImage;
-
-    // Creates a new Image from the given SkBitmap, using a shallow copy.
-    BitmapImageSingleFrameSkia(const SkBitmap&, float resolutionScale);
-};
-
-FloatRect normalizeRect(const FloatRect&);
-
-} // namespace WebCore
-
-#endif  // BitmapImageSingleFrameSkia_h
index 61309fa..f61decb 100644 (file)
@@ -34,7 +34,6 @@
 #include "ImageBuffer.h"
 
 #include "BitmapImage.h"
-#include "BitmapImageSingleFrameSkia.h"
 #include "Extensions3D.h"
 #include "GrContext.h"
 #include "GraphicsContext.h"
@@ -43,6 +42,7 @@
 #include "JPEGImageEncoder.h"
 #include "MIMETypeRegistry.h"
 #include "MemoryInstrumentationSkia.h"
+#include "NativeImageSkia.h"
 #include "PNGImageEncoder.h"
 #include "PlatformContextSkia.h"
 #include "SharedGraphicsContext3D.h"
@@ -205,7 +205,7 @@ GraphicsContext* ImageBuffer::context() const
 PassRefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior, ScaleBehavior) const
 {
     // FIXME: Start honoring ScaleBehavior to scale 2x buffers down to 1x.
-    return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), copyBehavior == CopyBackingStore, m_resolutionScale);
+    return BitmapImage::create(new NativeImageSkia(*m_data.m_platformContext.bitmap(), copyBehavior == CopyBackingStore ? NativeImageSkia::CopyPixels : NativeImageSkia::DoNotCopyPixels, m_resolutionScale));
 }
 
 BackingStoreCopy ImageBuffer::fastCopyImageMode()
@@ -251,22 +251,22 @@ void ImageBuffer::clip(GraphicsContext* context, const FloatRect& rect) const
     context->platformContext()->beginLayerClippedToImage(rect, this);
 }
 
-static bool drawNeedsCopy(GraphicsContext* src, GraphicsContext* dst)
+static NativeImageSkia::CopyBehavior drawNeedsCopy(GraphicsContext* src, GraphicsContext* dst)
 {
-    return dst->platformContext()->isDeferred() || src == dst;
+    return (dst->platformContext()->isDeferred() || src == dst) ? NativeImageSkia::CopyPixels : NativeImageSkia::DoNotCopyPixels;
 }
 
 void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect,
     CompositeOperator op, BlendMode, bool useLowQualityScale)
 {
-    RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), drawNeedsCopy(m_context.get(), context));
+    RefPtr<Image> image = BitmapImage::create(new NativeImageSkia(*m_data.m_platformContext.bitmap(), drawNeedsCopy(m_context.get(), context)));
     context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, DoNotRespectImageOrientation, 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(), drawNeedsCopy(m_context.get(), context));
+    RefPtr<Image> image = BitmapImage::create(new NativeImageSkia(*m_data.m_platformContext.bitmap(), drawNeedsCopy(m_context.get(), context)));
     image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
 }
 
index 1dec1ee..cb92392 100644 (file)
@@ -32,7 +32,6 @@
 
 #include "AffineTransform.h"
 #include "BitmapImage.h"
-#include "BitmapImageSingleFrameSkia.h"
 #include "FloatConversion.h"
 #include "FloatRect.h"
 #include "GraphicsContext.h"
@@ -560,6 +559,38 @@ void Image::drawPattern(GraphicsContext* context,
 
 // FIXME: These should go to BitmapImageSkia.cpp
 
+BitmapImage::BitmapImage(NativeImageSkia* nativeImage, ImageObserver* observer)
+    : Image(observer)
+    , m_size(nativeImage->bitmap().width(), nativeImage->bitmap().height())
+    , m_currentFrame(0)
+    , m_frames(0)
+    , m_frameTimer(0)
+    , m_repetitionCount(cAnimationNone)
+    , m_repetitionCountStatus(Unknown)
+    , m_repetitionsComplete(0)
+    , m_decodedSize(nativeImage->decodedSize())
+    , m_decodedPropertiesSize(0)
+    , m_frameCount(1)
+    , m_isSolidColor(false)
+    , m_checkedForSolidColor(false)
+    , m_animationFinished(true)
+    , m_allDataReceived(true)
+    , m_haveSize(true)
+    , m_sizeAvailable(true)
+    , m_haveFrameCount(true)
+{
+    // Since we don't have a decoder, we can't figure out the image orientation.
+    // Set m_sizeRespectingOrientation to be the same as m_size so it's not 0x0.
+    m_sizeRespectingOrientation = m_size;
+
+    m_frames.grow(1);
+    m_frames[0].m_frame = nativeImage;
+    m_frames[0].m_hasAlpha = !nativeImage->bitmap().isOpaque();
+    m_frames[0].m_haveMetadata = true;
+
+    checkForSolidColor();
+}
+
 void BitmapImage::invalidatePlatformData()
 {
 }
@@ -591,9 +622,6 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl
 
 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp, BlendMode, RespectImageOrientationEnum shouldRespectImageOrientation)
 {
-    if (!m_source.initialized())
-        return;
-
     // Spin the animation to the correct frame before we try to draw it, so we
     // don't draw an old frame and then immediately need to draw a newer one,
     // causing flicker and wasting CPU.
@@ -641,45 +669,4 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl
         observer->didDraw(this);
 }
 
-// FIXME: These should go into BitmapImageSingleFrameSkia.cpp
-
-void BitmapImageSingleFrameSkia::draw(GraphicsContext* ctxt,
-    const FloatRect& dstRect,
-    const FloatRect& srcRect,
-    ColorSpace styleColorSpace,
-    CompositeOperator compositeOp, BlendMode)
-{
-    FloatRect normDstRect = normalizeRect(dstRect);
-    FloatRect normSrcRect = normalizeRect(srcRect);
-    normSrcRect.intersect(FloatRect(0, 0, m_nativeImage.bitmap().width(), m_nativeImage.bitmap().height()));
-
-    if (normSrcRect.isEmpty() || normDstRect.isEmpty())
-        return; // Nothing to draw.
-
-    paintSkBitmap(ctxt->platformContext(),
-        m_nativeImage,
-        normSrcRect,
-        normDstRect,
-        WebCoreCompositeToSkiaComposite(compositeOp));
-
-    if (ImageObserver* observer = imageObserver())
-        observer->didDraw(this);
-}
-
-BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia(const SkBitmap& bitmap, float resolutionScale)
-    : m_nativeImage(bitmap, resolutionScale)
-{
-}
-
-PassRefPtr<BitmapImageSingleFrameSkia> BitmapImageSingleFrameSkia::create(const SkBitmap& bitmap, bool copyPixels, float resolutionScale)
-{
-    if (copyPixels) {
-        SkBitmap temp;
-        if (!bitmap.deepCopyTo(&temp, bitmap.config()))
-            bitmap.copyTo(&temp, bitmap.config());
-        return adoptRef(new BitmapImageSingleFrameSkia(temp, resolutionScale));
-    }
-    return adoptRef(new BitmapImageSingleFrameSkia(bitmap, resolutionScale));
-}
-
 } // namespace WebCore
index 0dc0f9e..21ebf5b 100644 (file)
@@ -53,11 +53,15 @@ NativeImageSkia::NativeImageSkia()
 {
 }
 
-NativeImageSkia::NativeImageSkia(const SkBitmap& other, float resolutionScale)
-    : m_image(other),
-      m_resolutionScale(resolutionScale),
+NativeImageSkia::NativeImageSkia(const SkBitmap& other, CopyBehavior copyBehavior, float resolutionScale)
+    : m_resolutionScale(resolutionScale),
       m_resizeRequests(0)
 {
+    if (copyBehavior == CopyPixels) {
+        if (!other.deepCopyTo(&m_image, other.config()))
+            other.copyTo(&m_image, other.config());
+    } else
+        m_image = other;
 }
 
 NativeImageSkia::~NativeImageSkia()
index 8b795e2..89e326a 100644 (file)
@@ -43,13 +43,12 @@ namespace WebCore {
 // stores a cached resized image.
 class NativeImageSkia {
 public:
+    enum CopyBehavior { CopyPixels, DoNotCopyPixels };
+
     NativeImageSkia();
     ~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.
-    NativeImageSkia(const SkBitmap&, float resolutionScale);
+    NativeImageSkia(const SkBitmap&, CopyBehavior, float resolutionScale = 1);
 
     // Returns the number of bytes of image data. This includes the cached
     // resized version if there is one.
index 10424a5..291167b 100644 (file)
@@ -150,7 +150,7 @@ namespace WebCore {
 #if PLATFORM(CHROMIUM)
         void setSkBitmap(const SkBitmap& bitmap)
         {
-            m_bitmap = NativeImageSkia(bitmap, 1);
+            m_bitmap = NativeImageSkia(bitmap, NativeImageSkia::DoNotCopyPixels);
         }
 
         const SkBitmap& getSkBitmap() const
index bddf755..e77a0e7 100644 (file)
@@ -1,3 +1,16 @@
+2013-04-03  Christophe Dumez  <ch.dumez@sisa.samsung.com>
+
+        [Chromium] Bad cast from BitmapImageSingleFrameSkia to BitmapImage
+        https://bugs.webkit.org/show_bug.cgi?id=113492
+
+        Reviewed by Stephen White.
+
+        Update test now that BitmapImageSingleFrameSkia no longer exists.
+        BitmapImage is now used instead.
+
+        * tests/PlatformContextSkiaTest.cpp:
+        (WebCore::TEST):
+
 2013-04-03  Mikhail Naganov  <mnaganov@chromium.org>
 
         [Chromium] Implement target-densityDpi viewport property emulation
index e8e439c..374328b 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "PlatformContextSkia.h"
 
-#include "BitmapImageSingleFrameSkia.h"
+#include "BitmapImage.h"
 #include "GraphicsContext.h"
 #include "ImageBuffer.h"
 #include "NativeImageSkia.h"
@@ -549,14 +549,14 @@ TEST(PlatformContextSkiaTest, trackOpaqueImageTest)
     for (int y = 0; y < drawBitmap.height(); ++y)
         for (int x = 0; x < drawBitmap.width(); ++x)
             *drawBitmap.getAddr32(x, y) = 0xFFFFFFFF;
-    RefPtr<BitmapImageSingleFrameSkia> opaqueImage = BitmapImageSingleFrameSkia::create(drawBitmap, true);
+    RefPtr<BitmapImage> opaqueImage = BitmapImage::create(new NativeImageSkia(drawBitmap, NativeImageSkia::CopyPixels));
     EXPECT_TRUE(opaqueImage->currentFrameKnownToBeOpaque());
 
     drawBitmap.setIsOpaque(false);
     for (int y = 0; y < drawBitmap.height(); ++y)
         for (int x = 0; x < drawBitmap.width(); ++x)
             *drawBitmap.getAddr32(x, y) = 0x00000000;
-    RefPtr<BitmapImageSingleFrameSkia> alphaImage = BitmapImageSingleFrameSkia::create(drawBitmap, true);
+    RefPtr<BitmapImage> alphaImage = BitmapImage::create(new NativeImageSkia(drawBitmap, NativeImageSkia::CopyPixels));
     EXPECT_FALSE(alphaImage->currentFrameKnownToBeOpaque());
 
     context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);