Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp

Issue 2455983005: Refactor AcceleratedStaticBitmapImage (Closed)
Patch Set: No long keep WeakPtr<DrawingBuffer> Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698