| 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_CONTENT_LAYER_UPDATER_H_ | 5 #ifndef CC_RESOURCES_CONTENT_LAYER_UPDATER_H_ |
| 6 #define CC_RESOURCES_CONTENT_LAYER_UPDATER_H_ | 6 #define CC_RESOURCES_CONTENT_LAYER_UPDATER_H_ |
| 7 | 7 |
| 8 #include "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
| 9 #include "cc/resources/layer_updater.h" | 9 #include "cc/resources/layer_updater.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| 11 | 11 |
| 12 class SkCanvas; | 12 class SkCanvas; |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class LayerPainter; | 16 class LayerPainter; |
| 17 class RenderingStatsInstrumentation; | 17 class RenderingStatsInstrumentation; |
| 18 | 18 |
| 19 // Base class for BitmapContentLayerUpdater and | 19 // Base class for BitmapContentLayerUpdater and |
| 20 // SkPictureContentLayerUpdater that reduces code duplication between | 20 // SkPictureContentLayerUpdater that reduces code duplication between |
| 21 // their respective PaintContents implementations. | 21 // their respective PaintContents implementations. |
| 22 class CC_EXPORT ContentLayerUpdater : public LayerUpdater { | 22 class CC_EXPORT ContentLayerUpdater : public LayerUpdater { |
| 23 public: | 23 public: |
| 24 void set_rendering_stats_instrumentation(RenderingStatsInstrumentation* rsi); | |
| 25 void SetOpaque(bool opaque) override; | 24 void SetOpaque(bool opaque) override; |
| 26 void SetFillsBoundsCompletely(bool fills_bounds) override; | 25 void SetFillsBoundsCompletely(bool fills_bounds) override; |
| 27 void SetBackgroundColor(SkColor background_color) override; | 26 void SetBackgroundColor(SkColor background_color) override; |
| 28 | 27 |
| 29 protected: | 28 protected: |
| 30 ContentLayerUpdater(scoped_ptr<LayerPainter> painter, | 29 ContentLayerUpdater(scoped_ptr<LayerPainter> painter, int layer_id); |
| 31 RenderingStatsInstrumentation* stats_instrumentation, | |
| 32 int layer_id); | |
| 33 ~ContentLayerUpdater() override; | 30 ~ContentLayerUpdater() override; |
| 34 | 31 |
| 35 // Paints the contents. |content_size| size of the underlying layer in | 32 // Paints the contents. |content_size| size of the underlying layer in |
| 36 // layer's content space. |paint_rect| bounds to paint in content space of the | 33 // layer's content space. |paint_rect| bounds to paint in content space of the |
| 37 // layer. Both |content_size| and |paint_rect| are in pixels. | 34 // layer. Both |content_size| and |paint_rect| are in pixels. |
| 38 void PaintContents(SkCanvas* canvas, | 35 void PaintContents(SkCanvas* canvas, |
| 39 const gfx::Size& layer_content_size, | 36 const gfx::Size& layer_content_size, |
| 40 const gfx::Rect& paint_rect, | 37 const gfx::Rect& paint_rect, |
| 41 float contents_width_scale, | 38 float contents_width_scale, |
| 42 float contents_height_scale); | 39 float contents_height_scale); |
| 43 gfx::Rect paint_rect() const { return paint_rect_; } | 40 gfx::Rect paint_rect() const { return paint_rect_; } |
| 44 | 41 |
| 45 bool layer_is_opaque() const { return layer_is_opaque_; } | 42 bool layer_is_opaque() const { return layer_is_opaque_; } |
| 46 bool layer_fills_bounds_completely() const { | 43 bool layer_fills_bounds_completely() const { |
| 47 return layer_fills_bounds_completely_; | 44 return layer_fills_bounds_completely_; |
| 48 } | 45 } |
| 49 | 46 |
| 50 SkColor background_color() const { return background_color_; } | 47 SkColor background_color() const { return background_color_; } |
| 51 | 48 |
| 52 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | |
| 53 int layer_id_; | 49 int layer_id_; |
| 54 | 50 |
| 55 // True when it is known that all output pixels will be opaque. | 51 // True when it is known that all output pixels will be opaque. |
| 56 bool layer_is_opaque_; | 52 bool layer_is_opaque_; |
| 57 // True when it is known that all output pixels will be filled. | 53 // True when it is known that all output pixels will be filled. |
| 58 bool layer_fills_bounds_completely_; | 54 bool layer_fills_bounds_completely_; |
| 59 | 55 |
| 60 private: | 56 private: |
| 61 gfx::Rect paint_rect_; | 57 gfx::Rect paint_rect_; |
| 62 scoped_ptr<LayerPainter> painter_; | 58 scoped_ptr<LayerPainter> painter_; |
| 63 SkColor background_color_; | 59 SkColor background_color_; |
| 64 | 60 |
| 65 DISALLOW_COPY_AND_ASSIGN(ContentLayerUpdater); | 61 DISALLOW_COPY_AND_ASSIGN(ContentLayerUpdater); |
| 66 }; | 62 }; |
| 67 | 63 |
| 68 } // namespace cc | 64 } // namespace cc |
| 69 | 65 |
| 70 #endif // CC_RESOURCES_CONTENT_LAYER_UPDATER_H_ | 66 #endif // CC_RESOURCES_CONTENT_LAYER_UPDATER_H_ |
| OLD | NEW |