[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 5 | #ifndef CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ |
6 | #define CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ | ||||
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 7 | |
[email protected] | bf691c2 | 2013-03-26 21:15:06 | [diff] [blame] | 8 | #include <string> |
9 | |||||
avi | 02a4d17 | 2015-12-21 06:14:36 | [diff] [blame] | 10 | #include "base/macros.h" |
danakj | 60bc3bc | 2016-04-09 00:24:48 | [diff] [blame] | 11 | #include "base/memory/ptr_util.h" |
chrishtr | ac41ff9 | 2017-03-17 05:07:30 | [diff] [blame] | 12 | #include "cc/cc_export.h" |
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 13 | #include "cc/layers/layer_impl.h" |
danakj | 83d0eb4f | 2017-09-19 17:31:58 | [diff] [blame] | 14 | #include "cc/layers/nine_patch_generator.h" |
[email protected] | efbdb3a | 2013-10-04 00:35:13 | [diff] [blame] | 15 | #include "cc/layers/ui_resource_layer_impl.h" |
[email protected] | 741fba42 | 2013-09-20 03:34:14 | [diff] [blame] | 16 | #include "cc/resources/ui_resource_client.h" |
heejin.r.chung | d28506ba | 2014-10-23 16:36:20 | [diff] [blame] | 17 | #include "ui/gfx/geometry/rect.h" |
18 | #include "ui/gfx/geometry/size.h" | ||||
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 19 | |
[email protected] | 4a23c374c | 2012-12-08 08:38:55 | [diff] [blame] | 20 | namespace base { |
21 | class DictionaryValue; | ||||
22 | } | ||||
23 | |||||
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 24 | namespace cc { |
25 | |||||
[email protected] | efbdb3a | 2013-10-04 00:35:13 | [diff] [blame] | 26 | class CC_EXPORT NinePatchLayerImpl : public UIResourceLayerImpl { |
[email protected] | 37adf94 | 2013-03-08 04:43:17 | [diff] [blame] | 27 | public: |
danakj | 60bc3bc | 2016-04-09 00:24:48 | [diff] [blame] | 28 | static std::unique_ptr<NinePatchLayerImpl> Create(LayerTreeImpl* tree_impl, |
29 | int id) { | ||||
30 | return base::WrapUnique(new NinePatchLayerImpl(tree_impl, id)); | ||||
[email protected] | 37adf94 | 2013-03-08 04:43:17 | [diff] [blame] | 31 | } |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 32 | ~NinePatchLayerImpl() override; |
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 33 | |
bokan | e7a058a | 2017-03-02 22:42:51 | [diff] [blame] | 34 | // For parameter meanings, see the declaration of NinePatchGenerator. |
[email protected] | 0023fc7 | 2014-01-10 20:05:06 | [diff] [blame] | 35 | void SetLayout(const gfx::Rect& image_aperture, |
36 | const gfx::Rect& border, | ||||
lionel.g.landwerlin | 258c7d3 | 2016-07-27 09:55:24 | [diff] [blame] | 37 | const gfx::Rect& layer_occlusion, |
kkimlabs | 22367f64 | 2016-01-23 23:23:24 | [diff] [blame] | 38 | bool fill_center, |
39 | bool nearest_neighbor); | ||||
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 40 | |
danakj | 60bc3bc | 2016-04-09 00:24:48 | [diff] [blame] | 41 | std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 42 | void PushPropertiesTo(LayerImpl* layer) override; |
[email protected] | 48871fc | 2013-01-23 07:36:51 | [diff] [blame] | 43 | |
danakj | e5805be | 2017-09-15 19:24:55 | [diff] [blame] | 44 | void AppendQuads(viz::RenderPass* render_pass, |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 45 | AppendQuadsData* append_quads_data) override; |
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 46 | |
Philip Rogers | 8089055 | 2017-10-12 02:42:19 | [diff] [blame] | 47 | std::unique_ptr<base::DictionaryValue> LayerAsJson() override; |
[email protected] | 4a23c374c | 2012-12-08 08:38:55 | [diff] [blame] | 48 | |
[email protected] | 37adf94 | 2013-03-08 04:43:17 | [diff] [blame] | 49 | protected: |
50 | NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id); | ||||
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 51 | |
[email protected] | 37adf94 | 2013-03-08 04:43:17 | [diff] [blame] | 52 | private: |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 53 | const char* LayerTypeAsString() const override; |
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 54 | |
bokan | e7a058a | 2017-03-02 22:42:51 | [diff] [blame] | 55 | NinePatchGenerator quad_generator_; |
lionel.g.landwerlin | 258c7d3 | 2016-07-27 09:55:24 | [diff] [blame] | 56 | |
[email protected] | fa2d9a5 | 2013-03-27 18:47:08 | [diff] [blame] | 57 | DISALLOW_COPY_AND_ASSIGN(NinePatchLayerImpl); |
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 58 | }; |
59 | |||||
[email protected] | ffaa2a63 | 2012-11-11 14:47:50 | [diff] [blame] | 60 | } // namespace cc |
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 61 | |
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 62 | #endif // CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ |