| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/graphics/StaticBitmapImage.h" | 5 #include "platform/graphics/StaticBitmapImage.h" |
| 6 | 6 |
| 7 #include "platform/graphics/AcceleratedStaticBitmapImage.h" | 7 #include "platform/graphics/AcceleratedStaticBitmapImage.h" |
| 8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "platform/graphics/ImageObserver.h" | 9 #include "platform/graphics/ImageObserver.h" |
| 10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
| 11 #include "third_party/skia/include/core/SkImage.h" | 11 #include "third_party/skia/include/core/SkImage.h" |
| 12 #include "third_party/skia/include/core/SkPaint.h" | 12 #include "third_party/skia/include/core/SkPaint.h" |
| 13 #include "wtf/PtrUtil.h" | 13 #include "wtf/PtrUtil.h" |
| 14 #include <memory> | 14 #include <memory> |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 PassRefPtr<StaticBitmapImage> StaticBitmapImage::create(sk_sp<SkImage> image) { | 18 PassRefPtr<StaticBitmapImage> StaticBitmapImage::create(sk_sp<SkImage> image) { |
| 19 if (!image) | 19 if (!image) |
| 20 return nullptr; | 20 return nullptr; |
| 21 if (image->isTextureBacked()) | 21 if (image->isTextureBacked()) { |
| 22 return AcceleratedStaticBitmapImage::createFromSharedContextImage( | 22 return AcceleratedStaticBitmapImage::createFromSharedContextImage( |
| 23 std::move(image)); | 23 std::move(image)); |
| 24 } |
| 24 return adoptRef(new StaticBitmapImage(std::move(image))); | 25 return adoptRef(new StaticBitmapImage(std::move(image))); |
| 25 } | 26 } |
| 26 | 27 |
| 27 StaticBitmapImage::StaticBitmapImage(sk_sp<SkImage> image) | 28 StaticBitmapImage::StaticBitmapImage(sk_sp<SkImage> image) |
| 28 : m_image(std::move(image)) { | 29 : m_image(std::move(image)) { |
| 29 ASSERT(m_image); | 30 ASSERT(m_image); |
| 30 } | 31 } |
| 31 | 32 |
| 32 StaticBitmapImage::StaticBitmapImage() {} | 33 StaticBitmapImage::StaticBitmapImage() {} |
| 33 | 34 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 62 | 63 |
| 63 if (ImageObserver* observer = getImageObserver()) | 64 if (ImageObserver* observer = getImageObserver()) |
| 64 observer->didDraw(this); | 65 observer->didDraw(this); |
| 65 } | 66 } |
| 66 | 67 |
| 67 sk_sp<SkImage> StaticBitmapImage::imageForCurrentFrame() { | 68 sk_sp<SkImage> StaticBitmapImage::imageForCurrentFrame() { |
| 68 return m_image; | 69 return m_image; |
| 69 } | 70 } |
| 70 | 71 |
| 71 } // namespace blink | 72 } // namespace blink |
| OLD | NEW |