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_H_ | 5 #ifndef CC_LAYERS_SURFACE_LAYER_H_ |
6 #define CC_LAYERS_SURFACE_LAYER_H_ | 6 #define CC_LAYERS_SURFACE_LAYER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // This callback is run to require that a specific SurfaceSequence is | 26 // This callback is run to require that a specific SurfaceSequence is |
27 // received before a SurfaceId is destroyed. | 27 // received before a SurfaceId is destroyed. |
28 using RequireCallback = | 28 using RequireCallback = |
29 base::Callback<void(const SurfaceId&, const SurfaceSequence&)>; | 29 base::Callback<void(const SurfaceId&, const SurfaceSequence&)>; |
30 | 30 |
31 static scoped_refptr<SurfaceLayer> Create( | 31 static scoped_refptr<SurfaceLayer> Create( |
32 const SatisfyCallback& satisfy_callback, | 32 const SatisfyCallback& satisfy_callback, |
33 const RequireCallback& require_callback); | 33 const RequireCallback& require_callback); |
34 | 34 |
| 35 // When stretch_content_to_fill_bounds is true, scale is unused. |
35 void SetSurfaceId(const SurfaceId& surface_id, | 36 void SetSurfaceId(const SurfaceId& surface_id, |
36 float scale, | 37 float scale, |
37 const gfx::Size& size); | 38 const gfx::Size& size, |
| 39 bool stretch_content_to_fill_bounds); |
38 | 40 |
39 // Layer overrides. | 41 // Layer overrides. |
40 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 42 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
41 void SetLayerTreeHost(LayerTreeHost* host) override; | 43 void SetLayerTreeHost(LayerTreeHost* host) override; |
42 void PushPropertiesTo(LayerImpl* layer) override; | 44 void PushPropertiesTo(LayerImpl* layer) override; |
43 | 45 |
44 SurfaceId surface_id() const { return surface_id_; } | 46 SurfaceId surface_id() const { return surface_id_; } |
45 const gfx::Size& surface_size() const { return surface_size_; } | 47 const gfx::Size& surface_size() const { return surface_size_; } |
46 float surface_scale() const { return surface_scale_; } | 48 float surface_scale() const { return surface_scale_; } |
47 | 49 |
48 const SatisfyCallback& satisfy_callback() const { return satisfy_callback_; } | 50 const SatisfyCallback& satisfy_callback() const { return satisfy_callback_; } |
49 const RequireCallback& require_callback() const { return require_callback_; } | 51 const RequireCallback& require_callback() const { return require_callback_; } |
50 | 52 |
51 protected: | 53 protected: |
52 SurfaceLayer(const SatisfyCallback& satisfy_callback, | 54 SurfaceLayer(const SatisfyCallback& satisfy_callback, |
53 const RequireCallback& require_callback); | 55 const RequireCallback& require_callback); |
54 bool HasDrawableContent() const override; | 56 bool HasDrawableContent() const override; |
55 | 57 |
56 private: | 58 private: |
57 ~SurfaceLayer() override; | 59 ~SurfaceLayer() override; |
58 void CreateNewDestroySequence(); | 60 void CreateNewDestroySequence(); |
59 void SatisfyDestroySequence(); | 61 void SatisfyDestroySequence(); |
60 | 62 |
61 SurfaceId surface_id_; | 63 SurfaceId surface_id_; |
62 gfx::Size surface_size_; | 64 gfx::Size surface_size_; |
63 float surface_scale_; | 65 float surface_scale_ = 1.f; |
| 66 bool stretch_content_to_fill_bounds_ = false; |
64 SurfaceSequence destroy_sequence_; | 67 SurfaceSequence destroy_sequence_; |
65 SatisfyCallback satisfy_callback_; | 68 SatisfyCallback satisfy_callback_; |
66 RequireCallback require_callback_; | 69 RequireCallback require_callback_; |
67 | 70 |
68 DISALLOW_COPY_AND_ASSIGN(SurfaceLayer); | 71 DISALLOW_COPY_AND_ASSIGN(SurfaceLayer); |
69 }; | 72 }; |
70 | 73 |
71 } // namespace cc | 74 } // namespace cc |
72 | 75 |
73 #endif // CC_LAYERS_SURFACE_LAYER_H_ | 76 #endif // CC_LAYERS_SURFACE_LAYER_H_ |
OLD | NEW |