| 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 (const PaintRecord* record = drawing.GetPaintRecord().get()) { | 31 if (drawing.GetPaintRecord() && drawing.KnownToBeOpaque()) { |
| 32 if (drawing.KnownToBeOpaque()) { | 32 // TODO(pdr): It may be too conservative to round in to the |
| 33 // TODO(pdr): It may be too conservative to round in to the | 33 // EnclosedIntRect. |
| 34 // enclosedIntRect. | 34 SkIRect conservative_rounded_rect; |
| 35 SkIRect conservative_rounded_rect; | 35 const SkRect& record_bounds = drawing.GetPaintRecordBounds(); |
| 36 const SkRect& cull_rect = record->cullRect(); | 36 record_bounds.roundIn(&conservative_rounded_rect); |
| 37 cull_rect.roundIn(&conservative_rounded_rect); | 37 known_to_be_opaque_region.op(conservative_rounded_rect, |
| 38 known_to_be_opaque_region.op(conservative_rounded_rect, | 38 SkRegion::kUnion_Op); |
| 39 SkRegion::kUnion_Op); | |
| 40 } | |
| 41 } | 39 } |
| 42 } | 40 } |
| 43 chunk.bounds = bounds; | 41 chunk.bounds = bounds; |
| 44 if (known_to_be_opaque_region.contains(EnclosingIntRect(bounds))) | 42 if (known_to_be_opaque_region.contains(EnclosingIntRect(bounds))) |
| 45 chunk.known_to_be_opaque = true; | 43 chunk.known_to_be_opaque = true; |
| 46 } | 44 } |
| 47 } | 45 } |
| 48 | 46 |
| 49 } // namespace | 47 } // namespace |
| 50 | 48 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 size_t visual_rect_index = 0; | 120 size_t visual_rect_index = 0; |
| 123 for (const DisplayItem& display_item : display_item_list_) { | 121 for (const DisplayItem& display_item : display_item_list_) { |
| 124 display_item.AppendToWebDisplayItemList( | 122 display_item.AppendToWebDisplayItemList( |
| 125 display_item_list_.VisualRect(visual_rect_index), list); | 123 display_item_list_.VisualRect(visual_rect_index), list); |
| 126 visual_rect_index++; | 124 visual_rect_index++; |
| 127 } | 125 } |
| 128 list->SetIsSuitableForGpuRasterization(IsSuitableForGpuRasterization()); | 126 list->SetIsSuitableForGpuRasterization(IsSuitableForGpuRasterization()); |
| 129 } | 127 } |
| 130 | 128 |
| 131 } // namespace blink | 129 } // namespace blink |
| OLD | NEW |