Index: Source/platform/graphics/paint/CachedDisplayItem.cpp |
diff --git a/Source/platform/graphics/paint/CachedDisplayItem.cpp b/Source/platform/graphics/paint/CachedDisplayItem.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3b4e1361eceb3a27036bcfed71d2ee6861f84025 |
--- /dev/null |
+++ b/Source/platform/graphics/paint/CachedDisplayItem.cpp |
@@ -0,0 +1,39 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "config.h" |
+#include "platform/graphics/paint/CachedDisplayItem.h" |
+ |
+#include "platform/graphics/GraphicsContext.h" |
+#include "public/platform/WebDisplayItemList.h" |
+#include "third_party/skia/include/core/SkPicture.h" |
+ |
+namespace blink { |
+ |
+#ifndef NDEBUG |
+ |
+static void drawRedRect(GraphicsContext& context, const FloatRect& bounds) |
+{ |
+ SkPaint paint; |
+ paint.setColor(SK_ColorRED); |
Stephen Chennney
2015/01/27 19:45:45
bikeshed: Red is probably OK, but better is someth
trchen
2015/01/27 19:52:01
I would vote for red for the sake of consistency,
|
+ context.drawRect(bounds, paint); |
+} |
+ |
+void CachedDisplayItem::replay(GraphicsContext* context) |
+{ |
+ drawRedRect(*context, m_bounds); |
+} |
+ |
+void CachedDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* list) const |
+{ |
+ GraphicsContext context(nullptr, nullptr); |
+ context.beginRecording(m_bounds); |
+ drawRedRect(context, m_bounds); |
+ RefPtr<const SkPicture> picture = context.endRecording(); |
+ list->appendDrawingItem(const_cast<SkPicture*>(picture.get()), FloatPoint()); |
+} |
+ |
+#endif // ifndef NDEBUG |
+ |
+} // namespace blink |