| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_LAYERS_CONTENT_LAYER_H_ | 5 #ifndef CC_LAYERS_CONTENT_LAYER_H_ |
| 6 #define CC_LAYERS_CONTENT_LAYER_H_ | 6 #define CC_LAYERS_CONTENT_LAYER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
| 10 #include "cc/layers/tiled_layer.h" | 10 #include "cc/layers/tiled_layer.h" |
| 11 #include "cc/resources/layer_painter.h" | 11 #include "cc/resources/layer_painter.h" |
| 12 | 12 |
| 13 class SkCanvas; | 13 class SkCanvas; |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 | 16 |
| 17 class ContentLayerClient; | 17 class ContentLayerClient; |
| 18 class ContentLayerUpdater; | 18 class ContentLayerUpdater; |
| 19 | 19 |
| 20 class CC_EXPORT ContentLayerPainter : public LayerPainter { | 20 class CC_EXPORT ContentLayerPainter : public LayerPainter { |
| 21 public: | 21 public: |
| 22 static scoped_ptr<ContentLayerPainter> Create(ContentLayerClient* client); | 22 static scoped_ptr<ContentLayerPainter> Create(ContentLayerClient* client); |
| 23 | 23 |
| 24 virtual void Paint(SkCanvas* canvas, const gfx::Rect& content_rect) override; | 24 void Paint(SkCanvas* canvas, const gfx::Rect& content_rect) override; |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 explicit ContentLayerPainter(ContentLayerClient* client); | 27 explicit ContentLayerPainter(ContentLayerClient* client); |
| 28 | 28 |
| 29 ContentLayerClient* client_; | 29 ContentLayerClient* client_; |
| 30 | 30 |
| 31 DISALLOW_COPY_AND_ASSIGN(ContentLayerPainter); | 31 DISALLOW_COPY_AND_ASSIGN(ContentLayerPainter); |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // A layer that renders its contents into an SkCanvas. | 34 // A layer that renders its contents into an SkCanvas. |
| 35 class CC_EXPORT ContentLayer : public TiledLayer { | 35 class CC_EXPORT ContentLayer : public TiledLayer { |
| 36 public: | 36 public: |
| 37 static scoped_refptr<ContentLayer> Create(ContentLayerClient* client); | 37 static scoped_refptr<ContentLayer> Create(ContentLayerClient* client); |
| 38 | 38 |
| 39 void ClearClient(); | 39 void ClearClient(); |
| 40 | 40 |
| 41 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) override; | 41 void SetLayerTreeHost(LayerTreeHost* layer_tree_host) override; |
| 42 virtual void SetTexturePriorities(const PriorityCalculator& priority_calc) | 42 void SetTexturePriorities(const PriorityCalculator& priority_calc) override; |
| 43 override; | 43 bool Update(ResourceUpdateQueue* queue, |
| 44 virtual bool Update(ResourceUpdateQueue* queue, | 44 const OcclusionTracker<Layer>* occlusion) override; |
| 45 const OcclusionTracker<Layer>* occlusion) override; | 45 bool NeedMoreUpdates() override; |
| 46 virtual bool NeedMoreUpdates() override; | |
| 47 | 46 |
| 48 virtual void SetContentsOpaque(bool contents_opaque) override; | 47 void SetContentsOpaque(bool contents_opaque) override; |
| 49 | 48 |
| 50 virtual bool SupportsLCDText() const override; | 49 bool SupportsLCDText() const override; |
| 51 | 50 |
| 52 virtual skia::RefPtr<SkPicture> GetPicture() const override; | 51 skia::RefPtr<SkPicture> GetPicture() const override; |
| 53 | 52 |
| 54 virtual void OnOutputSurfaceCreated() override; | 53 void OnOutputSurfaceCreated() override; |
| 55 | 54 |
| 56 protected: | 55 protected: |
| 57 explicit ContentLayer(ContentLayerClient* client); | 56 explicit ContentLayer(ContentLayerClient* client); |
| 58 virtual ~ContentLayer(); | 57 ~ContentLayer() override; |
| 59 | 58 |
| 60 virtual bool HasDrawableContent() const override; | 59 bool HasDrawableContent() const override; |
| 61 | 60 |
| 62 // TiledLayer implementation. | 61 // TiledLayer implementation. |
| 63 virtual LayerUpdater* Updater() const override; | 62 LayerUpdater* Updater() const override; |
| 64 | 63 |
| 65 private: | 64 private: |
| 66 // TiledLayer implementation. | 65 // TiledLayer implementation. |
| 67 virtual void CreateUpdaterIfNeeded() override; | 66 void CreateUpdaterIfNeeded() override; |
| 68 | 67 |
| 69 void UpdateCanUseLCDText(); | 68 void UpdateCanUseLCDText(); |
| 70 | 69 |
| 71 ContentLayerClient* client_; | 70 ContentLayerClient* client_; |
| 72 scoped_refptr<ContentLayerUpdater> updater_; | 71 scoped_refptr<ContentLayerUpdater> updater_; |
| 73 bool can_use_lcd_text_last_frame_; | 72 bool can_use_lcd_text_last_frame_; |
| 74 | 73 |
| 75 DISALLOW_COPY_AND_ASSIGN(ContentLayer); | 74 DISALLOW_COPY_AND_ASSIGN(ContentLayer); |
| 76 }; | 75 }; |
| 77 | 76 |
| 78 } // namespace cc | 77 } // namespace cc |
| 79 #endif // CC_LAYERS_CONTENT_LAYER_H_ | 78 #endif // CC_LAYERS_CONTENT_LAYER_H_ |
| OLD | NEW |