OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_LAYERS_TILED_LAYER_IMPL_H_ | |
6 #define CC_LAYERS_TILED_LAYER_IMPL_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "cc/base/cc_export.h" | |
11 #include "cc/layers/layer_impl.h" | |
12 | |
13 namespace cc { | |
14 | |
15 class LayerTilingData; | |
16 class DrawableTile; | |
17 | |
18 class CC_EXPORT TiledLayerImpl : public LayerImpl { | |
19 public: | |
20 static scoped_ptr<TiledLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | |
21 return make_scoped_ptr( | |
22 new TiledLayerImpl(tree_impl, id, new LayerImpl::SyncedScrollOffset)); | |
23 } | |
24 static scoped_ptr<TiledLayerImpl> Create( | |
25 LayerTreeImpl* tree_impl, | |
26 int id, | |
27 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset) { | |
28 return make_scoped_ptr( | |
29 new TiledLayerImpl(tree_impl, id, synced_scroll_offset)); | |
30 } | |
31 ~TiledLayerImpl() override; | |
32 | |
33 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | |
34 void PushPropertiesTo(LayerImpl* layer) override; | |
35 | |
36 bool WillDraw(DrawMode draw_mode, | |
37 ResourceProvider* resource_provider) override; | |
38 void AppendQuads(RenderPass* render_pass, | |
39 AppendQuadsData* append_quads_data) override; | |
40 | |
41 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, | |
42 gfx::Size* resource_size) const override; | |
43 | |
44 void set_skips_draw(bool skips_draw) { skips_draw_ = skips_draw; } | |
45 void SetTilingData(const LayerTilingData& tiler); | |
46 void PushTileProperties(int i, | |
47 int j, | |
48 ResourceProvider::ResourceId resource, | |
49 bool contents_swizzled); | |
50 void PushInvalidTile(int i, int j); | |
51 | |
52 SimpleEnclosedRegion VisibleContentOpaqueRegion() const override; | |
53 void ReleaseResources() override; | |
54 | |
55 const LayerTilingData* TilingForTesting() const { return tiler_.get(); } | |
56 | |
57 size_t GPUMemoryUsageInBytes() const override; | |
58 | |
59 protected: | |
60 TiledLayerImpl(LayerTreeImpl* tree_impl, int id); | |
61 TiledLayerImpl( | |
62 LayerTreeImpl* tree_impl, | |
63 int id, | |
64 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset); | |
65 // Exposed for testing. | |
66 bool HasTileAt(int i, int j) const; | |
67 bool HasResourceIdForTileAt(int i, int j) const; | |
68 | |
69 void GetDebugBorderProperties(SkColor* color, float* width) const override; | |
70 void AsValueInto(base::trace_event::TracedValue* dict) const override; | |
71 | |
72 private: | |
73 const char* LayerTypeAsString() const override; | |
74 | |
75 DrawableTile* TileAt(int i, int j) const; | |
76 DrawableTile* CreateTile(int i, int j); | |
77 | |
78 bool skips_draw_; | |
79 | |
80 scoped_ptr<LayerTilingData> tiler_; | |
81 | |
82 DISALLOW_COPY_AND_ASSIGN(TiledLayerImpl); | |
83 }; | |
84 | |
85 } // namespace cc | |
86 | |
87 #endif // CC_LAYERS_TILED_LAYER_IMPL_H_ | |
OLD | NEW |