| 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/rect.h" | 10 #include "ui/gfx/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 ContentLayerPainter; |
| 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); | 24 void set_rendering_stats_instrumentation(RenderingStatsInstrumentation* rsi); |
| 25 virtual void SetOpaque(bool opaque) OVERRIDE; | 25 virtual void SetOpaque(bool opaque) OVERRIDE; |
| 26 virtual void SetFillsBoundsCompletely(bool fills_bounds) OVERRIDE; | 26 virtual void SetFillsBoundsCompletely(bool fills_bounds) OVERRIDE; |
| 27 void set_can_use_lcd_text(bool can_use) { can_use_lcd_text_ = can_use; } |
| 27 | 28 |
| 28 protected: | 29 protected: |
| 29 ContentLayerUpdater(scoped_ptr<LayerPainter> painter, | 30 ContentLayerUpdater(scoped_ptr<ContentLayerPainter> painter, |
| 30 RenderingStatsInstrumentation* stats_instrumentation, | 31 RenderingStatsInstrumentation* stats_instrumentation, |
| 31 int layer_id); | 32 int layer_id); |
| 32 virtual ~ContentLayerUpdater(); | 33 virtual ~ContentLayerUpdater(); |
| 33 | 34 |
| 34 void PaintContents(SkCanvas* canvas, | 35 void PaintContents(SkCanvas* canvas, |
| 35 const gfx::Rect& content_rect, | 36 const gfx::Rect& content_rect, |
| 36 float contents_width_scale, | 37 float contents_width_scale, |
| 37 float contents_height_scale, | 38 float contents_height_scale, |
| 38 gfx::Rect* resulting_opaque_rect); | 39 gfx::Rect* resulting_opaque_rect); |
| 39 gfx::Rect content_rect() const { return content_rect_; } | 40 gfx::Rect content_rect() const { return content_rect_; } |
| 40 | 41 |
| 41 bool layer_is_opaque() const { return layer_is_opaque_; } | 42 bool layer_is_opaque() const { return layer_is_opaque_; } |
| 42 bool layer_fills_bounds_completely() const { | 43 bool layer_fills_bounds_completely() const { |
| 43 return layer_fills_bounds_completely_; | 44 return layer_fills_bounds_completely_; |
| 44 } | 45 } |
| 45 | 46 |
| 46 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 47 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
| 47 int layer_id_; | 48 int layer_id_; |
| 48 | 49 |
| 49 // True when it is known that all output pixels will be opaque. | 50 // True when it is known that all output pixels will be opaque. |
| 50 bool layer_is_opaque_; | 51 bool layer_is_opaque_; |
| 51 // True when it is known that all output pixels will be filled. | 52 // True when it is known that all output pixels will be filled. |
| 52 bool layer_fills_bounds_completely_; | 53 bool layer_fills_bounds_completely_; |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 gfx::Rect content_rect_; | 56 gfx::Rect content_rect_; |
| 56 scoped_ptr<LayerPainter> painter_; | 57 scoped_ptr<ContentLayerPainter> painter_; |
| 58 bool can_use_lcd_text_; |
| 57 | 59 |
| 58 DISALLOW_COPY_AND_ASSIGN(ContentLayerUpdater); | 60 DISALLOW_COPY_AND_ASSIGN(ContentLayerUpdater); |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 } // namespace cc | 63 } // namespace cc |
| 62 | 64 |
| 63 #endif // CC_RESOURCES_CONTENT_LAYER_UPDATER_H_ | 65 #endif // CC_RESOURCES_CONTENT_LAYER_UPDATER_H_ |
| OLD | NEW |