| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/PlaceholderImage.h" | 5 #include "platform/graphics/PlaceholderImage.h" |
| 6 | 6 |
| 7 #include "platform/geometry/FloatRect.h" | 7 #include "platform/geometry/FloatRect.h" |
| 8 #include "platform/graphics/Color.h" | 8 #include "platform/graphics/Color.h" |
| 9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
| 10 #include "platform/graphics/ImageObserver.h" | 10 #include "platform/graphics/ImageObserver.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 if (!srcRect.intersects(FloatRect(0.0f, 0.0f, | 56 if (!srcRect.intersects(FloatRect(0.0f, 0.0f, |
| 57 static_cast<float>(m_size.width()), | 57 static_cast<float>(m_size.width()), |
| 58 static_cast<float>(m_size.height())))) { | 58 static_cast<float>(m_size.height())))) { |
| 59 return; | 59 return; |
| 60 } | 60 } |
| 61 | 61 |
| 62 SkPaint paint(basePaint); | 62 SkPaint paint(basePaint); |
| 63 paint.setStyle(SkPaint::kFill_Style); | 63 paint.setStyle(SkPaint::kFill_Style); |
| 64 paint.setColor(kFillColor); | 64 paint.setColor(kFillColor); |
| 65 canvas->drawRect(destRect, paint); | 65 canvas->drawRect(destRect, paint); |
| 66 | |
| 67 if (getImageObserver()) | |
| 68 getImageObserver()->didDraw(this); | |
| 69 } | |
| 70 | |
| 71 void PlaceholderImage::drawPattern(GraphicsContext& destContext, | |
| 72 const FloatRect& srcRect, | |
| 73 const FloatSize& scale, | |
| 74 const FloatPoint& phase, | |
| 75 SkBlendMode compositeOp, | |
| 76 const FloatRect& destRect, | |
| 77 const FloatSize& repeatSpacing) { | |
| 78 Image::drawPattern(destContext, srcRect, scale, phase, compositeOp, destRect, | |
| 79 repeatSpacing); | |
| 80 | |
| 81 if (getImageObserver()) | |
| 82 getImageObserver()->didDraw(this); | |
| 83 } | 66 } |
| 84 | 67 |
| 85 void PlaceholderImage::destroyDecodedData() { | 68 void PlaceholderImage::destroyDecodedData() { |
| 86 m_imageForCurrentFrame.reset(); | 69 m_imageForCurrentFrame.reset(); |
| 87 } | 70 } |
| 88 | 71 |
| 89 } // namespace blink | 72 } // namespace blink |
| OLD | NEW |