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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 RespectImageOrientationEnum, | 52 RespectImageOrientationEnum, |
53 ImageClampingMode clampMode) { | 53 ImageClampingMode clampMode) { |
54 FloatRect adjustedSrcRect = srcRect; | 54 FloatRect adjustedSrcRect = srcRect; |
55 adjustedSrcRect.intersect(SkRect::Make(m_image->bounds())); | 55 adjustedSrcRect.intersect(SkRect::Make(m_image->bounds())); |
56 | 56 |
57 if (dstRect.isEmpty() || adjustedSrcRect.isEmpty()) | 57 if (dstRect.isEmpty() || adjustedSrcRect.isEmpty()) |
58 return; // Nothing to draw. | 58 return; // Nothing to draw. |
59 | 59 |
60 canvas->drawImageRect(m_image.get(), adjustedSrcRect, dstRect, &paint, | 60 canvas->drawImageRect(m_image.get(), adjustedSrcRect, dstRect, &paint, |
61 WebCoreClampingModeToSkiaRectConstraint(clampMode)); | 61 WebCoreClampingModeToSkiaRectConstraint(clampMode)); |
62 | |
63 if (ImageObserver* observer = getImageObserver()) | |
64 observer->didDraw(this); | |
65 } | 62 } |
66 | 63 |
67 sk_sp<SkImage> StaticBitmapImage::imageForCurrentFrame() { | 64 sk_sp<SkImage> StaticBitmapImage::imageForCurrentFrame() { |
68 return m_image; | 65 return m_image; |
69 } | 66 } |
70 | 67 |
71 } // namespace blink | 68 } // namespace blink |
OLD | NEW |