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" | |
12 | |
13 class SkCanvas; | |
14 | 11 |
15 namespace cc { | 12 namespace cc { |
16 | 13 |
17 class ContentLayerClient; | 14 class ContentLayerClient; |
18 class ContentLayerUpdater; | 15 class ContentLayerUpdater; |
19 | 16 |
20 class CC_EXPORT ContentLayerPainter : public LayerPainter { | |
21 public: | |
22 static scoped_ptr<ContentLayerPainter> Create(ContentLayerClient* client); | |
23 | |
24 virtual void Paint(SkCanvas* canvas, | |
25 const gfx::Rect& content_rect, | |
26 gfx::RectF* opaque) OVERRIDE; | |
27 | |
28 private: | |
29 explicit ContentLayerPainter(ContentLayerClient* client); | |
30 | |
31 ContentLayerClient* client_; | |
32 | |
33 DISALLOW_COPY_AND_ASSIGN(ContentLayerPainter); | |
34 }; | |
35 | |
36 // A layer that renders its contents into an SkCanvas. | 17 // A layer that renders its contents into an SkCanvas. |
37 class CC_EXPORT ContentLayer : public TiledLayer { | 18 class CC_EXPORT ContentLayer : public TiledLayer { |
38 public: | 19 public: |
39 static scoped_refptr<ContentLayer> Create(ContentLayerClient* client); | 20 static scoped_refptr<ContentLayer> Create(ContentLayerClient* client); |
40 | 21 |
41 void ClearClient() { client_ = NULL; } | 22 void ClearClient() { client_ = NULL; } |
42 | 23 |
43 virtual bool DrawsContent() const OVERRIDE; | 24 virtual bool DrawsContent() const OVERRIDE; |
44 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE; | 25 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE; |
45 virtual void SetTexturePriorities(const PriorityCalculator& priority_calc) | 26 virtual void SetTexturePriorities(const PriorityCalculator& priority_calc) |
(...skipping 14 matching lines...) Expand all Loading... |
60 explicit ContentLayer(ContentLayerClient* client); | 41 explicit ContentLayer(ContentLayerClient* client); |
61 virtual ~ContentLayer(); | 42 virtual ~ContentLayer(); |
62 | 43 |
63 // TiledLayer implementation. | 44 // TiledLayer implementation. |
64 virtual LayerUpdater* Updater() const OVERRIDE; | 45 virtual LayerUpdater* Updater() const OVERRIDE; |
65 | 46 |
66 private: | 47 private: |
67 // TiledLayer implementation. | 48 // TiledLayer implementation. |
68 virtual void CreateUpdaterIfNeeded() OVERRIDE; | 49 virtual void CreateUpdaterIfNeeded() OVERRIDE; |
69 | 50 |
70 void UpdateCanUseLCDText(); | 51 void UpdateUseLCDText(); |
71 | 52 |
72 ContentLayerClient* client_; | 53 ContentLayerClient* client_; |
73 scoped_refptr<ContentLayerUpdater> updater_; | 54 scoped_refptr<ContentLayerUpdater> updater_; |
74 bool can_use_lcd_text_last_frame_; | 55 bool use_lcd_text_; |
75 | 56 |
76 DISALLOW_COPY_AND_ASSIGN(ContentLayer); | 57 DISALLOW_COPY_AND_ASSIGN(ContentLayer); |
77 }; | 58 }; |
78 | 59 |
79 } // namespace cc | 60 } // namespace cc |
80 #endif // CC_LAYERS_CONTENT_LAYER_H_ | 61 #endif // CC_LAYERS_CONTENT_LAYER_H_ |
OLD | NEW |