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

Unified Diff: Source/core/paint/TranslationRecorder.cpp

Issue 698743002: [WIP] Adding support for <iframe>s to slimming paint. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
Index: Source/core/paint/TranslationRecorder.cpp
diff --git a/Source/core/paint/TranslationRecorder.cpp b/Source/core/paint/TranslationRecorder.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..19450f0787c7bfb158a65c1c8fbe9ff78afa0107
--- /dev/null
+++ b/Source/core/paint/TranslationRecorder.cpp
@@ -0,0 +1,43 @@
+// Copyright 2014 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 "core/paint/TranslationRecorder.h"
+
+#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/graphics/GraphicsContext.h"
+
+namespace blink {
+
+void TranslationDisplayItem::replay(GraphicsContext* context)
chrishtr 2014/11/01 23:44:11 Scale, rotate and translate are just convenience w
trchen 2014/11/02 10:36:46 That makes sense. I was thinking that 2D translati
+{
+ context->translate(m_translation.width(), m_translation.height());
+}
+
+TranslationRecorder::TranslationRecorder(RenderObject* renderer, GraphicsContext* context, const FloatSize& translation)
+ : m_renderer(renderer)
+ , m_context(context)
+ , m_translation(translation)
+{
+ if (m_translation.isZero())
+ return;
+
+ if (RuntimeEnabledFeatures::slimmingPaintEnabled())
+ ViewDisplayList::fromRenderObject(m_renderer).add(adoptPtr(new TranslationDisplayItem(m_translation)));
+ else
+ context->translate(m_translation.width(), m_translation.height());
+}
+
+TranslationRecorder::~TranslationRecorder()
+{
+ if (m_translation.isZero())
+ return;
+
+ if (RuntimeEnabledFeatures::slimmingPaintEnabled())
+ ViewDisplayList::fromRenderObject(m_renderer).add(adoptPtr(new EndTranslationDisplayItem(m_translation)));
+ else
+ m_context->translate(-m_translation.width(), -m_translation.height());
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698