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

Side by Side Diff: cc/resources/content_layer_updater.cc

Issue 13265003: cc: Switch ContentLayerUpdater to use RenderingStatsInstrumentation (Closed) Base URL: http://git.chromium.org/chromium/src.git@update
Patch Set: Added printfs Created 7 years, 8 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
« no previous file with comments | « cc/resources/bitmap_skpicture_content_layer_updater.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/resources/content_layer_updater.h" 5 #include "cc/resources/content_layer_updater.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "cc/debug/rendering_stats_instrumentation.h" 9 #include "cc/debug/rendering_stats_instrumentation.h"
10 #include "cc/resources/layer_painter.h" 10 #include "cc/resources/layer_painter.h"
(...skipping 14 matching lines...) Expand all
25 25
26 ContentLayerUpdater::~ContentLayerUpdater() {} 26 ContentLayerUpdater::~ContentLayerUpdater() {}
27 27
28 void ContentLayerUpdater::PaintContents(SkCanvas* canvas, 28 void ContentLayerUpdater::PaintContents(SkCanvas* canvas,
29 gfx::Rect content_rect, 29 gfx::Rect content_rect,
30 float contents_width_scale, 30 float contents_width_scale,
31 float contents_height_scale, 31 float contents_height_scale,
32 gfx::Rect* resulting_opaque_rect, 32 gfx::Rect* resulting_opaque_rect,
33 RenderingStats* stats) { 33 RenderingStats* stats) {
34 TRACE_EVENT0("cc", "ContentLayerUpdater::PaintContents"); 34 TRACE_EVENT0("cc", "ContentLayerUpdater::PaintContents");
35
36 printf("ContentLayerUpdater::PaintContents\n");
37
35 canvas->save(); 38 canvas->save();
36 canvas->translate(SkFloatToScalar(-content_rect.x()), 39 canvas->translate(SkFloatToScalar(-content_rect.x()),
37 SkFloatToScalar(-content_rect.y())); 40 SkFloatToScalar(-content_rect.y()));
38 41
39 gfx::Rect layer_rect = content_rect; 42 gfx::Rect layer_rect = content_rect;
40 43
41 if (contents_width_scale != 1.f || contents_height_scale != 1.f) { 44 if (contents_width_scale != 1.f || contents_height_scale != 1.f) {
42 canvas->scale(SkFloatToScalar(contents_width_scale), 45 canvas->scale(SkFloatToScalar(contents_width_scale),
43 SkFloatToScalar(contents_height_scale)); 46 SkFloatToScalar(contents_height_scale));
44 47
45 gfx::RectF rect = gfx::ScaleRect( 48 gfx::RectF rect = gfx::ScaleRect(
46 content_rect, 1.f / contents_width_scale, 1.f / contents_height_scale); 49 content_rect, 1.f / contents_width_scale, 1.f / contents_height_scale);
47 layer_rect = gfx::ToEnclosingRect(rect); 50 layer_rect = gfx::ToEnclosingRect(rect);
48 } 51 }
49 52
50 SkPaint paint; 53 SkPaint paint;
51 paint.setAntiAlias(false); 54 paint.setAntiAlias(false);
52 paint.setXfermodeMode(SkXfermode::kClear_Mode); 55 paint.setXfermodeMode(SkXfermode::kClear_Mode);
53 SkRect layer_sk_rect = SkRect::MakeXYWH( 56 SkRect layer_sk_rect = SkRect::MakeXYWH(
54 layer_rect.x(), layer_rect.y(), layer_rect.width(), layer_rect.height()); 57 layer_rect.x(), layer_rect.y(), layer_rect.width(), layer_rect.height());
55 canvas->drawRect(layer_sk_rect, paint); 58 canvas->drawRect(layer_sk_rect, paint);
56 canvas->clipRect(layer_sk_rect); 59 canvas->clipRect(layer_sk_rect);
57 60
58 gfx::RectF opaque_layer_rect; 61 gfx::RectF opaque_layer_rect;
59 base::TimeTicks paint_begin_time; 62
60 if (stats) 63 base::TimeTicks start_time =
61 paint_begin_time = base::TimeTicks::Now(); 64 rendering_stats_instrumentation_->StartRecording();
65
62 painter_->Paint(canvas, layer_rect, &opaque_layer_rect); 66 painter_->Paint(canvas, layer_rect, &opaque_layer_rect);
63 if (stats) { 67
64 stats->total_paint_time += base::TimeTicks::Now() - paint_begin_time; 68 base::TimeDelta duration =
65 stats->total_pixels_painted += content_rect.width() * content_rect.height(); 69 rendering_stats_instrumentation_->EndRecording(start_time);
66 } 70 rendering_stats_instrumentation_->AddPaint(
71 duration,
72 content_rect.width() * content_rect.height());
73
67 canvas->restore(); 74 canvas->restore();
68 75
69 gfx::RectF opaque_content_rect = gfx::ScaleRect( 76 gfx::RectF opaque_content_rect = gfx::ScaleRect(
70 opaque_layer_rect, contents_width_scale, contents_height_scale); 77 opaque_layer_rect, contents_width_scale, contents_height_scale);
71 *resulting_opaque_rect = gfx::ToEnclosedRect(opaque_content_rect); 78 *resulting_opaque_rect = gfx::ToEnclosedRect(opaque_content_rect);
72 79
73 content_rect_ = content_rect; 80 content_rect_ = content_rect;
74 } 81 }
75 82
76 } // namespace cc 83 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/bitmap_skpicture_content_layer_updater.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698