| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/playback/display_item_list.h" | 5 #include "cc/playback/display_item_list.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // instead because it ignores canvas CTM. | 122 // instead because it ignores canvas CTM. |
| 123 SkRegion device_clip; | 123 SkRegion device_clip; |
| 124 device_clip.setRect(gfx::RectToSkIRect(canvas_target_playback_rect)); | 124 device_clip.setRect(gfx::RectToSkIRect(canvas_target_playback_rect)); |
| 125 canvas->clipRegion(device_clip); | 125 canvas->clipRegion(device_clip); |
| 126 } | 126 } |
| 127 canvas->scale(contents_scale, contents_scale); | 127 canvas->scale(contents_scale, contents_scale); |
| 128 Raster(canvas, callback); | 128 Raster(canvas, callback); |
| 129 canvas->restore(); | 129 canvas->restore(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 DISABLE_CFI_PERF |
| 132 void DisplayItemList::Raster(SkCanvas* canvas, | 133 void DisplayItemList::Raster(SkCanvas* canvas, |
| 133 SkPicture::AbortCallback* callback) const { | 134 SkPicture::AbortCallback* callback) const { |
| 134 gfx::Rect canvas_playback_rect; | 135 gfx::Rect canvas_playback_rect; |
| 135 if (!GetCanvasClipBounds(canvas, &canvas_playback_rect)) | 136 if (!GetCanvasClipBounds(canvas, &canvas_playback_rect)) |
| 136 return; | 137 return; |
| 137 | 138 |
| 138 std::vector<size_t> indices; | 139 std::vector<size_t> indices; |
| 139 rtree_.Search(canvas_playback_rect, &indices); | 140 rtree_.Search(canvas_playback_rect, &indices); |
| 140 for (size_t index : indices) { | 141 for (size_t index : indices) { |
| 141 inputs_.items[index].Raster(canvas, callback); | 142 inputs_.items[index].Raster(canvas, callback); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // none of the items might individually trigger a veto even though they | 176 // none of the items might individually trigger a veto even though they |
| 176 // collectively have enough "bad" operations that a corresponding Picture | 177 // collectively have enough "bad" operations that a corresponding Picture |
| 177 // would get vetoed. See crbug.com/513016. | 178 // would get vetoed. See crbug.com/513016. |
| 178 return inputs_.all_items_are_suitable_for_gpu_rasterization; | 179 return inputs_.all_items_are_suitable_for_gpu_rasterization; |
| 179 } | 180 } |
| 180 | 181 |
| 181 int DisplayItemList::ApproximateOpCount() const { | 182 int DisplayItemList::ApproximateOpCount() const { |
| 182 return approximate_op_count_; | 183 return approximate_op_count_; |
| 183 } | 184 } |
| 184 | 185 |
| 186 DISABLE_CFI_PERF |
| 185 size_t DisplayItemList::ApproximateMemoryUsage() const { | 187 size_t DisplayItemList::ApproximateMemoryUsage() const { |
| 186 size_t memory_usage = sizeof(*this); | 188 size_t memory_usage = sizeof(*this); |
| 187 | 189 |
| 188 size_t external_memory_usage = 0; | 190 size_t external_memory_usage = 0; |
| 189 // Warning: this double-counts SkPicture data if use_cached_picture is | 191 // Warning: this double-counts SkPicture data if use_cached_picture is |
| 190 // also true. | 192 // also true. |
| 191 for (const auto& item : inputs_.items) { | 193 for (const auto& item : inputs_.items) { |
| 192 external_memory_usage += item.ExternalMemoryUsage(); | 194 external_memory_usage += item.ExternalMemoryUsage(); |
| 193 } | 195 } |
| 194 | 196 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } | 265 } |
| 264 | 266 |
| 265 void DisplayItemList::GetDiscardableImagesInRect( | 267 void DisplayItemList::GetDiscardableImagesInRect( |
| 266 const gfx::Rect& rect, | 268 const gfx::Rect& rect, |
| 267 float raster_scale, | 269 float raster_scale, |
| 268 std::vector<DrawImage>* images) { | 270 std::vector<DrawImage>* images) { |
| 269 image_map_.GetDiscardableImagesInRect(rect, raster_scale, images); | 271 image_map_.GetDiscardableImagesInRect(rect, raster_scale, images); |
| 270 } | 272 } |
| 271 | 273 |
| 272 } // namespace cc | 274 } // namespace cc |
| OLD | NEW |