| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "platform/graphics/compositing/PaintChunksToCcLayer.h" | 5 #include "platform/graphics/compositing/PaintChunksToCcLayer.h" |
| 6 | 6 |
| 7 #include "cc/paint/compositing_display_item.h" | 7 #include "cc/paint/compositing_display_item.h" |
| 8 #include "cc/paint/display_item_list.h" | 8 #include "cc/paint/display_item_list.h" |
| 9 #include "cc/paint/drawing_display_item.h" | 9 #include "cc/paint/drawing_display_item.h" |
| 10 #include "cc/paint/filter_display_item.h" | 10 #include "cc/paint/filter_display_item.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 const gfx::Vector2dF& layerOffset, | 205 const gfx::Vector2dF& layerOffset, |
| 206 const DisplayItemList& displayItems, | 206 const DisplayItemList& displayItems, |
| 207 GeometryMapper& geometryMapper) { | 207 GeometryMapper& geometryMapper) { |
| 208 auto ccList = make_scoped_refptr(new cc::DisplayItemList); | 208 auto ccList = make_scoped_refptr(new cc::DisplayItemList); |
| 209 | 209 |
| 210 gfx::Transform counterOffset; | 210 gfx::Transform counterOffset; |
| 211 counterOffset.Translate(-layerOffset.x(), -layerOffset.y()); | 211 counterOffset.Translate(-layerOffset.x(), -layerOffset.y()); |
| 212 ccList->CreateAndAppendPairedBeginItem<cc::TransformDisplayItem>( | 212 ccList->CreateAndAppendPairedBeginItem<cc::TransformDisplayItem>( |
| 213 counterOffset); | 213 counterOffset); |
| 214 | 214 |
| 215 for (const auto& paintChunk : paintChunks) { | 215 for (const auto* paintChunk : paintChunks) { |
| 216 const PropertyTreeState* state = &paintChunk->properties.propertyTreeState; | 216 const PropertyTreeState* state = &paintChunk->properties.propertyTreeState; |
| 217 PropertyTreeStateIterator iterator(*state); | 217 PropertyTreeStateIterator iterator(*state); |
| 218 Vector<PropertyTreeState> pairedStates; | 218 Vector<PropertyTreeState> pairedStates; |
| 219 for (; state && *state != layerState; state = iterator.next()) { | 219 for (; state && *state != layerState; state = iterator.next()) { |
| 220 if (state->innermostNode() != PropertyTreeState::None) | 220 if (state->innermostNode() != PropertyTreeState::None) |
| 221 pairedStates.push_back(*state); | 221 pairedStates.push_back(*state); |
| 222 } | 222 } |
| 223 | 223 |
| 224 // TODO(chrishtr): we can avoid some extra paired display items if | 224 // TODO(chrishtr): we can avoid some extra paired display items if |
| 225 // multiple PaintChunks share them. We can also collapse clips between | 225 // multiple PaintChunks share them. We can also collapse clips between |
| 226 // transforms into single clips in the same way that PaintLayerClipper does. | 226 // transforms into single clips in the same way that PaintLayerClipper does. |
| 227 Vector<EndDisplayItemType> endDisplayItems; | 227 Vector<EndDisplayItemType> endDisplayItems; |
| 228 | 228 |
| 229 recordPairedBeginDisplayItems(pairedStates, layerState, *ccList.get(), | 229 recordPairedBeginDisplayItems(pairedStates, layerState, *ccList.get(), |
| 230 endDisplayItems, geometryMapper); | 230 endDisplayItems, geometryMapper); |
| 231 | 231 |
| 232 for (const auto& displayItem : displayItems.itemsInPaintChunk(*paintChunk)) | 232 for (const auto& displayItem : displayItems.itemsInPaintChunk(*paintChunk)) |
| 233 appendDisplayItemToCcDisplayItemList(displayItem, ccList.get()); | 233 appendDisplayItemToCcDisplayItemList(displayItem, ccList.get()); |
| 234 | 234 |
| 235 recordPairedEndDisplayItems(endDisplayItems, ccList.get()); | 235 recordPairedEndDisplayItems(endDisplayItems, ccList.get()); |
| 236 } | 236 } |
| 237 | 237 |
| 238 ccList->CreateAndAppendPairedEndItem<cc::EndTransformDisplayItem>(); | 238 ccList->CreateAndAppendPairedEndItem<cc::EndTransformDisplayItem>(); |
| 239 | 239 |
| 240 ccList->Finalize(); | 240 ccList->Finalize(); |
| 241 return ccList; | 241 return ccList; |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace blink | 244 } // namespace blink |
| OLD | NEW |