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/DisplayItemTransformTreeBuilder.h" | 6 #include "platform/graphics/paint/DisplayItemTransformTreeBuilder.h" |
7 | 7 |
8 #include "platform/graphics/paint/DisplayItem.h" | 8 #include "platform/graphics/paint/DisplayItem.h" |
9 #include "platform/graphics/paint/DisplayItemList.h" | |
9 #include "platform/graphics/paint/DisplayItemTransformTree.h" | 10 #include "platform/graphics/paint/DisplayItemTransformTree.h" |
10 #include "platform/graphics/paint/Transform3DDisplayItem.h" | 11 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
12 #include "public/platform/WebDisplayList.h" | |
11 | 13 |
12 namespace blink { | 14 namespace blink { |
13 | 15 |
14 DisplayItemTransformTreeBuilder::DisplayItemTransformTreeBuilder() | 16 DisplayItemTransformTreeBuilder::DisplayItemTransformTreeBuilder() |
15 : m_transformTree(adoptPtr(new DisplayItemTransformTree)) | 17 : m_transformTree(adoptPtr(new DisplayItemTransformTree)) |
16 , m_rangeBeginIndex(0) | 18 , m_rangeBeginIndex(0) |
17 , m_currentIndex(0) | 19 , m_currentIndex(0) |
18 { | 20 { |
19 pushCurrentTransformNode(0 /* root node */, FloatSize()); | 21 pushCurrentTransformNode(0 /* root node */, FloatSize()); |
20 } | 22 } |
(...skipping 28 matching lines...) Expand all Loading... | |
49 *transform = begin3D.transform(); | 51 *transform = begin3D.transform(); |
50 if (transform->isIdentityOr2DTranslation()) | 52 if (transform->isIdentityOr2DTranslation()) |
51 return Only2DTranslation; | 53 return Only2DTranslation; |
52 return RequiresTransformNode; | 54 return RequiresTransformNode; |
53 } | 55 } |
54 return NotATransform; | 56 return NotATransform; |
55 } | 57 } |
56 | 58 |
57 } // namespace | 59 } // namespace |
58 | 60 |
61 void DisplayItemTransformTreeBuilder::build(const DisplayItemList& displayList, const DisplayListDiff& displayListDiff) | |
62 { | |
63 // TODO(chrishtr): use |displayListDiff| to optimize. | |
pdr.
2015/07/24 05:37:51
Can you expand a little about how the diff would h
chrishtr
2015/07/24 14:53:45
Transform-related display items might occur in the
| |
64 for (const auto& displayItem : displayList.displayItems()) { | |
65 processDisplayItem(*displayItem); | |
66 } | |
67 } | |
68 | |
59 void DisplayItemTransformTreeBuilder::processDisplayItem(const DisplayItem& disp layItem) | 69 void DisplayItemTransformTreeBuilder::processDisplayItem(const DisplayItem& disp layItem) |
60 { | 70 { |
61 if (displayItem.isBegin()) { | 71 if (displayItem.isBegin()) { |
62 TransformationMatrix matrix; | 72 TransformationMatrix matrix; |
63 switch (classifyBeginItem(displayItem, &matrix)) { | 73 switch (classifyBeginItem(displayItem, &matrix)) { |
64 case NotATransform: | 74 case NotATransform: |
65 // Remember to ignore this begin later on. | 75 // Remember to ignore this begin later on. |
66 currentTransformNodeData().ignoredBeginCount++; | 76 currentTransformNodeData().ignoredBeginCount++; |
67 break; | 77 break; |
68 case Only2DTranslation: | 78 case Only2DTranslation: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 const auto& current = currentTransformNodeData(); | 112 const auto& current = currentTransformNodeData(); |
103 m_transformTree->appendRangeRecord(m_rangeBeginIndex, m_currentIndex, cu rrent.transformNode, current.offset); | 113 m_transformTree->appendRangeRecord(m_rangeBeginIndex, m_currentIndex, cu rrent.transformNode, current.offset); |
104 } | 114 } |
105 | 115 |
106 // The current display item is a boundary. | 116 // The current display item is a boundary. |
107 // The earliest the next range could begin is the next one. | 117 // The earliest the next range could begin is the next one. |
108 m_rangeBeginIndex = m_currentIndex + 1; | 118 m_rangeBeginIndex = m_currentIndex + 1; |
109 } | 119 } |
110 | 120 |
111 } // namespace blink | 121 } // namespace blink |
OLD | NEW |