OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 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_TILED_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_TILED_LAYER_IMPL_H_ |
6 #define CC_LAYERS_TILED_LAYER_IMPL_H_ | 6 #define CC_LAYERS_TILED_LAYER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
11 #include "cc/layers/layer_impl.h" | 11 #include "cc/layers/layer_impl.h" |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 | 14 |
15 class LayerTilingData; | 15 class LayerTilingData; |
16 class DrawableTile; | 16 class DrawableTile; |
17 | 17 |
18 class CC_EXPORT TiledLayerImpl : public LayerImpl { | 18 class CC_EXPORT TiledLayerImpl : public LayerImpl { |
19 public: | 19 public: |
20 static scoped_ptr<TiledLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 20 static scoped_ptr<TiledLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
21 return make_scoped_ptr(new TiledLayerImpl(tree_impl, 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)); |
22 } | 30 } |
23 ~TiledLayerImpl() override; | 31 ~TiledLayerImpl() override; |
24 | 32 |
25 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 33 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
26 void PushPropertiesTo(LayerImpl* layer) override; | 34 void PushPropertiesTo(LayerImpl* layer) override; |
27 | 35 |
28 bool WillDraw(DrawMode draw_mode, | 36 bool WillDraw(DrawMode draw_mode, |
29 ResourceProvider* resource_provider) override; | 37 ResourceProvider* resource_provider) override; |
30 void AppendQuads(RenderPass* render_pass, | 38 void AppendQuads(RenderPass* render_pass, |
31 const Occlusion& occlusion_in_content_space, | 39 const Occlusion& occlusion_in_content_space, |
(...skipping 12 matching lines...) Expand all Loading... |
44 | 52 |
45 SimpleEnclosedRegion VisibleContentOpaqueRegion() const override; | 53 SimpleEnclosedRegion VisibleContentOpaqueRegion() const override; |
46 void ReleaseResources() override; | 54 void ReleaseResources() override; |
47 | 55 |
48 const LayerTilingData* TilingForTesting() const { return tiler_.get(); } | 56 const LayerTilingData* TilingForTesting() const { return tiler_.get(); } |
49 | 57 |
50 size_t GPUMemoryUsageInBytes() const override; | 58 size_t GPUMemoryUsageInBytes() const override; |
51 | 59 |
52 protected: | 60 protected: |
53 TiledLayerImpl(LayerTreeImpl* tree_impl, int id); | 61 TiledLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 62 TiledLayerImpl( |
| 63 LayerTreeImpl* tree_impl, |
| 64 int id, |
| 65 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset); |
54 // Exposed for testing. | 66 // Exposed for testing. |
55 bool HasTileAt(int i, int j) const; | 67 bool HasTileAt(int i, int j) const; |
56 bool HasResourceIdForTileAt(int i, int j) const; | 68 bool HasResourceIdForTileAt(int i, int j) const; |
57 | 69 |
58 void GetDebugBorderProperties(SkColor* color, float* width) const override; | 70 void GetDebugBorderProperties(SkColor* color, float* width) const override; |
59 void AsValueInto(base::debug::TracedValue* dict) const override; | 71 void AsValueInto(base::debug::TracedValue* dict) const override; |
60 | 72 |
61 private: | 73 private: |
62 const char* LayerTypeAsString() const override; | 74 const char* LayerTypeAsString() const override; |
63 | 75 |
64 DrawableTile* TileAt(int i, int j) const; | 76 DrawableTile* TileAt(int i, int j) const; |
65 DrawableTile* CreateTile(int i, int j); | 77 DrawableTile* CreateTile(int i, int j); |
66 | 78 |
67 bool skips_draw_; | 79 bool skips_draw_; |
68 | 80 |
69 scoped_ptr<LayerTilingData> tiler_; | 81 scoped_ptr<LayerTilingData> tiler_; |
70 | 82 |
71 DISALLOW_COPY_AND_ASSIGN(TiledLayerImpl); | 83 DISALLOW_COPY_AND_ASSIGN(TiledLayerImpl); |
72 }; | 84 }; |
73 | 85 |
74 } // namespace cc | 86 } // namespace cc |
75 | 87 |
76 #endif // CC_LAYERS_TILED_LAYER_IMPL_H_ | 88 #endif // CC_LAYERS_TILED_LAYER_IMPL_H_ |
OLD | NEW |