| 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" |
| 11 #include "platform/graphics/paint/PaintRecord.h" | 11 #include "platform/graphics/paint/PaintRecord.h" |
| 12 #include "platform/graphics/paint/PaintRecordBuilder.h" | 12 #include "platform/graphics/paint/PaintRecordBuilder.h" |
| 13 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
| 14 #include "third_party/skia/include/core/SkRect.h" | 14 #include "third_party/skia/include/core/SkRect.h" |
| 15 #include "third_party/skia/include/core/SkSize.h" | 15 #include "third_party/skia/include/core/SkSize.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // Gray with 40% opacity. | 21 // Gray with 40% opacity. |
| 22 const RGBA32 kFillColor = 0x66808080; | 22 const RGBA32 kFillColor = 0x66808080; |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 PlaceholderImage::~PlaceholderImage() {} | 26 PlaceholderImage::~PlaceholderImage() {} |
| 27 | 27 |
| 28 sk_sp<SkImage> PlaceholderImage::imageForCurrentFrame( | 28 sk_sp<SkImage> PlaceholderImage::imageForCurrentFrame() { |
| 29 const ColorBehavior& colorBehavior) { | |
| 30 // TODO(ccameron): This function should not ignore |colorBehavior|. | |
| 31 // https://crbug.com/672306 | |
| 32 if (m_imageForCurrentFrame) | 29 if (m_imageForCurrentFrame) |
| 33 return m_imageForCurrentFrame; | 30 return m_imageForCurrentFrame; |
| 34 | 31 |
| 35 const FloatRect destRect(0.0f, 0.0f, static_cast<float>(m_size.width()), | 32 const FloatRect destRect(0.0f, 0.0f, static_cast<float>(m_size.width()), |
| 36 static_cast<float>(m_size.height())); | 33 static_cast<float>(m_size.height())); |
| 37 PaintRecordBuilder builder(destRect); | 34 PaintRecordBuilder builder(destRect); |
| 38 GraphicsContext& context = builder.context(); | 35 GraphicsContext& context = builder.context(); |
| 39 context.beginRecording(destRect); | 36 context.beginRecording(destRect); |
| 40 | 37 |
| 41 context.setFillColor(kFillColor); | 38 context.setFillColor(kFillColor); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 65 flags.setStyle(PaintFlags::kFill_Style); | 62 flags.setStyle(PaintFlags::kFill_Style); |
| 66 flags.setColor(kFillColor); | 63 flags.setColor(kFillColor); |
| 67 canvas->drawRect(destRect, flags); | 64 canvas->drawRect(destRect, flags); |
| 68 } | 65 } |
| 69 | 66 |
| 70 void PlaceholderImage::destroyDecodedData() { | 67 void PlaceholderImage::destroyDecodedData() { |
| 71 m_imageForCurrentFrame.reset(); | 68 m_imageForCurrentFrame.reset(); |
| 72 } | 69 } |
| 73 | 70 |
| 74 } // namespace blink | 71 } // namespace blink |
| OLD | NEW |