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/paint/PaintArtifact.h" | 5 #include "platform/graphics/paint/PaintArtifact.h" |
6 | 6 |
7 #include "cc/paint/display_item_list.h" | 7 #include "cc/paint/display_item_list.h" |
8 #include "platform/geometry/IntRect.h" | 8 #include "platform/geometry/IntRect.h" |
9 #include "platform/graphics/GraphicsLayer.h" | 9 #include "platform/graphics/GraphicsLayer.h" |
10 #include "platform/graphics/compositing/PaintChunksToCcLayer.h" | 10 #include "platform/graphics/compositing/PaintChunksToCcLayer.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 void ComputeChunkBoundsAndOpaqueness(const DisplayItemList& display_items, | 21 void ComputeChunkBoundsAndOpaqueness(const DisplayItemList& display_items, |
22 Vector<PaintChunk>& paint_chunks) { | 22 Vector<PaintChunk>& paint_chunks) { |
23 for (PaintChunk& chunk : paint_chunks) { | 23 for (PaintChunk& chunk : paint_chunks) { |
24 FloatRect bounds; | 24 FloatRect bounds; |
25 SkRegion known_to_be_opaque_region; | 25 SkRegion known_to_be_opaque_region; |
26 for (const DisplayItem& item : display_items.ItemsInPaintChunk(chunk)) { | 26 for (const DisplayItem& item : display_items.ItemsInPaintChunk(chunk)) { |
27 bounds.Unite(FloatRect(item.Client().VisualRect())); | 27 bounds.Unite(FloatRect(item.Client().VisualRect())); |
28 if (!item.IsDrawing()) | 28 if (!item.IsDrawing()) |
29 continue; | 29 continue; |
30 const auto& drawing = static_cast<const DrawingDisplayItem&>(item); | 30 const auto& drawing = static_cast<const DrawingDisplayItem&>(item); |
31 if (drawing.GetPaintRecord() && drawing.KnownToBeOpaque()) { | 31 if (const PaintRecord* record = drawing.GetPaintRecord().get()) { |
32 // TODO(pdr): It may be too conservative to round in to the | 32 if (drawing.KnownToBeOpaque()) { |
33 // EnclosedIntRect. | 33 // TODO(pdr): It may be too conservative to round in to the |
34 SkIRect conservative_rounded_rect; | 34 // enclosedIntRect. |
35 const SkRect& record_bounds = drawing.GetPaintRecordBounds(); | 35 SkIRect conservative_rounded_rect; |
36 record_bounds.roundIn(&conservative_rounded_rect); | 36 const SkRect& cull_rect = record->cullRect(); |
37 known_to_be_opaque_region.op(conservative_rounded_rect, | 37 cull_rect.roundIn(&conservative_rounded_rect); |
38 SkRegion::kUnion_Op); | 38 known_to_be_opaque_region.op(conservative_rounded_rect, |
| 39 SkRegion::kUnion_Op); |
| 40 } |
39 } | 41 } |
40 } | 42 } |
41 chunk.bounds = bounds; | 43 chunk.bounds = bounds; |
42 if (known_to_be_opaque_region.contains(EnclosingIntRect(bounds))) | 44 if (known_to_be_opaque_region.contains(EnclosingIntRect(bounds))) |
43 chunk.known_to_be_opaque = true; | 45 chunk.known_to_be_opaque = true; |
44 } | 46 } |
45 } | 47 } |
46 | 48 |
47 } // namespace | 49 } // namespace |
48 | 50 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 size_t visual_rect_index = 0; | 122 size_t visual_rect_index = 0; |
121 for (const DisplayItem& display_item : display_item_list_) { | 123 for (const DisplayItem& display_item : display_item_list_) { |
122 display_item.AppendToWebDisplayItemList( | 124 display_item.AppendToWebDisplayItemList( |
123 display_item_list_.VisualRect(visual_rect_index), list); | 125 display_item_list_.VisualRect(visual_rect_index), list); |
124 visual_rect_index++; | 126 visual_rect_index++; |
125 } | 127 } |
126 list->SetIsSuitableForGpuRasterization(IsSuitableForGpuRasterization()); | 128 list->SetIsSuitableForGpuRasterization(IsSuitableForGpuRasterization()); |
127 } | 129 } |
128 | 130 |
129 } // namespace blink | 131 } // namespace blink |
OLD | NEW |