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 "config.h" | 5 #include "config.h" |
6 #include "platform/graphics/StaticBitmapImage.h" | 6 #include "platform/graphics/StaticBitmapImage.h" |
7 | 7 |
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 "platform/graphics/skia/NativeImageSkia.h" | 10 #include "platform/graphics/skia/NativeImageSkia.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 "third_party/skia/include/core/SkShader.h" | 13 #include "third_party/skia/include/core/SkShader.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 PassRefPtr<Image> StaticBitmapImage::create(PassRefPtr<SkImage> image) | 17 PassRefPtr<Image> StaticBitmapImage::create(PassRefPtr<SkImage> image) |
18 { | 18 { |
19 return adoptRef(new StaticBitmapImage(image)); | 19 return adoptRef(new StaticBitmapImage(image)); |
20 } | 20 } |
21 | 21 |
22 StaticBitmapImage::StaticBitmapImage(PassRefPtr<SkImage> image) : m_image(image) | 22 StaticBitmapImage::StaticBitmapImage(PassRefPtr<SkImage> image) : m_image(image) |
23 { | 23 { |
| 24 ASSERT(m_image); |
24 } | 25 } |
25 | 26 |
26 StaticBitmapImage::~StaticBitmapImage() { } | 27 StaticBitmapImage::~StaticBitmapImage() { } |
27 | 28 |
28 IntSize StaticBitmapImage::size() const | 29 IntSize StaticBitmapImage::size() const |
29 { | 30 { |
30 return IntSize(m_image->width(), m_image->height()); | 31 return IntSize(m_image->width(), m_image->height()); |
31 } | 32 } |
32 | 33 |
33 bool StaticBitmapImage::currentFrameKnownToBeOpaque() | 34 bool StaticBitmapImage::currentFrameKnownToBeOpaque() |
(...skipping 21 matching lines...) Expand all Loading... |
55 | 56 |
56 SkCanvas* canvas = ctx->canvas(); | 57 SkCanvas* canvas = ctx->canvas(); |
57 | 58 |
58 canvas->drawImageRect(m_image.get(), &srcSkRect, dstSkRect, &paint); | 59 canvas->drawImageRect(m_image.get(), &srcSkRect, dstSkRect, &paint); |
59 | 60 |
60 if (ImageObserver* observer = imageObserver()) | 61 if (ImageObserver* observer = imageObserver()) |
61 observer->didDraw(this); | 62 observer->didDraw(this); |
62 } | 63 } |
63 | 64 |
64 } | 65 } |
OLD | NEW |