[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 | |||||
[email protected] | 681ccff | 2013-03-18 06:13:52 | [diff] [blame] | 10 | #include "cc/base/cc_export.h" |
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 11 | #include "cc/layers/layer_impl.h" |
[email protected] | e12dd0e | 2013-03-18 08:24:40 | [diff] [blame] | 12 | #include "cc/resources/resource_provider.h" |
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 13 | #include "ui/gfx/rect.h" |
[email protected] | 681ccff | 2013-03-18 06:13:52 | [diff] [blame] | 14 | #include "ui/gfx/size.h" |
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 15 | |
[email protected] | 4a23c374c | 2012-12-08 08:38:55 | [diff] [blame] | 16 | namespace base { |
17 | class DictionaryValue; | ||||
18 | } | ||||
19 | |||||
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 20 | namespace cc { |
21 | |||||
22 | class CC_EXPORT NinePatchLayerImpl : public LayerImpl { | ||||
[email protected] | 37adf94 | 2013-03-08 04:43:17 | [diff] [blame] | 23 | public: |
24 | static scoped_ptr<NinePatchLayerImpl> Create(LayerTreeImpl* tree_impl, | ||||
25 | int id) { | ||||
26 | return make_scoped_ptr(new NinePatchLayerImpl(tree_impl, id)); | ||||
27 | } | ||||
28 | virtual ~NinePatchLayerImpl(); | ||||
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 29 | |
[email protected] | 37adf94 | 2013-03-08 04:43:17 | [diff] [blame] | 30 | void SetResourceId(unsigned id) { resource_id_ = id; } |
31 | void SetLayout(gfx::Size image_bounds, gfx::Rect aperture); | ||||
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 32 | |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 33 | virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
[email protected] | 37adf94 | 2013-03-08 04:43:17 | [diff] [blame] | 34 | OVERRIDE; |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 35 | virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
[email protected] | 48871fc | 2013-01-23 07:36:51 | [diff] [blame] | 36 | |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 37 | virtual void WillDraw(ResourceProvider* resource_provider) OVERRIDE; |
38 | virtual void AppendQuads(QuadSink* quad_sink, | ||||
39 | AppendQuadsData* append_quads_data) OVERRIDE; | ||||
[email protected] | cccb13d | 2013-03-21 20:12:50 | [diff] [blame] | 40 | virtual void DidDraw(ResourceProvider* resource_provider) OVERRIDE; |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 41 | virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE; |
42 | virtual void DumpLayerProperties(std::string* str, int indent) const OVERRIDE; | ||||
43 | virtual void DidLoseOutputSurface() OVERRIDE; | ||||
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 44 | |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 45 | virtual base::DictionaryValue* LayerTreeAsJson() const OVERRIDE; |
[email protected] | 4a23c374c | 2012-12-08 08:38:55 | [diff] [blame] | 46 | |
[email protected] | 37adf94 | 2013-03-08 04:43:17 | [diff] [blame] | 47 | protected: |
48 | NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id); | ||||
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 49 | |
[email protected] | 37adf94 | 2013-03-08 04:43:17 | [diff] [blame] | 50 | private: |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 51 | virtual const char* LayerTypeAsString() const OVERRIDE; |
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 52 | |
[email protected] | 37adf94 | 2013-03-08 04:43:17 | [diff] [blame] | 53 | // The size of the NinePatch bitmap in pixels. |
54 | gfx::Size image_bounds_; | ||||
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 55 | |
[email protected] | 37adf94 | 2013-03-08 04:43:17 | [diff] [blame] | 56 | // The transparent center region that shows the parent layer's contents in |
57 | // image space. | ||||
58 | gfx::Rect image_aperture_; | ||||
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 59 | |
[email protected] | 37adf94 | 2013-03-08 04:43:17 | [diff] [blame] | 60 | ResourceProvider::ResourceId resource_id_; |
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 61 | }; |
62 | |||||
[email protected] | ffaa2a63 | 2012-11-11 14:47:50 | [diff] [blame] | 63 | } // namespace cc |
[email protected] | 35680c0 | 2012-11-06 05:53:00 | [diff] [blame] | 64 | |
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 65 | #endif // CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ |