Index: third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7b20716bd50c566ea3146d8f9f27e48d1ad370a7 |
--- /dev/null |
+++ b/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp |
@@ -0,0 +1,46 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "platform/graphics/UnacceleratedStaticBitmapImage.h" |
+ |
+#include "third_party/skia/include/core/SkImage.h" |
+ |
+namespace blink { |
+ |
+PassRefPtr<UnacceleratedStaticBitmapImage> |
+UnacceleratedStaticBitmapImage::create(sk_sp<SkImage> image) { |
+ return adoptRef(new UnacceleratedStaticBitmapImage(std::move(image))); |
+} |
+ |
+UnacceleratedStaticBitmapImage::UnacceleratedStaticBitmapImage( |
+ sk_sp<SkImage> image) |
+ : m_image(std::move(image)) { |
+ DCHECK(m_image); |
+} |
+ |
+UnacceleratedStaticBitmapImage::~UnacceleratedStaticBitmapImage() {} |
+ |
+IntSize UnacceleratedStaticBitmapImage::size() const { |
+ return IntSize(m_image->width(), m_image->height()); |
+} |
+ |
+bool UnacceleratedStaticBitmapImage::currentFrameKnownToBeOpaque(MetadataMode) { |
+ return m_image->isOpaque(); |
+} |
+ |
+void UnacceleratedStaticBitmapImage::draw(SkCanvas* canvas, |
+ const SkPaint& paint, |
+ const FloatRect& dstRect, |
+ const FloatRect& srcRect, |
+ RespectImageOrientationEnum, |
+ ImageClampingMode clampMode) { |
+ StaticBitmapImage::drawHelper(canvas, paint, dstRect, srcRect, clampMode, |
+ m_image); |
+} |
+ |
+sk_sp<SkImage> UnacceleratedStaticBitmapImage::imageForCurrentFrame() { |
+ return m_image; |
+} |
+ |
+} // namespace blink |