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 #ifndef CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_ | 5 #ifndef CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_ |
6 #define CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_ | 6 #define CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_ |
7 | 7 |
8 #include "cc/resources/content_layer_updater.h" | 8 #include "cc/resources/content_layer_updater.h" |
9 #include "third_party/skia/include/core/SkPicture.h" | 9 #include "third_party/skia/include/core/SkPicture.h" |
10 | 10 |
11 class SkCanvas; | 11 class SkCanvas; |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 | 14 |
15 class LayerPainter; | 15 class LayerPainter; |
16 | 16 |
17 // This class records the content_rect into an SkPicture. Subclasses, provide | 17 // This class records the content_rect into an SkPicture. Subclasses, provide |
18 // different implementations of tile updating based on this recorded picture. | 18 // different implementations of tile updating based on this recorded picture. |
19 // The BitmapSkPictureContentLayerUpdater and | 19 // The BitmapSkPictureContentLayerUpdater and |
20 // FrameBufferSkPictureContentLayerUpdater are two examples of such | 20 // FrameBufferSkPictureContentLayerUpdater are two examples of such |
21 // implementations. | 21 // implementations. |
22 class SkPictureContentLayerUpdater : public ContentLayerUpdater { | 22 class SkPictureContentLayerUpdater : public ContentLayerUpdater { |
23 public: | |
24 virtual void SetOpaque(bool opaque) OVERRIDE; | |
25 | |
26 protected: | 23 protected: |
27 SkPictureContentLayerUpdater( | 24 SkPictureContentLayerUpdater( |
28 scoped_ptr<LayerPainter> painter, | 25 scoped_ptr<LayerPainter> painter, |
29 RenderingStatsInstrumentation* stats_instrumentation, | 26 RenderingStatsInstrumentation* stats_instrumentation, |
30 int layer_id); | 27 int layer_id); |
31 virtual ~SkPictureContentLayerUpdater(); | 28 virtual ~SkPictureContentLayerUpdater(); |
32 | 29 |
33 virtual void PrepareToUpdate(gfx::Rect content_rect, | 30 virtual void PrepareToUpdate(gfx::Rect content_rect, |
34 gfx::Size tile_size, | 31 gfx::Size tile_size, |
35 float contents_width_scale, | 32 float contents_width_scale, |
36 float contents_height_scale, | 33 float contents_height_scale, |
37 gfx::Rect* resulting_opaque_rect) OVERRIDE; | 34 gfx::Rect* resulting_opaque_rect) OVERRIDE; |
38 void DrawPicture(SkCanvas* canvas); | 35 void DrawPicture(SkCanvas* canvas); |
39 | 36 |
40 bool layer_is_opaque() const { return layer_is_opaque_; } | |
41 | |
42 private: | 37 private: |
43 // Recording canvas. | 38 // Recording canvas. |
44 SkPicture picture_; | 39 SkPicture picture_; |
45 // True when it is known that all output pixels will be opaque. | |
46 bool layer_is_opaque_; | |
47 | 40 |
48 DISALLOW_COPY_AND_ASSIGN(SkPictureContentLayerUpdater); | 41 DISALLOW_COPY_AND_ASSIGN(SkPictureContentLayerUpdater); |
49 }; | 42 }; |
50 | 43 |
51 } // namespace cc | 44 } // namespace cc |
52 | 45 |
53 #endif // CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_ | 46 #endif // CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_ |
OLD | NEW |