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 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 } | 42 } |
43 chunk.bounds = bounds; | 43 chunk.bounds = bounds; |
44 if (known_to_be_opaque_region.contains(EnclosingIntRect(bounds))) | 44 if (known_to_be_opaque_region.contains(EnclosingIntRect(bounds))) |
45 chunk.known_to_be_opaque = true; | 45 chunk.known_to_be_opaque = true; |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 } // namespace | 49 } // namespace |
50 | 50 |
51 PaintArtifact::PaintArtifact() | 51 PaintArtifact::PaintArtifact() : display_item_list_(0) {} |
52 : display_item_list_(0), is_suitable_for_gpu_rasterization_(true) {} | |
53 | 52 |
54 PaintArtifact::PaintArtifact(DisplayItemList display_items, | 53 PaintArtifact::PaintArtifact(DisplayItemList display_items, |
55 Vector<PaintChunk> paint_chunks, | 54 Vector<PaintChunk> paint_chunks, |
56 bool is_suitable_for_gpu_rasterization_arg) | 55 int num_slow_paths) |
57 : display_item_list_(std::move(display_items)), | 56 : display_item_list_(std::move(display_items)), |
58 paint_chunks_(std::move(paint_chunks)), | 57 paint_chunks_(std::move(paint_chunks)), |
59 is_suitable_for_gpu_rasterization_( | 58 num_slow_paths_(num_slow_paths) { |
60 is_suitable_for_gpu_rasterization_arg) { | |
61 ComputeChunkBoundsAndOpaqueness(display_item_list_, paint_chunks_); | 59 ComputeChunkBoundsAndOpaqueness(display_item_list_, paint_chunks_); |
62 } | 60 } |
63 | 61 |
64 PaintArtifact::PaintArtifact(PaintArtifact&& source) | 62 PaintArtifact::PaintArtifact(PaintArtifact&& source) |
65 : display_item_list_(std::move(source.display_item_list_)), | 63 : display_item_list_(std::move(source.display_item_list_)), |
66 paint_chunks_(std::move(source.paint_chunks_)), | 64 paint_chunks_(std::move(source.paint_chunks_)), |
67 is_suitable_for_gpu_rasterization_( | 65 num_slow_paths_(source.num_slow_paths_) {} |
68 source.is_suitable_for_gpu_rasterization_) {} | |
69 | 66 |
70 PaintArtifact::~PaintArtifact() {} | 67 PaintArtifact::~PaintArtifact() {} |
71 | 68 |
72 PaintArtifact& PaintArtifact::operator=(PaintArtifact&& source) { | 69 PaintArtifact& PaintArtifact::operator=(PaintArtifact&& source) { |
73 display_item_list_ = std::move(source.display_item_list_); | 70 display_item_list_ = std::move(source.display_item_list_); |
74 paint_chunks_ = std::move(source.paint_chunks_); | 71 paint_chunks_ = std::move(source.paint_chunks_); |
75 is_suitable_for_gpu_rasterization_ = | 72 num_slow_paths_ = source.num_slow_paths_; |
76 source.is_suitable_for_gpu_rasterization_; | |
77 return *this; | 73 return *this; |
78 } | 74 } |
79 | 75 |
80 void PaintArtifact::Reset() { | 76 void PaintArtifact::Reset() { |
81 display_item_list_.Clear(); | 77 display_item_list_.Clear(); |
82 paint_chunks_.clear(); | 78 paint_chunks_.clear(); |
83 } | 79 } |
84 | 80 |
85 size_t PaintArtifact::ApproximateUnsharedMemoryUsage() const { | 81 size_t PaintArtifact::ApproximateUnsharedMemoryUsage() const { |
86 return sizeof(*this) + display_item_list_.MemoryUsageInBytes() + | 82 return sizeof(*this) + display_item_list_.MemoryUsageInBytes() + |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 114 |
119 DISABLE_CFI_PERF | 115 DISABLE_CFI_PERF |
120 void PaintArtifact::AppendToWebDisplayItemList(WebDisplayItemList* list) const { | 116 void PaintArtifact::AppendToWebDisplayItemList(WebDisplayItemList* list) const { |
121 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList"); | 117 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList"); |
122 size_t visual_rect_index = 0; | 118 size_t visual_rect_index = 0; |
123 for (const DisplayItem& display_item : display_item_list_) { | 119 for (const DisplayItem& display_item : display_item_list_) { |
124 display_item.AppendToWebDisplayItemList( | 120 display_item.AppendToWebDisplayItemList( |
125 display_item_list_.VisualRect(visual_rect_index), list); | 121 display_item_list_.VisualRect(visual_rect_index), list); |
126 visual_rect_index++; | 122 visual_rect_index++; |
127 } | 123 } |
128 list->SetIsSuitableForGpuRasterization(IsSuitableForGpuRasterization()); | 124 list->SetNumSlowPaths(num_slow_paths_); |
129 } | 125 } |
130 | 126 |
131 } // namespace blink | 127 } // namespace blink |
OLD | NEW |