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 "platform/graphics/compositing/PaintArtifactCompositor.h" | 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h" |
6 | 6 |
7 #include "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
9 #include "cc/layers/layer_settings.h" | 9 #include "cc/layers/layer_settings.h" |
10 #include "cc/layers/picture_layer.h" | 10 #include "cc/layers/picture_layer.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 { | 93 { |
94 cc::DisplayItemListSettings settings; | 94 cc::DisplayItemListSettings settings; |
95 scoped_refptr<cc::DisplayItemList> list = cc::DisplayItemList::Create( | 95 scoped_refptr<cc::DisplayItemList> list = cc::DisplayItemList::Create( |
96 gfx::Rect(combinedBounds.size()), settings); | 96 gfx::Rect(combinedBounds.size()), settings); |
97 | 97 |
98 gfx::Transform translation; | 98 gfx::Transform translation; |
99 translation.Translate(-combinedBounds.x(), -combinedBounds.y()); | 99 translation.Translate(-combinedBounds.x(), -combinedBounds.y()); |
100 // TODO(jbroman, wkorman): What visual rectangle is wanted here? | 100 // TODO(jbroman, wkorman): What visual rectangle is wanted here? |
101 list->CreateAndAppendItem<cc::TransformDisplayItem>(gfx::Rect(), translation
); | 101 list->CreateAndAppendItem<cc::TransformDisplayItem>(gfx::Rect(), translation
); |
102 | 102 |
103 const DisplayItemList& displayItems = artifact.displayItemList(); | 103 const DisplayItemList& displayItems = artifact.getDisplayItemList(); |
104 for (const auto& displayItem : displayItems.itemsInPaintChunk(chunk)) | 104 for (const auto& displayItem : displayItems.itemsInPaintChunk(chunk)) |
105 appendDisplayItemToCcDisplayItemList(displayItem, list.get()); | 105 appendDisplayItemToCcDisplayItemList(displayItem, list.get()); |
106 | 106 |
107 list->CreateAndAppendItem<cc::EndTransformDisplayItem>(gfx::Rect()); | 107 list->CreateAndAppendItem<cc::EndTransformDisplayItem>(gfx::Rect()); |
108 | 108 |
109 list->Finalize(); | 109 list->Finalize(); |
110 return list; | 110 return list; |
111 } | 111 } |
112 | 112 |
113 static gfx::Transform transformToTransformSpace(const TransformPaintPropertyNode
* currentSpace, const TransformPaintPropertyNode* targetSpace) | 113 static gfx::Transform transformToTransformSpace(const TransformPaintPropertyNode
* currentSpace, const TransformPaintPropertyNode* targetSpace) |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 private: | 236 private: |
237 using NodeLayerPair = std::pair<const ClipPaintPropertyNode*, cc::Layer*>; | 237 using NodeLayerPair = std::pair<const ClipPaintPropertyNode*, cc::Layer*>; |
238 Vector<NodeLayerPair, 16> m_clipLayers; | 238 Vector<NodeLayerPair, 16> m_clipLayers; |
239 }; | 239 }; |
240 | 240 |
241 scoped_refptr<cc::Layer> foreignLayerForPaintChunk(const PaintArtifact& paintArt
ifact, const PaintChunk& paintChunk, gfx::Transform transform) | 241 scoped_refptr<cc::Layer> foreignLayerForPaintChunk(const PaintArtifact& paintArt
ifact, const PaintChunk& paintChunk, gfx::Transform transform) |
242 { | 242 { |
243 if (paintChunk.size() != 1) | 243 if (paintChunk.size() != 1) |
244 return nullptr; | 244 return nullptr; |
245 | 245 |
246 const auto& displayItem = paintArtifact.displayItemList()[paintChunk.beginIn
dex]; | 246 const auto& displayItem = paintArtifact.getDisplayItemList()[paintChunk.begi
nIndex]; |
247 if (!displayItem.isForeignLayer()) | 247 if (!displayItem.isForeignLayer()) |
248 return nullptr; | 248 return nullptr; |
249 | 249 |
250 const auto& foreignLayerDisplayItem = static_cast<const ForeignLayerDisplayI
tem&>(displayItem); | 250 const auto& foreignLayerDisplayItem = static_cast<const ForeignLayerDisplayI
tem&>(displayItem); |
251 scoped_refptr<cc::Layer> layer = foreignLayerDisplayItem.layer(); | 251 scoped_refptr<cc::Layer> layer = foreignLayerDisplayItem.layer(); |
252 transform.Translate(foreignLayerDisplayItem.location().x(), foreignLayerDisp
layItem.location().y()); | 252 transform.Translate(foreignLayerDisplayItem.location().x(), foreignLayerDisp
layItem.location().y()); |
253 layer->SetTransform(transform); | 253 layer->SetTransform(transform); |
254 layer->SetBounds(foreignLayerDisplayItem.bounds()); | 254 layer->SetBounds(foreignLayerDisplayItem.bounds()); |
255 layer->SetIsDrawable(true); | 255 layer->SetIsDrawable(true); |
256 return layer; | 256 return layer; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 layer->SetIsDrawable(true); | 307 layer->SetIsDrawable(true); |
308 layer->SetDoubleSided(!paintChunk.properties.backfaceHidden); | 308 layer->SetDoubleSided(!paintChunk.properties.backfaceHidden); |
309 if (paintChunk.knownToBeOpaque) | 309 if (paintChunk.knownToBeOpaque) |
310 layer->SetContentsOpaque(true); | 310 layer->SetContentsOpaque(true); |
311 m_contentLayerClients.append(contentLayerClient.release()); | 311 m_contentLayerClients.append(contentLayerClient.release()); |
312 return layer; | 312 return layer; |
313 } | 313 } |
314 | 314 |
315 | 315 |
316 } // namespace blink | 316 } // namespace blink |
OLD | NEW |