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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "platform/graphics/UnacceleratedStaticBitmapImage.h"
6
7 #include "third_party/skia/include/core/SkImage.h"
8
9 namespace blink {
10
11 PassRefPtr<UnacceleratedStaticBitmapImage>
12 UnacceleratedStaticBitmapImage::create(sk_sp<SkImage> image) {
13 return adoptRef(new UnacceleratedStaticBitmapImage(std::move(image)));
14 }
15
16 UnacceleratedStaticBitmapImage::UnacceleratedStaticBitmapImage(
17 sk_sp<SkImage> image)
18 : m_image(std::move(image)) {
19 DCHECK(m_image);
20 }
21
22 UnacceleratedStaticBitmapImage::~UnacceleratedStaticBitmapImage() {}
23
24 IntSize UnacceleratedStaticBitmapImage::size() const {
25 return IntSize(m_image->width(), m_image->height());
26 }
27
28 bool UnacceleratedStaticBitmapImage::currentFrameKnownToBeOpaque(MetadataMode) {
29 return m_image->isOpaque();
30 }
31
32 void UnacceleratedStaticBitmapImage::draw(SkCanvas* canvas,
33 const SkPaint& paint,
34 const FloatRect& dstRect,
35 const FloatRect& srcRect,
36 RespectImageOrientationEnum,
37 ImageClampingMode clampMode) {
38 StaticBitmapImage::drawHelper(canvas, paint, dstRect, srcRect, clampMode,
39 m_image);
40 }
41
42 sk_sp<SkImage> UnacceleratedStaticBitmapImage::imageForCurrentFrame() {
43 return m_image;
44 }
45
46 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698