OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <algorithm> | 5 #include <algorithm> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "cc/base/region.h" | 9 #include "cc/base/region.h" |
10 #include "cc/debug/debug_colors.h" | 10 #include "cc/debug/debug_colors.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 PicturePileImpl::~PicturePileImpl() { | 38 PicturePileImpl::~PicturePileImpl() { |
39 } | 39 } |
40 | 40 |
41 void PicturePileImpl::RasterDirect( | 41 void PicturePileImpl::RasterDirect( |
42 SkCanvas* canvas, | 42 SkCanvas* canvas, |
43 const gfx::Rect& canvas_rect, | 43 const gfx::Rect& canvas_rect, |
44 float contents_scale, | 44 float contents_scale, |
45 RenderingStatsInstrumentation* rendering_stats_instrumentation) { | 45 RenderingStatsInstrumentation* rendering_stats_instrumentation) { |
46 RasterCommon(canvas, | 46 RasterCommon(canvas, |
47 NULL, | 47 nullptr, |
48 canvas_rect, | 48 canvas_rect, |
49 contents_scale, | 49 contents_scale, |
50 rendering_stats_instrumentation, | 50 rendering_stats_instrumentation, |
51 false); | 51 false); |
52 } | 52 } |
53 | 53 |
54 void PicturePileImpl::RasterForAnalysis( | 54 void PicturePileImpl::RasterForAnalysis( |
55 skia::AnalysisCanvas* canvas, | 55 skia::AnalysisCanvas* canvas, |
56 const gfx::Rect& canvas_rect, | 56 const gfx::Rect& canvas_rect, |
57 float contents_scale, | 57 float contents_scale, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 canvas->restore(); | 116 canvas->restore(); |
117 } | 117 } |
118 } else { | 118 } else { |
119 TRACE_EVENT_INSTANT0("cc", "SkCanvas::clear", TRACE_EVENT_SCOPE_THREAD); | 119 TRACE_EVENT_INSTANT0("cc", "SkCanvas::clear", TRACE_EVENT_SCOPE_THREAD); |
120 // Clearing is about ~4x faster than drawing a rect even if the content | 120 // Clearing is about ~4x faster than drawing a rect even if the content |
121 // isn't covering a majority of the canvas. | 121 // isn't covering a majority of the canvas. |
122 canvas->clear(SK_ColorTRANSPARENT); | 122 canvas->clear(SK_ColorTRANSPARENT); |
123 } | 123 } |
124 | 124 |
125 RasterCommon(canvas, | 125 RasterCommon(canvas, |
126 NULL, | 126 nullptr, |
127 canvas_rect, | 127 canvas_rect, |
128 contents_scale, | 128 contents_scale, |
129 rendering_stats_instrumentation, | 129 rendering_stats_instrumentation, |
130 false); | 130 false); |
131 } | 131 } |
132 | 132 |
133 void PicturePileImpl::CoalesceRasters(const gfx::Rect& canvas_rect, | 133 void PicturePileImpl::CoalesceRasters(const gfx::Rect& canvas_rect, |
134 const gfx::Rect& content_rect, | 134 const gfx::Rect& content_rect, |
135 float contents_scale, | 135 float contents_scale, |
136 PictureRegionMap* results) const { | 136 PictureRegionMap* results) const { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 310 } |
311 | 311 |
312 skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { | 312 skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { |
313 TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); | 313 TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); |
314 | 314 |
315 gfx::Rect tiling_rect(tiling_.tiling_size()); | 315 gfx::Rect tiling_rect(tiling_.tiling_size()); |
316 SkPictureRecorder recorder; | 316 SkPictureRecorder recorder; |
317 SkCanvas* canvas = | 317 SkCanvas* canvas = |
318 recorder.beginRecording(tiling_rect.width(), tiling_rect.height()); | 318 recorder.beginRecording(tiling_rect.width(), tiling_rect.height()); |
319 if (!tiling_rect.IsEmpty()) | 319 if (!tiling_rect.IsEmpty()) |
320 RasterToBitmap(canvas, tiling_rect, 1.0, NULL); | 320 RasterToBitmap(canvas, tiling_rect, 1.0, nullptr); |
321 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); | 321 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); |
322 | 322 |
323 return picture; | 323 return picture; |
324 } | 324 } |
325 | 325 |
326 void PicturePileImpl::AnalyzeInRect(const gfx::Rect& content_rect, | 326 void PicturePileImpl::AnalyzeInRect(const gfx::Rect& content_rect, |
327 float contents_scale, | 327 float contents_scale, |
328 PicturePileImpl::Analysis* analysis) const { | 328 PicturePileImpl::Analysis* analysis) const { |
329 AnalyzeInRect(content_rect, contents_scale, analysis, NULL); | 329 AnalyzeInRect(content_rect, contents_scale, analysis, nullptr); |
330 } | 330 } |
331 | 331 |
332 void PicturePileImpl::AnalyzeInRect( | 332 void PicturePileImpl::AnalyzeInRect( |
333 const gfx::Rect& content_rect, | 333 const gfx::Rect& content_rect, |
334 float contents_scale, | 334 float contents_scale, |
335 PicturePileImpl::Analysis* analysis, | 335 PicturePileImpl::Analysis* analysis, |
336 RenderingStatsInstrumentation* stats_instrumentation) const { | 336 RenderingStatsInstrumentation* stats_instrumentation) const { |
337 DCHECK(analysis); | 337 DCHECK(analysis); |
338 TRACE_EVENT0("cc", "PicturePileImpl::AnalyzeInRect"); | 338 TRACE_EVENT0("cc", "PicturePileImpl::AnalyzeInRect"); |
339 | 339 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 ++it) { | 416 ++it) { |
417 const Picture* picture = it->second.GetPicture(); | 417 const Picture* picture = it->second.GetPicture(); |
418 if (picture && (processed_pictures.count(picture) == 0)) { | 418 if (picture && (processed_pictures.count(picture) == 0)) { |
419 picture->EmitTraceSnapshot(); | 419 picture->EmitTraceSnapshot(); |
420 processed_pictures.insert(picture); | 420 processed_pictures.insert(picture); |
421 } | 421 } |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 } // namespace cc | 425 } // namespace cc |
OLD | NEW |