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/bitmap_skpicture_content_layer_updater.cc

Issue 13245007: cc: Remove RenderingStats passed to ContentLayerUpdater during Layer::Update() (Closed) Base URL: http://git.chromium.org/chromium/src.git@three
Patch Set: Rebase to 208926 Created 7 years, 5 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
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/bitmap_skpicture_content_layer_updater.h" 5 #include "cc/resources/bitmap_skpicture_content_layer_updater.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "cc/debug/rendering_stats_instrumentation.h" 8 #include "cc/debug/rendering_stats_instrumentation.h"
9 #include "cc/resources/layer_painter.h" 9 #include "cc/resources/layer_painter.h"
10 #include "cc/resources/prioritized_resource.h" 10 #include "cc/resources/prioritized_resource.h"
11 #include "cc/resources/resource_update_queue.h" 11 #include "cc/resources/resource_update_queue.h"
12 #include "third_party/skia/include/core/SkCanvas.h" 12 #include "third_party/skia/include/core/SkCanvas.h"
13 #include "third_party/skia/include/core/SkDevice.h" 13 #include "third_party/skia/include/core/SkDevice.h"
14 14
15 namespace cc { 15 namespace cc {
16 16
17 BitmapSkPictureContentLayerUpdater::Resource::Resource( 17 BitmapSkPictureContentLayerUpdater::Resource::Resource(
18 BitmapSkPictureContentLayerUpdater* updater, 18 BitmapSkPictureContentLayerUpdater* updater,
19 scoped_ptr<PrioritizedResource> texture) 19 scoped_ptr<PrioritizedResource> texture)
20 : ContentLayerUpdater::Resource(texture.Pass()), updater_(updater) {} 20 : ContentLayerUpdater::Resource(texture.Pass()), updater_(updater) {}
21 21
22 void BitmapSkPictureContentLayerUpdater::Resource::Update( 22 void BitmapSkPictureContentLayerUpdater::Resource::Update(
23 ResourceUpdateQueue* queue, 23 ResourceUpdateQueue* queue,
24 gfx::Rect source_rect, 24 gfx::Rect source_rect,
25 gfx::Vector2d dest_offset, 25 gfx::Vector2d dest_offset,
26 bool partial_update, 26 bool partial_update) {
27 RenderingStats* stats) {
28 bitmap_.setConfig( 27 bitmap_.setConfig(
29 SkBitmap::kARGB_8888_Config, source_rect.width(), source_rect.height()); 28 SkBitmap::kARGB_8888_Config, source_rect.width(), source_rect.height());
30 bitmap_.allocPixels(); 29 bitmap_.allocPixels();
31 bitmap_.setIsOpaque(updater_->layer_is_opaque()); 30 bitmap_.setIsOpaque(updater_->layer_is_opaque());
32 SkDevice device(bitmap_); 31 SkDevice device(bitmap_);
33 SkCanvas canvas(&device); 32 SkCanvas canvas(&device);
34 updater_->PaintContentsRect(&canvas, source_rect, stats); 33 updater_->PaintContentsRect(&canvas, source_rect);
35 34
36 ResourceUpdate upload = ResourceUpdate::Create( 35 ResourceUpdate upload = ResourceUpdate::Create(
37 texture(), &bitmap_, source_rect, source_rect, dest_offset); 36 texture(), &bitmap_, source_rect, source_rect, dest_offset);
38 if (partial_update) 37 if (partial_update)
39 queue->AppendPartialUpload(upload); 38 queue->AppendPartialUpload(upload);
40 else 39 else
41 queue->AppendFullUpload(upload); 40 queue->AppendFullUpload(upload);
42 } 41 }
43 42
44 scoped_refptr<BitmapSkPictureContentLayerUpdater> 43 scoped_refptr<BitmapSkPictureContentLayerUpdater>
(...skipping 19 matching lines...) Expand all
64 63
65 scoped_ptr<LayerUpdater::Resource> 64 scoped_ptr<LayerUpdater::Resource>
66 BitmapSkPictureContentLayerUpdater::CreateResource( 65 BitmapSkPictureContentLayerUpdater::CreateResource(
67 PrioritizedResourceManager* manager) { 66 PrioritizedResourceManager* manager) {
68 return scoped_ptr<LayerUpdater::Resource>( 67 return scoped_ptr<LayerUpdater::Resource>(
69 new Resource(this, PrioritizedResource::Create(manager))); 68 new Resource(this, PrioritizedResource::Create(manager)));
70 } 69 }
71 70
72 void BitmapSkPictureContentLayerUpdater::PaintContentsRect( 71 void BitmapSkPictureContentLayerUpdater::PaintContentsRect(
73 SkCanvas* canvas, 72 SkCanvas* canvas,
74 gfx::Rect source_rect, 73 gfx::Rect source_rect) {
75 RenderingStats* stats) {
76 // Translate the origin of content_rect to that of source_rect. 74 // Translate the origin of content_rect to that of source_rect.
77 canvas->translate(content_rect().x() - source_rect.x(), 75 canvas->translate(content_rect().x() - source_rect.x(),
78 content_rect().y() - source_rect.y()); 76 content_rect().y() - source_rect.y());
79 base::TimeTicks start_time = 77 base::TimeTicks start_time =
80 rendering_stats_instrumentation_->StartRecording(); 78 rendering_stats_instrumentation_->StartRecording();
81 DrawPicture(canvas); 79 DrawPicture(canvas);
82 base::TimeDelta duration = 80 base::TimeDelta duration =
83 rendering_stats_instrumentation_->EndRecording(start_time); 81 rendering_stats_instrumentation_->EndRecording(start_time);
84 rendering_stats_instrumentation_->AddRaster( 82 rendering_stats_instrumentation_->AddRaster(
85 duration, 83 duration,
86 duration, 84 duration,
87 source_rect.width() * source_rect.height(), 85 source_rect.width() * source_rect.height(),
88 false); 86 false);
89 } 87 }
90 88
91 } // namespace cc 89 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/bitmap_skpicture_content_layer_updater.h ('k') | cc/resources/caching_bitmap_content_layer_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698