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/picture_layer.h" | 9 #include "cc/layers/picture_layer.h" |
10 #include "cc/playback/display_item_list.h" | 10 #include "cc/playback/display_item_list.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 namespace { | 84 namespace { |
85 | 85 |
86 static void appendDisplayItemToCcDisplayItemList(const DisplayItem& displayItem,
cc::DisplayItemList* list) | 86 static void appendDisplayItemToCcDisplayItemList(const DisplayItem& displayItem,
cc::DisplayItemList* list) |
87 { | 87 { |
88 if (DisplayItem::isDrawingType(displayItem.getType())) { | 88 if (DisplayItem::isDrawingType(displayItem.getType())) { |
89 const SkPicture* picture = static_cast<const DrawingDisplayItem&>(displa
yItem).picture(); | 89 const SkPicture* picture = static_cast<const DrawingDisplayItem&>(displa
yItem).picture(); |
90 if (!picture) | 90 if (!picture) |
91 return; | 91 return; |
92 gfx::Rect bounds = gfx::SkIRectToRect(picture->cullRect().roundOut()); | 92 gfx::Rect bounds = gfx::SkIRectToRect(picture->cullRect().roundOut()); |
93 list->CreateAndAppendItem<cc::DrawingDisplayItem>(bounds, sk_ref_sp(pict
ure)); | 93 list->CreateAndAppendDrawingItem<cc::DrawingDisplayItem>(bounds, sk_ref_
sp(picture)); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 static scoped_refptr<cc::DisplayItemList> recordPaintChunk(const PaintArtifact&
artifact, const PaintChunk& chunk, const gfx::Rect& combinedBounds) | 97 static scoped_refptr<cc::DisplayItemList> recordPaintChunk(const PaintArtifact&
artifact, const PaintChunk& chunk, const gfx::Rect& combinedBounds) |
98 { | 98 { |
99 cc::DisplayItemListSettings settings; | 99 cc::DisplayItemListSettings settings; |
100 scoped_refptr<cc::DisplayItemList> list = cc::DisplayItemList::Create( | 100 scoped_refptr<cc::DisplayItemList> list = cc::DisplayItemList::Create( |
101 gfx::Rect(combinedBounds.size()), settings); | 101 gfx::Rect(combinedBounds.size()), settings); |
102 | 102 |
103 gfx::Transform translation; | 103 gfx::Transform translation; |
104 translation.Translate(-combinedBounds.x(), -combinedBounds.y()); | 104 translation.Translate(-combinedBounds.x(), -combinedBounds.y()); |
105 // TODO(jbroman, wkorman): What visual rectangle is wanted here? | 105 // TODO(jbroman, wkorman): What visual rectangle is wanted here? |
106 list->CreateAndAppendItem<cc::TransformDisplayItem>(gfx::Rect(), translation
); | 106 list->CreateAndAppendPairedBeginItem<cc::TransformDisplayItem>(translation); |
107 | 107 |
108 const DisplayItemList& displayItems = artifact.getDisplayItemList(); | 108 const DisplayItemList& displayItems = artifact.getDisplayItemList(); |
109 for (const auto& displayItem : displayItems.itemsInPaintChunk(chunk)) | 109 for (const auto& displayItem : displayItems.itemsInPaintChunk(chunk)) |
110 appendDisplayItemToCcDisplayItemList(displayItem, list.get()); | 110 appendDisplayItemToCcDisplayItemList(displayItem, list.get()); |
111 | 111 |
112 list->CreateAndAppendItem<cc::EndTransformDisplayItem>(gfx::Rect()); | 112 list->CreateAndAppendPairedEndItem<cc::EndTransformDisplayItem>(); |
113 | 113 |
114 list->Finalize(); | 114 list->Finalize(); |
115 return list; | 115 return list; |
116 } | 116 } |
117 | 117 |
118 static gfx::Transform transformToTransformSpace(const TransformPaintPropertyNode
* currentSpace, const TransformPaintPropertyNode* targetSpace) | 118 static gfx::Transform transformToTransformSpace(const TransformPaintPropertyNode
* currentSpace, const TransformPaintPropertyNode* targetSpace) |
119 { | 119 { |
120 TransformationMatrix matrix; | 120 TransformationMatrix matrix; |
121 while (currentSpace != targetSpace) { | 121 while (currentSpace != targetSpace) { |
122 TransformationMatrix localMatrix = currentSpace->matrix(); | 122 TransformationMatrix localMatrix = currentSpace->matrix(); |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 if (m_extraDataForTestingEnabled) | 596 if (m_extraDataForTestingEnabled) |
597 m_extraDataForTesting->contentLayers.append(layer); | 597 m_extraDataForTesting->contentLayers.append(layer); |
598 } | 598 } |
599 | 599 |
600 // Mark the property trees as having been rebuilt. | 600 // Mark the property trees as having been rebuilt. |
601 host->property_trees()->sequence_number = kPropertyTreeSequenceNumber; | 601 host->property_trees()->sequence_number = kPropertyTreeSequenceNumber; |
602 host->property_trees()->needs_rebuild = false; | 602 host->property_trees()->needs_rebuild = false; |
603 } | 603 } |
604 | 604 |
605 } // namespace blink | 605 } // namespace blink |
OLD | NEW |