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/Transform3DRecorder.h" | 6 #include "core/paint/Transform3DRecorder.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/Transform3DDisplayItem.h" | 11 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 Transform3DRecorder::Transform3DRecorder(GraphicsContext& context, DisplayItemCl
ient client, const TransformationMatrix& transform) | 15 Transform3DRecorder::Transform3DRecorder(GraphicsContext& context, DisplayItemCl
ient client, DisplayItem::Type type, const TransformationMatrix& transform) |
16 : m_context(context) | 16 : m_context(context) |
17 , m_client(client) | 17 , m_client(client) |
| 18 , m_type(type) |
18 { | 19 { |
| 20 ASSERT(DisplayItem::isTransform3DType(type)); |
19 m_skipRecordingForIdentityTransform = transform.isIdentity(); | 21 m_skipRecordingForIdentityTransform = transform.isIdentity(); |
20 | 22 |
21 if (m_skipRecordingForIdentityTransform) | 23 if (m_skipRecordingForIdentityTransform) |
22 return; | 24 return; |
23 | 25 |
24 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 26 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
25 ASSERT(m_context.displayItemList()); | 27 ASSERT(m_context.displayItemList()); |
26 m_context.displayItemList()->add(BeginTransform3DDisplayItem::create(m_c
lient, transform)); | 28 m_context.displayItemList()->add(BeginTransform3DDisplayItem::create(m_c
lient, m_type, transform)); |
27 } else { | 29 } else { |
28 BeginTransform3DDisplayItem beginTransform(m_client, transform); | 30 BeginTransform3DDisplayItem beginTransform(m_client, m_type, transform); |
29 beginTransform.replay(&m_context); | 31 beginTransform.replay(&m_context); |
30 } | 32 } |
31 } | 33 } |
32 | 34 |
33 Transform3DRecorder::~Transform3DRecorder() | 35 Transform3DRecorder::~Transform3DRecorder() |
34 { | 36 { |
35 if (m_skipRecordingForIdentityTransform) | 37 if (m_skipRecordingForIdentityTransform) |
36 return; | 38 return; |
37 | 39 |
| 40 DisplayItem::Type endType = DisplayItem::transform3DTypeToEndTransform3DType
(m_type); |
38 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 41 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
39 ASSERT(m_context.displayItemList()); | 42 ASSERT(m_context.displayItemList()); |
40 m_context.displayItemList()->add(EndTransform3DDisplayItem::create(m_cli
ent)); | 43 m_context.displayItemList()->add(EndTransform3DDisplayItem::create(m_cli
ent, endType)); |
41 } else { | 44 } else { |
42 EndTransform3DDisplayItem endTransform(m_client); | 45 EndTransform3DDisplayItem endTransform(m_client, endType); |
43 endTransform.replay(&m_context); | 46 endTransform.replay(&m_context); |
44 } | 47 } |
45 } | 48 } |
46 | 49 |
47 } // namespace blink | 50 } // namespace blink |
OLD | NEW |