OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_UI_RESOURCE_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_UI_RESOURCE_LAYER_IMPL_H_ |
6 #define CC_LAYERS_UI_RESOURCE_LAYER_IMPL_H_ | 6 #define CC_LAYERS_UI_RESOURCE_LAYER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" |
11 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
12 #include "cc/layers/layer_impl.h" | 13 #include "cc/layers/layer_impl.h" |
13 #include "cc/resources/resource_provider.h" | 14 #include "cc/resources/resource_provider.h" |
14 #include "cc/resources/ui_resource_client.h" | 15 #include "cc/resources/ui_resource_client.h" |
15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 class DictionaryValue; | 20 class DictionaryValue; |
20 } | 21 } |
21 | 22 |
22 namespace cc { | 23 namespace cc { |
23 | 24 |
24 class CC_EXPORT UIResourceLayerImpl : public LayerImpl { | 25 class CC_EXPORT UIResourceLayerImpl : public LayerImpl { |
25 public: | 26 public: |
26 static scoped_ptr<UIResourceLayerImpl> Create(LayerTreeImpl* tree_impl, | 27 static std::unique_ptr<UIResourceLayerImpl> Create(LayerTreeImpl* tree_impl, |
27 int id) { | 28 int id) { |
28 return make_scoped_ptr(new UIResourceLayerImpl(tree_impl, id)); | 29 return base::WrapUnique(new UIResourceLayerImpl(tree_impl, id)); |
29 } | 30 } |
30 ~UIResourceLayerImpl() override; | 31 ~UIResourceLayerImpl() override; |
31 | 32 |
32 void SetUIResourceId(UIResourceId uid); | 33 void SetUIResourceId(UIResourceId uid); |
33 | 34 |
34 void SetImageBounds(const gfx::Size& image_bounds); | 35 void SetImageBounds(const gfx::Size& image_bounds); |
35 | 36 |
36 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). | 37 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). |
37 void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right); | 38 void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right); |
38 | 39 |
39 // Sets an opacity value per vertex. It will be multiplied by the layer | 40 // Sets an opacity value per vertex. It will be multiplied by the layer |
40 // opacity value. | 41 // opacity value. |
41 void SetVertexOpacity(const float vertex_opacity[4]); | 42 void SetVertexOpacity(const float vertex_opacity[4]); |
42 | 43 |
43 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 44 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
44 void PushPropertiesTo(LayerImpl* layer) override; | 45 void PushPropertiesTo(LayerImpl* layer) override; |
45 | 46 |
46 bool WillDraw(DrawMode draw_mode, | 47 bool WillDraw(DrawMode draw_mode, |
47 ResourceProvider* resource_provider) override; | 48 ResourceProvider* resource_provider) override; |
48 void AppendQuads(RenderPass* render_pass, | 49 void AppendQuads(RenderPass* render_pass, |
49 AppendQuadsData* append_quads_data) override; | 50 AppendQuadsData* append_quads_data) override; |
50 | 51 |
51 base::DictionaryValue* LayerTreeAsJson() const override; | 52 base::DictionaryValue* LayerTreeAsJson() const override; |
52 | 53 |
53 protected: | 54 protected: |
(...skipping 10 matching lines...) Expand all Loading... |
64 | 65 |
65 private: | 66 private: |
66 const char* LayerTypeAsString() const override; | 67 const char* LayerTypeAsString() const override; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(UIResourceLayerImpl); | 69 DISALLOW_COPY_AND_ASSIGN(UIResourceLayerImpl); |
69 }; | 70 }; |
70 | 71 |
71 } // namespace cc | 72 } // namespace cc |
72 | 73 |
73 #endif // CC_LAYERS_UI_RESOURCE_LAYER_IMPL_H_ | 74 #endif // CC_LAYERS_UI_RESOURCE_LAYER_IMPL_H_ |
OLD | NEW |