| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SURFACE_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_SURFACE_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_SURFACE_LAYER_IMPL_H_ | 6 #define CC_LAYERS_SURFACE_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
| 13 #include "cc/layers/layer_impl.h" | 13 #include "cc/layers/layer_impl.h" |
| 14 #include "cc/surfaces/surface_id.h" | 14 #include "cc/surfaces/surface_id.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 | 17 |
| 18 class CC_EXPORT SurfaceLayerImpl : public LayerImpl { | 18 class CC_EXPORT SurfaceLayerImpl : public LayerImpl { |
| 19 public: | 19 public: |
| 20 static std::unique_ptr<SurfaceLayerImpl> Create(LayerTreeImpl* tree_impl, | 20 static std::unique_ptr<SurfaceLayerImpl> Create(LayerTreeImpl* tree_impl, |
| 21 int id) { | 21 int id) { |
| 22 return base::WrapUnique(new SurfaceLayerImpl(tree_impl, id)); | 22 return base::WrapUnique(new SurfaceLayerImpl(tree_impl, id)); |
| 23 } | 23 } |
| 24 ~SurfaceLayerImpl() override; | 24 ~SurfaceLayerImpl() override; |
| 25 | 25 |
| 26 void SetSurfaceId(const SurfaceId& surface_id); | 26 void SetSurfaceId(const SurfaceId& surface_id); |
| 27 void SetSurfaceScale(float scale); | 27 void SetSurfaceScale(float scale); |
| 28 void SetSurfaceSize(const gfx::Size& size); | 28 void SetSurfaceSize(const gfx::Size& size); |
| 29 void SetStretchContentToFillBounds(bool stretch_content); |
| 29 const SurfaceId& surface_id() const { return surface_id_; } | 30 const SurfaceId& surface_id() const { return surface_id_; } |
| 30 | 31 |
| 31 // LayerImpl overrides. | 32 // LayerImpl overrides. |
| 32 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 33 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 33 void PushPropertiesTo(LayerImpl* layer) override; | 34 void PushPropertiesTo(LayerImpl* layer) override; |
| 34 void AppendQuads(RenderPass* render_pass, | 35 void AppendQuads(RenderPass* render_pass, |
| 35 AppendQuadsData* append_quads_data) override; | 36 AppendQuadsData* append_quads_data) override; |
| 36 | 37 |
| 37 protected: | 38 protected: |
| 38 SurfaceLayerImpl(LayerTreeImpl* tree_impl, int id); | 39 SurfaceLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 39 | 40 |
| 40 private: | 41 private: |
| 41 void GetDebugBorderProperties(SkColor* color, float* width) const override; | 42 void GetDebugBorderProperties(SkColor* color, float* width) const override; |
| 42 void AppendRainbowDebugBorder(RenderPass* render_pass); | 43 void AppendRainbowDebugBorder(RenderPass* render_pass); |
| 43 void AsValueInto(base::trace_event::TracedValue* dict) const override; | 44 void AsValueInto(base::trace_event::TracedValue* dict) const override; |
| 44 const char* LayerTypeAsString() const override; | 45 const char* LayerTypeAsString() const override; |
| 45 | 46 |
| 46 SurfaceId surface_id_; | 47 SurfaceId surface_id_; |
| 47 gfx::Size surface_size_; | 48 gfx::Size surface_size_; |
| 48 float surface_scale_; | 49 float surface_scale_ = 0.f; |
| 50 bool stretch_content_to_fill_bounds_ = false; |
| 49 | 51 |
| 50 DISALLOW_COPY_AND_ASSIGN(SurfaceLayerImpl); | 52 DISALLOW_COPY_AND_ASSIGN(SurfaceLayerImpl); |
| 51 }; | 53 }; |
| 52 | 54 |
| 53 } // namespace cc | 55 } // namespace cc |
| 54 | 56 |
| 55 #endif // CC_LAYERS_SURFACE_LAYER_IMPL_H_ | 57 #endif // CC_LAYERS_SURFACE_LAYER_IMPL_H_ |
| OLD | NEW |