OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 "core/paint/TranslationRecorder.h" | |
7 | |
8 #include "platform/RuntimeEnabledFeatures.h" | |
9 #include "platform/graphics/GraphicsContext.h" | |
10 | |
11 namespace blink { | |
12 | |
13 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
| |
14 { | |
15 context->translate(m_translation.width(), m_translation.height()); | |
16 } | |
17 | |
18 TranslationRecorder::TranslationRecorder(RenderObject* renderer, GraphicsContext * context, const FloatSize& translation) | |
19 : m_renderer(renderer) | |
20 , m_context(context) | |
21 , m_translation(translation) | |
22 { | |
23 if (m_translation.isZero()) | |
24 return; | |
25 | |
26 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
27 ViewDisplayList::fromRenderObject(m_renderer).add(adoptPtr(new Translati onDisplayItem(m_translation))); | |
28 else | |
29 context->translate(m_translation.width(), m_translation.height()); | |
30 } | |
31 | |
32 TranslationRecorder::~TranslationRecorder() | |
33 { | |
34 if (m_translation.isZero()) | |
35 return; | |
36 | |
37 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
38 ViewDisplayList::fromRenderObject(m_renderer).add(adoptPtr(new EndTransl ationDisplayItem(m_translation))); | |
39 else | |
40 m_context->translate(-m_translation.width(), -m_translation.height()); | |
41 } | |
42 | |
43 } // namespace blink | |
OLD | NEW |