Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1779)

Unified Diff: Source/platform/graphics/paint/CachedDisplayItem.cpp

Issue 847783003: New display item caching (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: New method, supporting partial paint Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/graphics/paint/CachedDisplayItem.h ('k') | Source/platform/graphics/paint/DisplayItem.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/platform/graphics/paint/CachedDisplayItem.h ('k') | Source/platform/graphics/paint/DisplayItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698