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_H_ | 5 #ifndef CC_LAYERS_UI_RESOURCE_LAYER_H_ |
6 #define CC_LAYERS_UI_RESOURCE_LAYER_H_ | 6 #define CC_LAYERS_UI_RESOURCE_LAYER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 static scoped_refptr<UIResourceLayer> Create(); | 21 static scoped_refptr<UIResourceLayer> Create(); |
22 | 22 |
23 void PushPropertiesTo(LayerImpl* layer) override; | 23 void PushPropertiesTo(LayerImpl* layer) override; |
24 | 24 |
25 void SetLayerTreeHost(LayerTreeHost* host) override; | 25 void SetLayerTreeHost(LayerTreeHost* host) override; |
26 | 26 |
27 void SetBitmap(const SkBitmap& skbitmap); | 27 void SetBitmap(const SkBitmap& skbitmap); |
28 | 28 |
29 // An alternative way of setting the resource to allow for sharing. | 29 // An alternative way of setting the resource to allow for sharing. |
30 void SetUIResourceId(UIResourceId resource_id); | 30 void SetUIResourceId(UIResourceId resource_id); |
31 // Use this if |resource_id| should be preserved even when LayerTreeHost | |
danakj
2014/11/19 15:56:04
This doesn't make sense. If you moved it from one
| |
32 // is changed. | |
33 void SetPersistentUIResourceId(UIResourceId resource_id); | |
31 | 34 |
32 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). | 35 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). |
33 void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right); | 36 void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right); |
34 | 37 |
35 // Sets an opacity value per vertex. It will be multiplied by the layer | 38 // Sets an opacity value per vertex. It will be multiplied by the layer |
36 // opacity value. | 39 // opacity value. |
37 void SetVertexOpacity(float bottom_left, | 40 void SetVertexOpacity(float bottom_left, |
38 float top_left, | 41 float top_left, |
39 float top_right, | 42 float top_right, |
40 float bottom_right); | 43 float bottom_right); |
41 | 44 |
42 class UIResourceHolder { | 45 class UIResourceHolder { |
43 public: | 46 public: |
44 virtual UIResourceId id() = 0; | 47 virtual UIResourceId id() = 0; |
45 virtual ~UIResourceHolder(); | 48 virtual ~UIResourceHolder(); |
49 virtual bool NeedsRecreation() = 0; | |
46 }; | 50 }; |
47 | 51 |
48 protected: | 52 protected: |
49 UIResourceLayer(); | 53 UIResourceLayer(); |
50 ~UIResourceLayer() override; | 54 ~UIResourceLayer() override; |
51 | 55 |
52 bool HasDrawableContent() const override; | 56 bool HasDrawableContent() const override; |
53 | 57 |
54 scoped_ptr<UIResourceHolder> ui_resource_holder_; | 58 scoped_ptr<UIResourceHolder> ui_resource_holder_; |
55 SkBitmap bitmap_; | 59 SkBitmap bitmap_; |
56 | 60 |
57 gfx::PointF uv_top_left_; | 61 gfx::PointF uv_top_left_; |
58 gfx::PointF uv_bottom_right_; | 62 gfx::PointF uv_bottom_right_; |
59 float vertex_opacity_[4]; | 63 float vertex_opacity_[4]; |
60 | 64 |
61 private: | 65 private: |
62 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 66 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
63 void RecreateUIResourceHolder(); | 67 void RecreateUIResourceHolder(); |
64 | 68 void SetUIResourceIdInternal(UIResourceId resource_id, bool is_persistent); |
65 | |
66 | 69 |
67 DISALLOW_COPY_AND_ASSIGN(UIResourceLayer); | 70 DISALLOW_COPY_AND_ASSIGN(UIResourceLayer); |
68 }; | 71 }; |
69 | 72 |
70 } // namespace cc | 73 } // namespace cc |
71 | 74 |
72 #endif // CC_LAYERS_UI_RESOURCE_LAYER_H_ | 75 #endif // CC_LAYERS_UI_RESOURCE_LAYER_H_ |
OLD | NEW |