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

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

Issue 2225563002: Reland "Raster display item lists via a visual rect RTree." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to head. 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
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | ui/compositor/canvas_painter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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->CreateAndAppendDrawingItem<cc::DrawingDisplayItem>(bounds, sk_ref_ sp(picture)); 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->CreateAndAppendDrawingItem<cc::DrawingDisplayItem>(largeRect, sk_r ef_sp(picture));
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
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.
106 list->CreateAndAppendPairedBeginItem<cc::TransformDisplayItem>(translation); 114 list->CreateAndAppendPairedBeginItem<cc::TransformDisplayItem>(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->CreateAndAppendPairedEndItem<cc::EndTransformDisplayItem>(); 120 list->CreateAndAppendPairedEndItem<cc::EndTransformDisplayItem>();
113 121
114 list->Finalize(); 122 list->Finalize();
115 return list; 123 return list;
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 if (m_extraDataForTestingEnabled) 603 if (m_extraDataForTestingEnabled)
596 m_extraDataForTesting->contentLayers.append(layer); 604 m_extraDataForTesting->contentLayers.append(layer);
597 } 605 }
598 606
599 // Mark the property trees as having been rebuilt. 607 // Mark the property trees as having been rebuilt.
600 host->property_trees()->sequence_number = kPropertyTreeSequenceNumber; 608 host->property_trees()->sequence_number = kPropertyTreeSequenceNumber;
601 host->property_trees()->needs_rebuild = false; 609 host->property_trees()->needs_rebuild = false;
602 } 610 }
603 611
604 } // namespace blink 612 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | ui/compositor/canvas_painter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698