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

Side by Side Diff: cc/picture.cc

Issue 11418250: [cc] Track the rendering & painting cost of impl-side painting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years 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 | « cc/layer_tree_host_impl.cc ('k') | cc/picture_layer_impl.cc.orig » ('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 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/content_layer_client.h" 6 #include "cc/content_layer_client.h"
7 #include "cc/picture.h" 7 #include "cc/picture.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 "ui/gfx/rect_conversions.h" 10 #include "ui/gfx/rect_conversions.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 layer_rect.width(), 61 layer_rect.width(),
62 layer_rect.height()); 62 layer_rect.height());
63 canvas->drawRect(layer_skrect, paint); 63 canvas->drawRect(layer_skrect, paint);
64 canvas->clipRect(layer_skrect); 64 canvas->clipRect(layer_skrect);
65 65
66 gfx::RectF opaque_layer_rect; 66 gfx::RectF opaque_layer_rect;
67 base::TimeTicks beginPaintTime = base::TimeTicks::Now(); 67 base::TimeTicks beginPaintTime = base::TimeTicks::Now();
68 painter->paintContents(canvas, layer_rect, opaque_layer_rect); 68 painter->paintContents(canvas, layer_rect, opaque_layer_rect);
69 double delta = (base::TimeTicks::Now() - beginPaintTime).InSecondsF(); 69 double delta = (base::TimeTicks::Now() - beginPaintTime).InSecondsF();
70 stats.totalPaintTimeInSeconds += delta; 70 stats.totalPaintTimeInSeconds += delta;
71 stats.totalPixelsPainted += layer_rect.width() *
72 layer_rect.height();
71 73
72 canvas->restore(); 74 canvas->restore();
73 picture_->endRecording(); 75 picture_->endRecording();
74 76
75 opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect); 77 opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect);
76 layer_rect_ = layer_rect; 78 layer_rect_ = layer_rect;
77 } 79 }
78 80
79 void Picture::Raster(SkCanvas* canvas) { 81 void Picture::Raster(SkCanvas* canvas) {
80 TRACE_EVENT0("cc", "Picture::Raster"); 82 TRACE_EVENT0("cc", "Picture::Raster");
81 DCHECK(picture_.get()); 83 DCHECK(picture_.get());
82 canvas->save(); 84 canvas->save();
83 canvas->translate(layer_rect_.x(), layer_rect_.y()); 85 canvas->translate(layer_rect_.x(), layer_rect_.y());
84 canvas->drawPicture(*picture_); 86 canvas->drawPicture(*picture_);
85 canvas->restore(); 87 canvas->restore();
86 } 88 }
87 89
88 } // namespace cc 90 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/picture_layer_impl.cc.orig » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698