| 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/GraphicsContext.h" | 7 #include "platform/graphics/GraphicsContext.h" |
| 8 #include "platform/graphics/ImageObserver.h" | 8 #include "platform/graphics/ImageObserver.h" |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "third_party/skia/include/core/SkImage.h" | 10 #include "third_party/skia/include/core/SkImage.h" |
| 11 #include "third_party/skia/include/core/SkPaint.h" | 11 #include "third_party/skia/include/core/SkPaint.h" |
| 12 #include "third_party/skia/include/core/SkShader.h" | 12 #include "third_party/skia/include/core/SkShader.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 PassRefPtr<StaticBitmapImage> StaticBitmapImage::create(PassRefPtr<SkImage> imag
e) | 16 PassRefPtr<StaticBitmapImage> StaticBitmapImage::create(PassRefPtr<SkImage> imag
e) |
| 17 { | 17 { |
| 18 if (!image) | 18 if (!image) |
| 19 return nullptr; | 19 return nullptr; |
| 20 return adoptRef(new StaticBitmapImage(image)); | 20 return adoptRef(new StaticBitmapImage(image)); |
| 21 } | 21 } |
| 22 | 22 |
| 23 StaticBitmapImage::StaticBitmapImage(PassRefPtr<SkImage> image) : m_image(image) | 23 StaticBitmapImage::StaticBitmapImage(PassRefPtr<SkImage> image) : m_image(image) |
| 24 { | 24 { |
| 25 ASSERT(m_image); | 25 ASSERT(m_image); |
| 26 } | 26 } |
| 27 | 27 |
| 28 StaticBitmapImage::~StaticBitmapImage() { } | 28 StaticBitmapImage::~StaticBitmapImage() { } |
| 29 | 29 |
| 30 IntSize StaticBitmapImage::size() const | 30 IntSize StaticBitmapImage::concreteObjectSize(const FloatSize&) const |
| 31 { | 31 { |
| 32 return IntSize(m_image->width(), m_image->height()); | 32 return IntSize(m_image->width(), m_image->height()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool StaticBitmapImage::currentFrameKnownToBeOpaque(MetadataMode) | 35 bool StaticBitmapImage::currentFrameKnownToBeOpaque(MetadataMode) |
| 36 { | 36 { |
| 37 return m_image->isOpaque(); | 37 return m_image->isOpaque(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void StaticBitmapImage::draw(SkCanvas* canvas, const SkPaint& paint, const Float
Rect& dstRect, | 40 void StaticBitmapImage::draw(SkCanvas* canvas, const SkPaint& paint, const Float
Rect& dstRect, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 58 if (ImageObserver* observer = imageObserver()) | 58 if (ImageObserver* observer = imageObserver()) |
| 59 observer->didDraw(this); | 59 observer->didDraw(this); |
| 60 } | 60 } |
| 61 | 61 |
| 62 PassRefPtr<SkImage> StaticBitmapImage::imageForCurrentFrame() | 62 PassRefPtr<SkImage> StaticBitmapImage::imageForCurrentFrame() |
| 63 { | 63 { |
| 64 return m_image; | 64 return m_image; |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace blink | 67 } // namespace blink |
| OLD | NEW |