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