OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "platform/graphics/paint/CachedDisplayItem.h" |
| 7 |
| 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "public/platform/WebDisplayItemList.h" |
| 10 #include "third_party/skia/include/core/SkPicture.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 #ifndef NDEBUG |
| 15 |
| 16 static void drawRedRect(GraphicsContext& context, const FloatRect& bounds) |
| 17 { |
| 18 SkPaint paint; |
| 19 paint.setColor(SK_ColorRED); |
| 20 context.drawRect(bounds, paint); |
| 21 } |
| 22 |
| 23 void CachedDisplayItem::replay(GraphicsContext* context) |
| 24 { |
| 25 drawRedRect(*context, m_bounds); |
| 26 } |
| 27 |
| 28 void CachedDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* list) con
st |
| 29 { |
| 30 GraphicsContext context(nullptr, nullptr); |
| 31 context.beginRecording(m_bounds); |
| 32 drawRedRect(context, m_bounds); |
| 33 RefPtr<const SkPicture> picture = context.endRecording(); |
| 34 list->appendDrawingItem(const_cast<SkPicture*>(picture.get()), FloatPoint())
; |
| 35 } |
| 36 |
| 37 #endif // ifndef NDEBUG |
| 38 |
| 39 } // namespace blink |
OLD | NEW |