OLD | NEW |
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.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, |
(...skipping 21 matching lines...) Expand all Loading... |
40 | 40 |
41 ResourceUpdate upload = ResourceUpdate::Create( | 41 ResourceUpdate upload = ResourceUpdate::Create( |
42 texture(), &bitmap_, source_rect, source_rect, dest_offset); | 42 texture(), &bitmap_, source_rect, source_rect, dest_offset); |
43 if (partial_update) | 43 if (partial_update) |
44 queue->AppendPartialUpload(upload); | 44 queue->AppendPartialUpload(upload); |
45 else | 45 else |
46 queue->AppendFullUpload(upload); | 46 queue->AppendFullUpload(upload); |
47 } | 47 } |
48 | 48 |
49 scoped_refptr<BitmapSkPictureContentLayerUpdater> | 49 scoped_refptr<BitmapSkPictureContentLayerUpdater> |
50 BitmapSkPictureContentLayerUpdater::Create(scoped_ptr<LayerPainter> painter) { | 50 BitmapSkPictureContentLayerUpdater::Create( |
| 51 scoped_ptr<LayerPainter> painter, |
| 52 RenderingStatsInstrumentation* stats_instrumentation) { |
51 return make_scoped_refptr( | 53 return make_scoped_refptr( |
52 new BitmapSkPictureContentLayerUpdater(painter.Pass())); | 54 new BitmapSkPictureContentLayerUpdater(painter.Pass(), |
| 55 stats_instrumentation)); |
53 } | 56 } |
54 | 57 |
55 BitmapSkPictureContentLayerUpdater::BitmapSkPictureContentLayerUpdater( | 58 BitmapSkPictureContentLayerUpdater::BitmapSkPictureContentLayerUpdater( |
56 scoped_ptr<LayerPainter> painter) | 59 scoped_ptr<LayerPainter> painter, |
57 : SkPictureContentLayerUpdater(painter.Pass()) {} | 60 RenderingStatsInstrumentation* stats_instrumentation) |
| 61 : SkPictureContentLayerUpdater(painter.Pass(), stats_instrumentation) {} |
58 | 62 |
59 BitmapSkPictureContentLayerUpdater::~BitmapSkPictureContentLayerUpdater() {} | 63 BitmapSkPictureContentLayerUpdater::~BitmapSkPictureContentLayerUpdater() {} |
60 | 64 |
61 scoped_ptr<LayerUpdater::Resource> | 65 scoped_ptr<LayerUpdater::Resource> |
62 BitmapSkPictureContentLayerUpdater::CreateResource( | 66 BitmapSkPictureContentLayerUpdater::CreateResource( |
63 PrioritizedResourceManager* manager) { | 67 PrioritizedResourceManager* manager) { |
64 return scoped_ptr<LayerUpdater::Resource>( | 68 return scoped_ptr<LayerUpdater::Resource>( |
65 new Resource(this, PrioritizedResource::Create(manager))); | 69 new Resource(this, PrioritizedResource::Create(manager))); |
66 } | 70 } |
67 | 71 |
(...skipping 10 matching lines...) Expand all Loading... |
78 DrawPicture(canvas); | 82 DrawPicture(canvas); |
79 if (stats) { | 83 if (stats) { |
80 stats->total_rasterize_time += | 84 stats->total_rasterize_time += |
81 base::TimeTicks::Now() - rasterize_begin_time; | 85 base::TimeTicks::Now() - rasterize_begin_time; |
82 stats->total_pixels_rasterized += | 86 stats->total_pixels_rasterized += |
83 source_rect.width() * source_rect.height(); | 87 source_rect.width() * source_rect.height(); |
84 } | 88 } |
85 } | 89 } |
86 | 90 |
87 } // namespace cc | 91 } // namespace cc |
OLD | NEW |