Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp

Issue 1484163002: Raster display item lists via a visual rect RTree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review feedback. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 m_rootLayer = cc::Layer::Create(); 76 m_rootLayer = cc::Layer::Create();
77 m_webLayer = wrapUnique(Platform::current()->compositorSupport()->createLaye rFromCCLayer(m_rootLayer.get())); 77 m_webLayer = wrapUnique(Platform::current()->compositorSupport()->createLaye rFromCCLayer(m_rootLayer.get()));
78 } 78 }
79 79
80 PaintArtifactCompositor::~PaintArtifactCompositor() 80 PaintArtifactCompositor::~PaintArtifactCompositor()
81 { 81 {
82 } 82 }
83 83
84 namespace { 84 namespace {
85 85
86 static gfx::Rect largeRect(-200000, -200000, 400000, 400000);
87
86 static void appendDisplayItemToCcDisplayItemList(const DisplayItem& displayItem, cc::DisplayItemList* list) 88 static void appendDisplayItemToCcDisplayItemList(const DisplayItem& displayItem, cc::DisplayItemList* list)
87 { 89 {
88 if (DisplayItem::isDrawingType(displayItem.getType())) { 90 if (DisplayItem::isDrawingType(displayItem.getType())) {
89 const SkPicture* picture = static_cast<const DrawingDisplayItem&>(displa yItem).picture(); 91 const SkPicture* picture = static_cast<const DrawingDisplayItem&>(displa yItem).picture();
90 if (!picture) 92 if (!picture)
91 return; 93 return;
92 gfx::Rect bounds = gfx::SkIRectToRect(picture->cullRect().roundOut()); 94 // In theory we would pass the bounds of the picture, previously done as :
93 list->CreateAndAppendItem<cc::DrawingDisplayItem>(bounds, sk_ref_sp(pict ure)); 95 // gfx::Rect bounds = gfx::SkIRectToRect(picture->cullRect().roundOut()) ;
96 // or use the visual rect directly. However, clip content layers attempt
97 // to raster in a different space than that of the visual rects. We'll b e
98 // reworking visual rects further for SPv2, so for now we just pass a
99 // visual rect large enough to make sure items raster.
100 list->CreateAndAppendItem<cc::DrawingDisplayItem>(largeRect, sk_ref_sp(p icture));
94 } 101 }
95 } 102 }
96 103
97 static scoped_refptr<cc::DisplayItemList> recordPaintChunk(const PaintArtifact& artifact, const PaintChunk& chunk, const gfx::Rect& combinedBounds) 104 static scoped_refptr<cc::DisplayItemList> recordPaintChunk(const PaintArtifact& artifact, const PaintChunk& chunk, const gfx::Rect& combinedBounds)
98 { 105 {
99 cc::DisplayItemListSettings settings; 106 cc::DisplayItemListSettings settings;
100 scoped_refptr<cc::DisplayItemList> list = cc::DisplayItemList::Create( 107 scoped_refptr<cc::DisplayItemList> list = cc::DisplayItemList::Create(settin gs);
101 gfx::Rect(combinedBounds.size()), settings);
102 108
103 gfx::Transform translation; 109 gfx::Transform translation;
104 translation.Translate(-combinedBounds.x(), -combinedBounds.y()); 110 translation.Translate(-combinedBounds.x(), -combinedBounds.y());
105 // TODO(jbroman, wkorman): What visual rectangle is wanted here? 111 // Passing combinedBounds as the visual rect for the begin/end transform ite m
106 list->CreateAndAppendItem<cc::TransformDisplayItem>(gfx::Rect(), translation ); 112 // would normally be the sensible thing to do, but see comment above re:
113 // visual rects for drawing items and further rework in flight.
114 list->CreateAndAppendItem<cc::TransformDisplayItem>(largeRect, translation);
107 115
108 const DisplayItemList& displayItems = artifact.getDisplayItemList(); 116 const DisplayItemList& displayItems = artifact.getDisplayItemList();
109 for (const auto& displayItem : displayItems.itemsInPaintChunk(chunk)) 117 for (const auto& displayItem : displayItems.itemsInPaintChunk(chunk))
110 appendDisplayItemToCcDisplayItemList(displayItem, list.get()); 118 appendDisplayItemToCcDisplayItemList(displayItem, list.get());
111 119
112 list->CreateAndAppendItem<cc::EndTransformDisplayItem>(gfx::Rect()); 120 list->CreateAndAppendItem<cc::EndTransformDisplayItem>(largeRect);
113 121
114 list->Finalize(); 122 list->Finalize();
115 return list; 123 return list;
116 } 124 }
117 125
118 static gfx::Transform transformToTransformSpace(const TransformPaintPropertyNode * currentSpace, const TransformPaintPropertyNode* targetSpace) 126 static gfx::Transform transformToTransformSpace(const TransformPaintPropertyNode * currentSpace, const TransformPaintPropertyNode* targetSpace)
119 { 127 {
120 TransformationMatrix matrix; 128 TransformationMatrix matrix;
121 while (currentSpace != targetSpace) { 129 while (currentSpace != targetSpace) {
122 TransformationMatrix localMatrix = currentSpace->matrix(); 130 TransformationMatrix localMatrix = currentSpace->matrix();
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 if (m_extraDataForTestingEnabled) 602 if (m_extraDataForTestingEnabled)
595 m_extraDataForTesting->contentLayers.append(layer); 603 m_extraDataForTesting->contentLayers.append(layer);
596 } 604 }
597 605
598 // Mark the property trees as having been rebuilt. 606 // Mark the property trees as having been rebuilt.
599 host->property_trees()->sequence_number = kPropertyTreeSequenceNumber; 607 host->property_trees()->sequence_number = kPropertyTreeSequenceNumber;
600 host->property_trees()->needs_rebuild = false; 608 host->property_trees()->needs_rebuild = false;
601 } 609 }
602 610
603 } // namespace blink 611 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698