OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/paint/TransformRecorder.h" | 6 #include "core/paint/TransformRecorder.h" |
7 | 7 |
8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
10 #include "platform/graphics/paint/DisplayItemList.h" | 10 #include "platform/graphics/paint/DisplayItemList.h" |
11 #include "platform/graphics/paint/TransformDisplayItem.h" | 11 #include "platform/graphics/paint/TransformDisplayItem.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 TransformRecorder::TransformRecorder(GraphicsContext& context, const DisplayItem
ClientWrapper& client, const AffineTransform& transform) | 15 TransformRecorder::TransformRecorder(GraphicsContext& context, const DisplayItem
ClientWrapper& client, const AffineTransform& transform) |
16 : m_context(context) | 16 : m_context(context) |
17 , m_client(client) | 17 , m_client(client) |
18 { | 18 { |
19 m_skipRecordingForIdentityTransform = transform.isIdentity(); | 19 m_skipRecordingForIdentityTransform = transform.isIdentity(); |
20 | 20 |
21 if (m_skipRecordingForIdentityTransform) | 21 if (m_skipRecordingForIdentityTransform) |
22 return; | 22 return; |
23 | 23 |
24 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 24 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
25 ASSERT(m_context.displayItemList()); | 25 ASSERT(m_context.displayItemList()); |
26 if (m_context.displayItemList()->displayItemConstructionIsDisabled()) | 26 if (m_context.displayItemList()->displayItemConstructionIsDisabled()) |
27 return; | 27 return; |
28 m_context.displayItemList()->add(BeginTransformDisplayItem::create(m_cli
ent, transform)); | 28 m_context.displayItemList()->createAndAppendIfNeeded<BeginTransformDispl
ayItem>(m_client, transform); |
29 } else { | 29 } else { |
30 BeginTransformDisplayItem beginTransform(m_client, transform); | 30 BeginTransformDisplayItem beginTransform(m_client, transform); |
31 beginTransform.replay(m_context); | 31 beginTransform.replay(m_context); |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 TransformRecorder::~TransformRecorder() | 35 TransformRecorder::~TransformRecorder() |
36 { | 36 { |
37 if (m_skipRecordingForIdentityTransform) | 37 if (m_skipRecordingForIdentityTransform) |
38 return; | 38 return; |
39 | 39 |
40 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 40 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
41 ASSERT(m_context.displayItemList()); | 41 ASSERT(m_context.displayItemList()); |
42 if (m_context.displayItemList()->displayItemConstructionIsDisabled()) | 42 if (m_context.displayItemList()->displayItemConstructionIsDisabled()) |
43 return; | 43 return; |
44 m_context.displayItemList()->add(EndTransformDisplayItem::create(m_clien
t)); | 44 m_context.displayItemList()->createAndAppendIfNeeded<EndTransformDisplay
Item>(m_client); |
45 } else { | 45 } else { |
46 EndTransformDisplayItem endTransform(m_client); | 46 EndTransformDisplayItem endTransform(m_client); |
47 endTransform.replay(m_context); | 47 endTransform.replay(m_context); |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 } // namespace blink | 51 } // namespace blink |
OLD | NEW |