| 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, SingleSecurityOriginType hasSingleSecurityOrigin) |
| 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, hasSingleSecurityOrigin)); |
| 21 } | 21 } |
| 22 | 22 |
| 23 StaticBitmapImage::StaticBitmapImage(PassRefPtr<SkImage> image) : m_image(image) | 23 StaticBitmapImage::StaticBitmapImage(PassRefPtr<SkImage> image, SingleSecurityOr
iginType hasSingleSecurityOrigin) : m_image(image) |
| 24 { | 24 { |
| 25 ASSERT(m_image); | 25 ASSERT(m_image); |
| 26 m_isOriginClean = (hasSingleSecurityOrigin == HasSingleSecurityOrigin) ? tru
e : false; |
| 26 } | 27 } |
| 27 | 28 |
| 28 StaticBitmapImage::~StaticBitmapImage() { } | 29 StaticBitmapImage::~StaticBitmapImage() { } |
| 29 | 30 |
| 30 IntSize StaticBitmapImage::size() const | 31 IntSize StaticBitmapImage::size() const |
| 31 { | 32 { |
| 32 return IntSize(m_image->width(), m_image->height()); | 33 return IntSize(m_image->width(), m_image->height()); |
| 33 } | 34 } |
| 34 | 35 |
| 35 bool StaticBitmapImage::currentFrameKnownToBeOpaque(MetadataMode) | 36 bool StaticBitmapImage::currentFrameKnownToBeOpaque(MetadataMode) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 58 if (ImageObserver* observer = imageObserver()) | 59 if (ImageObserver* observer = imageObserver()) |
| 59 observer->didDraw(this); | 60 observer->didDraw(this); |
| 60 } | 61 } |
| 61 | 62 |
| 62 PassRefPtr<SkImage> StaticBitmapImage::imageForCurrentFrame() | 63 PassRefPtr<SkImage> StaticBitmapImage::imageForCurrentFrame() |
| 63 { | 64 { |
| 64 return m_image; | 65 return m_image; |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace blink | 68 } // namespace blink |
| OLD | NEW |