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/time.h" | 7 #include "base/time/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" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return make_scoped_refptr( | 46 return make_scoped_refptr( |
47 new BitmapSkPictureContentLayerUpdater(painter.Pass(), | 47 new BitmapSkPictureContentLayerUpdater(painter.Pass(), |
48 stats_instrumentation, | 48 stats_instrumentation, |
49 layer_id)); | 49 layer_id)); |
50 } | 50 } |
51 | 51 |
52 BitmapSkPictureContentLayerUpdater::BitmapSkPictureContentLayerUpdater( | 52 BitmapSkPictureContentLayerUpdater::BitmapSkPictureContentLayerUpdater( |
53 scoped_ptr<LayerPainter> painter, | 53 scoped_ptr<LayerPainter> painter, |
54 RenderingStatsInstrumentation* stats_instrumentation, | 54 RenderingStatsInstrumentation* stats_instrumentation, |
55 int layer_id) | 55 int layer_id) |
56 : SkPictureContentLayerUpdater(painter.Pass(), | 56 : SkPictureContentLayerUpdater(painter.Pass(), layer_id) { |
57 stats_instrumentation, | 57 } |
58 layer_id) {} | |
59 | 58 |
60 BitmapSkPictureContentLayerUpdater::~BitmapSkPictureContentLayerUpdater() {} | 59 BitmapSkPictureContentLayerUpdater::~BitmapSkPictureContentLayerUpdater() {} |
61 | 60 |
62 scoped_ptr<LayerUpdater::Resource> | 61 scoped_ptr<LayerUpdater::Resource> |
63 BitmapSkPictureContentLayerUpdater::CreateResource( | 62 BitmapSkPictureContentLayerUpdater::CreateResource( |
64 PrioritizedResourceManager* manager) { | 63 PrioritizedResourceManager* manager) { |
65 return make_scoped_ptr( | 64 return make_scoped_ptr( |
66 new Resource(this, PrioritizedResource::Create(manager))); | 65 new Resource(this, PrioritizedResource::Create(manager))); |
67 } | 66 } |
68 | 67 |
69 void BitmapSkPictureContentLayerUpdater::PaintContentsRect( | 68 void BitmapSkPictureContentLayerUpdater::PaintContentsRect( |
70 SkCanvas* canvas, | 69 SkCanvas* canvas, |
71 const gfx::Rect& source_rect) { | 70 const gfx::Rect& source_rect) { |
72 if (!canvas) | 71 if (!canvas) |
73 return; | 72 return; |
74 // Translate the origin of content_rect to that of source_rect. | 73 // Translate the origin of content_rect to that of source_rect. |
75 canvas->translate(paint_rect().x() - source_rect.x(), | 74 canvas->translate(paint_rect().x() - source_rect.x(), |
76 paint_rect().y() - source_rect.y()); | 75 paint_rect().y() - source_rect.y()); |
77 DrawPicture(canvas); | 76 DrawPicture(canvas); |
78 } | 77 } |
79 | 78 |
80 } // namespace cc | 79 } // namespace cc |
OLD | NEW |