OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "platform/graphics/paint/DisplayItemPropertyTreeBuilder.h" | 6 #include "platform/graphics/paint/DisplayItemPropertyTreeBuilder.h" |
7 | 7 |
8 #include "platform/graphics/paint/DisplayItem.h" | 8 #include "platform/graphics/paint/DisplayItem.h" |
9 #include "platform/graphics/paint/DisplayItemClipTree.h" | 9 #include "platform/graphics/paint/DisplayItemClipTree.h" |
10 #include "platform/graphics/paint/DisplayItemTransformTree.h" | 10 #include "platform/graphics/paint/DisplayItemTransformTree.h" |
| 11 #include "platform/graphics/paint/ScrollDisplayItem.h" |
11 #include "platform/graphics/paint/Transform3DDisplayItem.h" | 12 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
| 13 #include "platform/graphics/paint/TransformDisplayItem.h" |
12 | 14 |
13 namespace blink { | 15 namespace blink { |
14 | 16 |
15 DisplayItemPropertyTreeBuilder::DisplayItemPropertyTreeBuilder() | 17 DisplayItemPropertyTreeBuilder::DisplayItemPropertyTreeBuilder() |
16 : m_transformTree(adoptPtr(new DisplayItemTransformTree)) | 18 : m_transformTree(adoptPtr(new DisplayItemTransformTree)) |
17 , m_clipTree(adoptPtr(new DisplayItemClipTree)) | 19 , m_clipTree(adoptPtr(new DisplayItemClipTree)) |
18 , m_rangeBeginIndex(0) | 20 , m_rangeBeginIndex(0) |
19 , m_currentIndex(0) | 21 , m_currentIndex(0) |
20 { | 22 { |
21 m_stateStack.append(BuilderState()); | 23 m_stateStack.append(BuilderState()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 static BeginDisplayItemClassification classifyBeginItem(const DisplayItem& begin
DisplayItem) | 75 static BeginDisplayItemClassification classifyBeginItem(const DisplayItem& begin
DisplayItem) |
74 { | 76 { |
75 ASSERT(beginDisplayItem.isBegin()); | 77 ASSERT(beginDisplayItem.isBegin()); |
76 | 78 |
77 BeginDisplayItemClassification result; | 79 BeginDisplayItemClassification result; |
78 DisplayItem::Type type = beginDisplayItem.type(); | 80 DisplayItem::Type type = beginDisplayItem.type(); |
79 if (DisplayItem::isTransform3DType(type)) { | 81 if (DisplayItem::isTransform3DType(type)) { |
80 const auto& begin3D = static_cast<const BeginTransform3DDisplayItem&>(be
ginDisplayItem); | 82 const auto& begin3D = static_cast<const BeginTransform3DDisplayItem&>(be
ginDisplayItem); |
81 result.matrix = begin3D.transform(); | 83 result.matrix = begin3D.transform(); |
82 result.transformKind = result.matrix.isIdentityOr2DTranslation() ? Only2
DTranslation : RequiresTransformNode; | 84 result.transformKind = result.matrix.isIdentityOr2DTranslation() ? Only2
DTranslation : RequiresTransformNode; |
| 85 } else if (type == DisplayItem::BeginTransform) { |
| 86 const auto& begin2D = static_cast<const BeginTransformDisplayItem&>(begi
nDisplayItem); |
| 87 result.matrix = begin2D.transform(); |
| 88 result.transformKind = begin2D.transform().isIdentityOrTranslation() ? O
nly2DTranslation : RequiresTransformNode; |
| 89 } else if (DisplayItem::isScrollType(type)) { |
| 90 const auto& beginScroll = static_cast<const BeginScrollDisplayItem&>(beg
inDisplayItem); |
| 91 const IntSize& offset = beginScroll.currentOffset(); |
| 92 result.matrix.translate(-offset.width(), -offset.height()); |
| 93 result.transformKind = Only2DTranslation; |
83 } | 94 } |
84 return result; | 95 return result; |
85 } | 96 } |
86 | 97 |
87 } // namespace | 98 } // namespace |
88 | 99 |
89 void DisplayItemPropertyTreeBuilder::processBeginItem(const DisplayItem& display
Item) | 100 void DisplayItemPropertyTreeBuilder::processBeginItem(const DisplayItem& display
Item) |
90 { | 101 { |
91 BeginDisplayItemClassification classification = classifyBeginItem(displayIte
m); | 102 BeginDisplayItemClassification classification = classifyBeginItem(displayIte
m); |
92 | 103 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 rangeRecord.clipNodeIndex = current.clipNode; | 166 rangeRecord.clipNodeIndex = current.clipNode; |
156 m_rangeRecords.append(rangeRecord); | 167 m_rangeRecords.append(rangeRecord); |
157 } | 168 } |
158 | 169 |
159 // The current display item is a boundary. | 170 // The current display item is a boundary. |
160 // The earliest the next range could begin is the next one. | 171 // The earliest the next range could begin is the next one. |
161 m_rangeBeginIndex = m_currentIndex + 1; | 172 m_rangeBeginIndex = m_currentIndex + 1; |
162 } | 173 } |
163 | 174 |
164 } // namespace blink | 175 } // namespace blink |
OLD | NEW |