| 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/quads/surface_draw_quad.h" |
| 14 #include "cc/surfaces/surface_id.h" | 15 #include "cc/surfaces/surface_id.h" |
| 15 #include "cc/surfaces/surface_info.h" | 16 #include "cc/surfaces/surface_info.h" |
| 16 | 17 |
| 17 namespace cc { | 18 namespace cc { |
| 18 | 19 |
| 19 class CC_EXPORT SurfaceLayerImpl : public LayerImpl { | 20 class CC_EXPORT SurfaceLayerImpl : public LayerImpl { |
| 20 public: | 21 public: |
| 21 static std::unique_ptr<SurfaceLayerImpl> Create(LayerTreeImpl* tree_impl, | 22 static std::unique_ptr<SurfaceLayerImpl> Create(LayerTreeImpl* tree_impl, |
| 22 int id) { | 23 int id) { |
| 23 return base::WrapUnique(new SurfaceLayerImpl(tree_impl, id)); | 24 return base::WrapUnique(new SurfaceLayerImpl(tree_impl, id)); |
| 24 } | 25 } |
| 25 ~SurfaceLayerImpl() override; | 26 ~SurfaceLayerImpl() override; |
| 26 | 27 |
| 27 void SetSurfaceInfo(const SurfaceInfo& surface_info); | 28 void SetPrimarySurfaceInfo(const SurfaceInfo& surface_info); |
| 28 const SurfaceInfo& surface_info() const { return surface_info_; } | 29 const SurfaceInfo& primary_surface_info() const { |
| 30 return primary_surface_info_; |
| 31 } |
| 32 |
| 33 void SetFallbackSurfaceInfo(const SurfaceInfo& surface_info); |
| 34 const SurfaceInfo& fallback_surface_info() const { |
| 35 return fallback_surface_info_; |
| 36 } |
| 37 |
| 29 void SetStretchContentToFillBounds(bool stretch_content); | 38 void SetStretchContentToFillBounds(bool stretch_content); |
| 30 | 39 |
| 31 // LayerImpl overrides. | 40 // LayerImpl overrides. |
| 32 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 41 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 33 void PushPropertiesTo(LayerImpl* layer) override; | 42 void PushPropertiesTo(LayerImpl* layer) override; |
| 34 void AppendQuads(RenderPass* render_pass, | 43 void AppendQuads(RenderPass* render_pass, |
| 35 AppendQuadsData* append_quads_data) override; | 44 AppendQuadsData* append_quads_data) override; |
| 36 | 45 |
| 37 protected: | 46 protected: |
| 38 SurfaceLayerImpl(LayerTreeImpl* tree_impl, int id); | 47 SurfaceLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 39 | 48 |
| 40 private: | 49 private: |
| 50 void PopulateSurfaceDrawQuad(RenderPass* render_pass, |
| 51 SurfaceDrawQuad* surface_draw_quad, |
| 52 SurfaceDrawQuad* fallback_surface_draw_quad, |
| 53 SurfaceDrawQuadType surface_draw_quad_type, |
| 54 const SurfaceInfo& surface_info); |
| 55 |
| 41 void GetDebugBorderProperties(SkColor* color, float* width) const override; | 56 void GetDebugBorderProperties(SkColor* color, float* width) const override; |
| 42 void AppendRainbowDebugBorder(RenderPass* render_pass); | 57 void AppendRainbowDebugBorder(RenderPass* render_pass); |
| 43 void AsValueInto(base::trace_event::TracedValue* dict) const override; | 58 void AsValueInto(base::trace_event::TracedValue* dict) const override; |
| 44 const char* LayerTypeAsString() const override; | 59 const char* LayerTypeAsString() const override; |
| 45 | 60 |
| 46 SurfaceInfo surface_info_; | 61 SurfaceInfo primary_surface_info_; |
| 62 SurfaceInfo fallback_surface_info_; |
| 63 |
| 47 bool stretch_content_to_fill_bounds_ = false; | 64 bool stretch_content_to_fill_bounds_ = false; |
| 48 | 65 |
| 49 DISALLOW_COPY_AND_ASSIGN(SurfaceLayerImpl); | 66 DISALLOW_COPY_AND_ASSIGN(SurfaceLayerImpl); |
| 50 }; | 67 }; |
| 51 | 68 |
| 52 } // namespace cc | 69 } // namespace cc |
| 53 | 70 |
| 54 #endif // CC_LAYERS_SURFACE_LAYER_IMPL_H_ | 71 #endif // CC_LAYERS_SURFACE_LAYER_IMPL_H_ |
| OLD | NEW |