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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
11 #include "cc/base/math_util.h" | 11 #include "cc/base/math_util.h" |
12 #include "cc/debug/picture_debug_util.h" | 12 #include "cc/debug/picture_debug_util.h" |
13 #include "cc/debug/traced_picture.h" | 13 #include "cc/debug/traced_picture.h" |
14 #include "cc/debug/traced_value.h" | 14 #include "cc/debug/traced_value.h" |
15 #include "cc/playback/largest_display_item.h" | 15 #include "cc/playback/largest_display_item.h" |
16 #include "third_party/skia/include/core/SkCanvas.h" | 16 #include "third_party/skia/include/core/SkCanvas.h" |
17 #include "third_party/skia/include/core/SkDrawPictureCallback.h" | |
18 #include "third_party/skia/include/core/SkPictureRecorder.h" | 17 #include "third_party/skia/include/core/SkPictureRecorder.h" |
19 #include "third_party/skia/include/utils/SkPictureUtils.h" | 18 #include "third_party/skia/include/utils/SkPictureUtils.h" |
20 #include "ui/gfx/skia_util.h" | 19 #include "ui/gfx/skia_util.h" |
21 | 20 |
22 namespace cc { | 21 namespace cc { |
23 | 22 |
24 namespace { | 23 namespace { |
25 | 24 |
26 bool PictureTracingEnabled() { | 25 bool PictureTracingEnabled() { |
27 bool tracing_enabled; | 26 bool tracing_enabled; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 gfx::Rect layer_rect, | 68 gfx::Rect layer_rect, |
70 bool use_cached_picture) { | 69 bool use_cached_picture) { |
71 return make_scoped_refptr( | 70 return make_scoped_refptr( |
72 new DisplayItemList(layer_rect, use_cached_picture)); | 71 new DisplayItemList(layer_rect, use_cached_picture)); |
73 } | 72 } |
74 | 73 |
75 DisplayItemList::~DisplayItemList() { | 74 DisplayItemList::~DisplayItemList() { |
76 } | 75 } |
77 | 76 |
78 void DisplayItemList::Raster(SkCanvas* canvas, | 77 void DisplayItemList::Raster(SkCanvas* canvas, |
79 SkDrawPictureCallback* callback, | 78 SkPicture::AbortCallback* callback, |
80 float contents_scale) const { | 79 float contents_scale) const { |
81 DCHECK(ProcessAppendedItemsCalled()); | 80 DCHECK(ProcessAppendedItemsCalled()); |
82 if (!use_cached_picture_) { | 81 if (!use_cached_picture_) { |
83 canvas->save(); | 82 canvas->save(); |
84 canvas->scale(contents_scale, contents_scale); | 83 canvas->scale(contents_scale, contents_scale); |
85 for (auto* item : items_) | 84 for (auto* item : items_) |
86 item->Raster(canvas, callback); | 85 item->Raster(canvas, callback); |
87 canvas->restore(); | 86 canvas->restore(); |
88 } else { | 87 } else { |
89 DCHECK(picture_); | 88 DCHECK(picture_); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // This should be only called once, and only after CreateAndCacheSkPicture. | 219 // This should be only called once, and only after CreateAndCacheSkPicture. |
221 DCHECK(picture_); | 220 DCHECK(picture_); |
222 DCHECK(!pixel_refs_); | 221 DCHECK(!pixel_refs_); |
223 pixel_refs_ = make_scoped_ptr(new PixelRefMap(grid_cell_size)); | 222 pixel_refs_ = make_scoped_ptr(new PixelRefMap(grid_cell_size)); |
224 if (!picture_->willPlayBackBitmaps()) | 223 if (!picture_->willPlayBackBitmaps()) |
225 return; | 224 return; |
226 | 225 |
227 pixel_refs_->GatherPixelRefsFromPicture(picture_.get()); | 226 pixel_refs_->GatherPixelRefsFromPicture(picture_.get()); |
228 } | 227 } |
229 } // namespace cc | 228 } // namespace cc |
OLD | NEW |