| 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(new TiledLayerImpl(tree_impl, id)); |
| 22 } | 22 } |
| 23 virtual ~TiledLayerImpl(); | 23 ~TiledLayerImpl() override; |
| 24 | 24 |
| 25 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 25 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 26 override; | 26 void PushPropertiesTo(LayerImpl* layer) override; |
| 27 virtual void PushPropertiesTo(LayerImpl* layer) override; | |
| 28 | 27 |
| 29 virtual bool WillDraw(DrawMode draw_mode, | 28 bool WillDraw(DrawMode draw_mode, |
| 30 ResourceProvider* resource_provider) override; | 29 ResourceProvider* resource_provider) override; |
| 31 virtual void AppendQuads(RenderPass* render_pass, | 30 void AppendQuads(RenderPass* render_pass, |
| 32 const Occlusion& occlusion_in_content_space, | 31 const Occlusion& occlusion_in_content_space, |
| 33 AppendQuadsData* append_quads_data) override; | 32 AppendQuadsData* append_quads_data) override; |
| 34 | 33 |
| 35 virtual void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, | 34 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, |
| 36 gfx::Size* resource_size) const override; | 35 gfx::Size* resource_size) const override; |
| 37 | 36 |
| 38 void set_skips_draw(bool skips_draw) { skips_draw_ = skips_draw; } | 37 void set_skips_draw(bool skips_draw) { skips_draw_ = skips_draw; } |
| 39 void SetTilingData(const LayerTilingData& tiler); | 38 void SetTilingData(const LayerTilingData& tiler); |
| 40 void PushTileProperties(int i, | 39 void PushTileProperties(int i, |
| 41 int j, | 40 int j, |
| 42 ResourceProvider::ResourceId resource, | 41 ResourceProvider::ResourceId resource, |
| 43 bool contents_swizzled); | 42 bool contents_swizzled); |
| 44 void PushInvalidTile(int i, int j); | 43 void PushInvalidTile(int i, int j); |
| 45 | 44 |
| 46 virtual SimpleEnclosedRegion VisibleContentOpaqueRegion() const override; | 45 SimpleEnclosedRegion VisibleContentOpaqueRegion() const override; |
| 47 virtual void ReleaseResources() override; | 46 void ReleaseResources() override; |
| 48 | 47 |
| 49 const LayerTilingData* TilingForTesting() const { return tiler_.get(); } | 48 const LayerTilingData* TilingForTesting() const { return tiler_.get(); } |
| 50 | 49 |
| 51 virtual size_t GPUMemoryUsageInBytes() const override; | 50 size_t GPUMemoryUsageInBytes() const override; |
| 52 | 51 |
| 53 protected: | 52 protected: |
| 54 TiledLayerImpl(LayerTreeImpl* tree_impl, int id); | 53 TiledLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 55 // Exposed for testing. | 54 // Exposed for testing. |
| 56 bool HasTileAt(int i, int j) const; | 55 bool HasTileAt(int i, int j) const; |
| 57 bool HasResourceIdForTileAt(int i, int j) const; | 56 bool HasResourceIdForTileAt(int i, int j) const; |
| 58 | 57 |
| 59 virtual void GetDebugBorderProperties(SkColor* color, float* width) const | 58 void GetDebugBorderProperties(SkColor* color, float* width) const override; |
| 60 override; | 59 void AsValueInto(base::debug::TracedValue* dict) const override; |
| 61 virtual void AsValueInto(base::debug::TracedValue* dict) const override; | |
| 62 | 60 |
| 63 private: | 61 private: |
| 64 virtual const char* LayerTypeAsString() const override; | 62 const char* LayerTypeAsString() const override; |
| 65 | 63 |
| 66 DrawableTile* TileAt(int i, int j) const; | 64 DrawableTile* TileAt(int i, int j) const; |
| 67 DrawableTile* CreateTile(int i, int j); | 65 DrawableTile* CreateTile(int i, int j); |
| 68 | 66 |
| 69 bool skips_draw_; | 67 bool skips_draw_; |
| 70 | 68 |
| 71 scoped_ptr<LayerTilingData> tiler_; | 69 scoped_ptr<LayerTilingData> tiler_; |
| 72 | 70 |
| 73 DISALLOW_COPY_AND_ASSIGN(TiledLayerImpl); | 71 DISALLOW_COPY_AND_ASSIGN(TiledLayerImpl); |
| 74 }; | 72 }; |
| 75 | 73 |
| 76 } // namespace cc | 74 } // namespace cc |
| 77 | 75 |
| 78 #endif // CC_LAYERS_TILED_LAYER_IMPL_H_ | 76 #endif // CC_LAYERS_TILED_LAYER_IMPL_H_ |
| OLD | NEW |