OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_NINE_PATCH_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ |
6 #define CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ | 6 #define CC_LAYERS_NINE_PATCH_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/layers/ui_resource_layer_impl.h" | 14 #include "cc/layers/ui_resource_layer_impl.h" |
14 #include "cc/resources/resource_provider.h" | 15 #include "cc/resources/resource_provider.h" |
15 #include "cc/resources/ui_resource_client.h" | 16 #include "cc/resources/ui_resource_client.h" |
16 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
17 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
18 | 19 |
19 namespace base { | 20 namespace base { |
20 class DictionaryValue; | 21 class DictionaryValue; |
21 } | 22 } |
22 | 23 |
23 namespace cc { | 24 namespace cc { |
24 | 25 |
25 class CC_EXPORT NinePatchLayerImpl : public UIResourceLayerImpl { | 26 class CC_EXPORT NinePatchLayerImpl : public UIResourceLayerImpl { |
26 public: | 27 public: |
27 static scoped_ptr<NinePatchLayerImpl> Create(LayerTreeImpl* tree_impl, | 28 static std::unique_ptr<NinePatchLayerImpl> Create(LayerTreeImpl* tree_impl, |
28 int id) { | 29 int id) { |
29 return make_scoped_ptr(new NinePatchLayerImpl(tree_impl, id)); | 30 return base::WrapUnique(new NinePatchLayerImpl(tree_impl, id)); |
30 } | 31 } |
31 ~NinePatchLayerImpl() override; | 32 ~NinePatchLayerImpl() override; |
32 | 33 |
33 // The bitmap stretches out the bounds of the layer. The following picture | 34 // The bitmap stretches out the bounds of the layer. The following picture |
34 // illustrates the parameters associated with the dimensions. | 35 // illustrates the parameters associated with the dimensions. |
35 // | 36 // |
36 // Layer space layout Bitmap space layout | 37 // Layer space layout Bitmap space layout |
37 // | 38 // |
38 // ------------------------ ~~~~~~~~~~ W ~~~~~~~~~~ | 39 // ------------------------ ~~~~~~~~~~ W ~~~~~~~~~~ |
39 // | : | : : | | 40 // | : | : : | |
(...skipping 12 matching lines...) Expand all Loading... |
52 // | 53 // |
53 // |image_bounds| = (W, H) | 54 // |image_bounds| = (W, H) |
54 // |image_aperture| = (X, Y, P, Q) | 55 // |image_aperture| = (X, Y, P, Q) |
55 // |border| = (A, C, A + B, C + D) | 56 // |border| = (A, C, A + B, C + D) |
56 // |fill_center| indicates whether to draw the center quad or not. | 57 // |fill_center| indicates whether to draw the center quad or not. |
57 void SetLayout(const gfx::Rect& image_aperture, | 58 void SetLayout(const gfx::Rect& image_aperture, |
58 const gfx::Rect& border, | 59 const gfx::Rect& border, |
59 bool fill_center, | 60 bool fill_center, |
60 bool nearest_neighbor); | 61 bool nearest_neighbor); |
61 | 62 |
62 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 63 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
63 void PushPropertiesTo(LayerImpl* layer) override; | 64 void PushPropertiesTo(LayerImpl* layer) override; |
64 | 65 |
65 void AppendQuads(RenderPass* render_pass, | 66 void AppendQuads(RenderPass* render_pass, |
66 AppendQuadsData* append_quads_data) override; | 67 AppendQuadsData* append_quads_data) override; |
67 | 68 |
68 base::DictionaryValue* LayerTreeAsJson() const override; | 69 base::DictionaryValue* LayerTreeAsJson() const override; |
69 | 70 |
70 protected: | 71 protected: |
71 NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id); | 72 NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id); |
72 | 73 |
(...skipping 12 matching lines...) Expand all Loading... |
85 bool fill_center_; | 86 bool fill_center_; |
86 | 87 |
87 bool nearest_neighbor_; | 88 bool nearest_neighbor_; |
88 | 89 |
89 DISALLOW_COPY_AND_ASSIGN(NinePatchLayerImpl); | 90 DISALLOW_COPY_AND_ASSIGN(NinePatchLayerImpl); |
90 }; | 91 }; |
91 | 92 |
92 } // namespace cc | 93 } // namespace cc |
93 | 94 |
94 #endif // CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ | 95 #endif // CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ |
OLD | NEW |