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_CONTENT_LAYER_H_ | |
6 #define CC_CONTENT_LAYER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "cc/base/cc_export.h" | |
10 #include "cc/resources/layer_painter.h" | |
11 #include "cc/tiled_layer.h" | |
12 | |
13 class SkCanvas; | |
14 | |
15 namespace cc { | |
16 | |
17 class ContentLayerClient; | |
18 class LayerUpdater; | |
19 | |
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 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. | |
37 class CC_EXPORT ContentLayer : public TiledLayer { | |
38 public: | |
39 static scoped_refptr<ContentLayer> Create(ContentLayerClient* client); | |
40 | |
41 void ClearClient() { client_ = NULL; } | |
42 | |
43 virtual bool DrawsContent() const OVERRIDE; | |
44 virtual void SetTexturePriorities(const PriorityCalculator& priority_calc) | |
45 OVERRIDE; | |
46 virtual void Update(ResourceUpdateQueue* queue, | |
47 const OcclusionTracker* occlusion, | |
48 RenderingStats* stats) OVERRIDE; | |
49 virtual bool NeedMoreUpdates() OVERRIDE; | |
50 | |
51 virtual void SetContentsOpaque(bool contents_opaque) OVERRIDE; | |
52 | |
53 protected: | |
54 explicit ContentLayer(ContentLayerClient* client); | |
55 virtual ~ContentLayer(); | |
56 | |
57 private: | |
58 // TiledLayer implementation. | |
59 virtual LayerUpdater* Updater() const OVERRIDE; | |
60 virtual void CreateUpdaterIfNeeded() OVERRIDE; | |
61 | |
62 ContentLayerClient* client_; | |
63 scoped_refptr<LayerUpdater> updater_; | |
64 | |
65 DISALLOW_COPY_AND_ASSIGN(ContentLayer); | |
66 }; | |
67 | |
68 } | |
69 #endif // CC_CONTENT_LAYER_H_ | |
OLD | NEW |