OLD | NEW |
(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 |
OLD | NEW |