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