Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: cc/picture_pile_impl.cc

Issue 12191006: Add picture pile raster times histogram (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed HighResNow to Now Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/tile_manager.cc » ('j') | cc/tile_manager.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/debug/trace_event.h" 5 #include "base/debug/trace_event.h"
6 #include "cc/picture_pile_impl.h" 6 #include "cc/picture_pile_impl.h"
7 #include "cc/region.h" 7 #include "cc/region.h"
8 #include "cc/rendering_stats.h" 8 #include "cc/rendering_stats.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkSize.h" 10 #include "third_party/skia/include/core/SkSize.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 void PicturePileImpl::Raster( 60 void PicturePileImpl::Raster(
61 SkCanvas* canvas, 61 SkCanvas* canvas,
62 gfx::Rect content_rect, 62 gfx::Rect content_rect,
63 float contents_scale, 63 float contents_scale,
64 RenderingStats* stats) { 64 RenderingStats* stats) {
65 65
66 DCHECK(contents_scale >= min_contents_scale_); 66 DCHECK(contents_scale >= min_contents_scale_);
67 67
68 base::TimeTicks rasterize_begin_time;
69 if (stats)
70 rasterize_begin_time = base::TimeTicks::Now();
71
72 canvas->save(); 68 canvas->save();
73 canvas->translate(-content_rect.x(), -content_rect.y()); 69 canvas->translate(-content_rect.x(), -content_rect.y());
74 canvas->clipRect(gfx::RectToSkRect(content_rect)); 70 canvas->clipRect(gfx::RectToSkRect(content_rect));
75 71
76 gfx::Rect layer_rect = gfx::ToEnclosingRect( 72 gfx::Rect layer_rect = gfx::ToEnclosingRect(
77 gfx::ScaleRect(content_rect, 1.f / contents_scale)); 73 gfx::ScaleRect(content_rect, 1.f / contents_scale));
78 74
79 Region unclipped(content_rect); 75 Region unclipped(content_rect);
80 for (TilingData::Iterator tile_iter(&tiling_, layer_rect); 76 for (TilingData::Iterator tile_iter(&tiling_, layer_rect);
81 tile_iter; ++tile_iter) { 77 tile_iter; ++tile_iter) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 gfx::RectToSkRect(content_clip), 109 gfx::RectToSkRect(content_clip),
114 SkRegion::kDifference_Op); 110 SkRegion::kDifference_Op);
115 unclipped.Subtract(content_clip); 111 unclipped.Subtract(content_clip);
116 112
117 if (stats) 113 if (stats)
118 stats->totalPixelsRasterized += 114 stats->totalPixelsRasterized +=
119 content_clip.width() * content_clip.height(); 115 content_clip.width() * content_clip.height();
120 } 116 }
121 } 117 }
122 canvas->restore(); 118 canvas->restore();
123
124 if (stats)
125 stats->totalRasterizeTime += base::TimeTicks::Now() - rasterize_begin_time;
126 } 119 }
127 120
128 void PicturePileImpl::GatherPixelRefs( 121 void PicturePileImpl::GatherPixelRefs(
129 gfx::Rect content_rect, 122 gfx::Rect content_rect,
130 float contents_scale, 123 float contents_scale,
131 std::list<skia::LazyPixelRef*>& pixel_refs) { 124 std::list<skia::LazyPixelRef*>& pixel_refs) {
132 std::list<skia::LazyPixelRef*> result; 125 std::list<skia::LazyPixelRef*> result;
133 126
134 gfx::Rect layer_rect = gfx::ToEnclosingRect( 127 gfx::Rect layer_rect = gfx::ToEnclosingRect(
135 gfx::ScaleRect(content_rect, 1.f / contents_scale)); 128 gfx::ScaleRect(content_rect, 1.f / contents_scale));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 SkPicture::kUsePathBoundsForClip_RecordingFlag); 162 SkPicture::kUsePathBoundsForClip_RecordingFlag);
170 163
171 RenderingStats stats; 164 RenderingStats stats;
172 Raster(canvas, layer_rect, 1.0, &stats); 165 Raster(canvas, layer_rect, 1.0, &stats);
173 picture->endRecording(); 166 picture->endRecording();
174 167
175 return picture; 168 return picture;
176 } 169 }
177 170
178 } // namespace cc 171 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/tile_manager.cc » ('j') | cc/tile_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698