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, const Display
ItemClientWrapper& client, DisplayItem::Type type, const TransformationMatrix& t
ransform) | 15 Transform3DRecorder::Transform3DRecorder(GraphicsContext& context, const Display
ItemClientWrapper& client, DisplayItem::Type type, const TransformationMatrix& t
ransform) |
16 : m_context(context) | 16 : m_context(context) |
17 , m_client(client) | 17 , m_client(client) |
18 , m_type(type) | 18 , m_type(type) |
19 { | 19 { |
20 ASSERT(DisplayItem::isTransform3DType(type)); | 20 ASSERT(DisplayItem::isTransform3DType(type)); |
21 m_skipRecordingForIdentityTransform = transform.isIdentity(); | 21 m_skipRecordingForIdentityTransform = transform.isIdentity(); |
22 | 22 |
23 if (m_skipRecordingForIdentityTransform) | 23 if (m_skipRecordingForIdentityTransform) |
24 return; | 24 return; |
25 | 25 |
26 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 26 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
27 ASSERT(m_context.displayItemList()); | 27 ASSERT(m_context.displayItemList()); |
28 if (m_context.displayItemList()->displayItemConstructionIsDisabled()) | 28 if (m_context.displayItemList()->displayItemConstructionIsDisabled()) |
29 return; | 29 return; |
30 m_context.displayItemList()->add(BeginTransform3DDisplayItem::create(m_c
lient, m_type, transform)); | 30 m_context.displayItemList()->createAndAppend<BeginTransform3DDisplayItem
>(m_client, m_type, transform); |
31 } else { | 31 } else { |
32 BeginTransform3DDisplayItem beginTransform(m_client, m_type, transform); | 32 BeginTransform3DDisplayItem beginTransform(m_client, m_type, transform); |
33 beginTransform.replay(m_context); | 33 beginTransform.replay(m_context); |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 Transform3DRecorder::~Transform3DRecorder() | 37 Transform3DRecorder::~Transform3DRecorder() |
38 { | 38 { |
39 if (m_skipRecordingForIdentityTransform) | 39 if (m_skipRecordingForIdentityTransform) |
40 return; | 40 return; |
41 | 41 |
42 DisplayItem::Type endType = DisplayItem::transform3DTypeToEndTransform3DType
(m_type); | 42 DisplayItem::Type endType = DisplayItem::transform3DTypeToEndTransform3DType
(m_type); |
43 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 43 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
44 ASSERT(m_context.displayItemList()); | 44 ASSERT(m_context.displayItemList()); |
45 if (!m_context.displayItemList()->displayItemConstructionIsDisabled()) { | 45 if (!m_context.displayItemList()->displayItemConstructionIsDisabled()) { |
46 if (m_context.displayItemList()->lastDisplayItemIsNoopBegin()) | 46 if (m_context.displayItemList()->lastDisplayItemIsNoopBegin()) |
47 m_context.displayItemList()->removeLastDisplayItem(); | 47 m_context.displayItemList()->removeLastDisplayItem(); |
48 else | 48 else |
49 m_context.displayItemList()->add(EndTransform3DDisplayItem::crea
te(m_client, endType)); | 49 m_context.displayItemList()->createAndAppend<EndTransform3DDispl
ayItem>(m_client, endType); |
50 } | 50 } |
51 } else { | 51 } else { |
52 EndTransform3DDisplayItem endTransform(m_client, endType); | 52 EndTransform3DDisplayItem endTransform(m_client, endType); |
53 endTransform.replay(m_context); | 53 endTransform.replay(m_context); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 } // namespace blink | 57 } // namespace blink |
OLD | NEW |