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

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

Issue 12426024: cc: Switch RenderingStats collection in Layer::Update() to RenderingStatsInstrumentation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 190965 Created 7 years, 9 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/skpicture_content_layer_updater.h ('k') | cc/test/fake_content_layer.h » ('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/skpicture_content_layer_updater.h" 5 #include "cc/resources/skpicture_content_layer_updater.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/resources/layer_painter.h" 8 #include "cc/resources/layer_painter.h"
9 #include "cc/resources/prioritized_resource.h" 9 #include "cc/resources/prioritized_resource.h"
10 #include "cc/resources/resource_update_queue.h" 10 #include "cc/resources/resource_update_queue.h"
11 #include "third_party/skia/include/core/SkCanvas.h" 11 #include "third_party/skia/include/core/SkCanvas.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 SkPictureContentLayerUpdater::Resource::Resource( 15 SkPictureContentLayerUpdater::Resource::Resource(
16 SkPictureContentLayerUpdater* updater, 16 SkPictureContentLayerUpdater* updater,
17 scoped_ptr<PrioritizedResource> texture) 17 scoped_ptr<PrioritizedResource> texture)
18 : LayerUpdater::Resource(texture.Pass()), updater_(updater) {} 18 : LayerUpdater::Resource(texture.Pass()), updater_(updater) {}
19 19
20 SkPictureContentLayerUpdater::Resource::~Resource() {} 20 SkPictureContentLayerUpdater::Resource::~Resource() {}
21 21
22 void SkPictureContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, 22 void SkPictureContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue,
23 gfx::Rect source_rect, 23 gfx::Rect source_rect,
24 gfx::Vector2d dest_offset, 24 gfx::Vector2d dest_offset,
25 bool partial_update, 25 bool partial_update) {
26 RenderingStats*) {
27 updater_->UpdateTexture( 26 updater_->UpdateTexture(
28 queue, texture(), source_rect, dest_offset, partial_update); 27 queue, texture(), source_rect, dest_offset, partial_update);
29 } 28 }
30 29
31 SkPictureContentLayerUpdater::SkPictureContentLayerUpdater( 30 SkPictureContentLayerUpdater::SkPictureContentLayerUpdater(
32 scoped_ptr<LayerPainter> painter) 31 scoped_ptr<LayerPainter> painter,
33 : ContentLayerUpdater(painter.Pass()), layer_is_opaque_(false) {} 32 RenderingStatsInstrumentation* stats_instrumentation)
33 : ContentLayerUpdater(painter.Pass(), stats_instrumentation),
34 layer_is_opaque_(false) {}
34 35
35 SkPictureContentLayerUpdater::~SkPictureContentLayerUpdater() {} 36 SkPictureContentLayerUpdater::~SkPictureContentLayerUpdater() {}
36 37
37 scoped_refptr<SkPictureContentLayerUpdater> 38 scoped_refptr<SkPictureContentLayerUpdater>
38 SkPictureContentLayerUpdater::Create(scoped_ptr<LayerPainter> painter) { 39 SkPictureContentLayerUpdater::Create(
39 return make_scoped_refptr(new SkPictureContentLayerUpdater(painter.Pass())); 40 scoped_ptr<LayerPainter> painter,
41 RenderingStatsInstrumentation* stats_instrumentation) {
42 return make_scoped_refptr(
43 new SkPictureContentLayerUpdater(painter.Pass(), stats_instrumentation));
40 } 44 }
41 45
42 scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::CreateResource( 46 scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::CreateResource(
43 PrioritizedResourceManager* manager) { 47 PrioritizedResourceManager* manager) {
44 return scoped_ptr<LayerUpdater::Resource>( 48 return scoped_ptr<LayerUpdater::Resource>(
45 new Resource(this, PrioritizedResource::Create(manager))); 49 new Resource(this, PrioritizedResource::Create(manager)));
46 } 50 }
47 51
48 void SkPictureContentLayerUpdater::PrepareToUpdate( 52 void SkPictureContentLayerUpdater::PrepareToUpdate(
49 gfx::Rect content_rect, 53 gfx::Rect content_rect,
50 gfx::Size, 54 gfx::Size,
51 float contents_width_scale, 55 float contents_width_scale,
52 float contents_height_scale, 56 float contents_height_scale,
53 gfx::Rect* resulting_opaque_rect, 57 gfx::Rect* resulting_opaque_rect) {
54 RenderingStats* stats) {
55 SkCanvas* canvas = 58 SkCanvas* canvas =
56 picture_.beginRecording(content_rect.width(), content_rect.height()); 59 picture_.beginRecording(content_rect.width(), content_rect.height());
57 PaintContents(canvas, 60 PaintContents(canvas,
58 content_rect, 61 content_rect,
59 contents_width_scale, 62 contents_width_scale,
60 contents_height_scale, 63 contents_height_scale,
61 resulting_opaque_rect, 64 resulting_opaque_rect);
62 stats);
63 picture_.endRecording(); 65 picture_.endRecording();
64 } 66 }
65 67
66 void SkPictureContentLayerUpdater::DrawPicture(SkCanvas* canvas) { 68 void SkPictureContentLayerUpdater::DrawPicture(SkCanvas* canvas) {
67 TRACE_EVENT0("cc", "SkPictureContentLayerUpdater::DrawPicture"); 69 TRACE_EVENT0("cc", "SkPictureContentLayerUpdater::DrawPicture");
68 canvas->drawPicture(picture_); 70 canvas->drawPicture(picture_);
69 } 71 }
70 72
71 void SkPictureContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue, 73 void SkPictureContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue,
72 PrioritizedResource* texture, 74 PrioritizedResource* texture,
73 gfx::Rect source_rect, 75 gfx::Rect source_rect,
74 gfx::Vector2d dest_offset, 76 gfx::Vector2d dest_offset,
75 bool partial_update) { 77 bool partial_update) {
76 ResourceUpdate upload = ResourceUpdate::CreateFromPicture( 78 ResourceUpdate upload = ResourceUpdate::CreateFromPicture(
77 texture, &picture_, content_rect(), source_rect, dest_offset); 79 texture, &picture_, content_rect(), source_rect, dest_offset);
78 if (partial_update) 80 if (partial_update)
79 queue->AppendPartialUpload(upload); 81 queue->AppendPartialUpload(upload);
80 else 82 else
81 queue->AppendFullUpload(upload); 83 queue->AppendFullUpload(upload);
82 } 84 }
83 85
84 void SkPictureContentLayerUpdater::SetOpaque(bool opaque) { 86 void SkPictureContentLayerUpdater::SetOpaque(bool opaque) {
85 layer_is_opaque_ = opaque; 87 layer_is_opaque_ = opaque;
86 } 88 }
87 89
88 } // namespace cc 90 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/skpicture_content_layer_updater.h ('k') | cc/test/fake_content_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698