| 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" |
| 11 #include "cc/resources/ui_resource_client.h" | 11 #include "cc/resources/ui_resource_client.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class LayerTreeHost; | 16 class LayerTreeHost; |
| 17 class ScopedUIResource; | 17 class ScopedUIResource; |
| 18 | 18 |
| 19 class CC_EXPORT UIResourceLayer : public Layer { | 19 class CC_EXPORT UIResourceLayer : public Layer { |
| 20 public: | 20 public: |
| 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. If you use |
| 30 // this method, you are responsible for updating the ID if the layer moves |
| 31 // between compositors. |
| 30 void SetUIResourceId(UIResourceId resource_id); | 32 void SetUIResourceId(UIResourceId resource_id); |
| 31 | 33 |
| 32 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). | 34 // 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); | 35 void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right); |
| 34 | 36 |
| 35 // Sets an opacity value per vertex. It will be multiplied by the layer | 37 // Sets an opacity value per vertex. It will be multiplied by the layer |
| 36 // opacity value. | 38 // opacity value. |
| 37 void SetVertexOpacity(float bottom_left, | 39 void SetVertexOpacity(float bottom_left, |
| 38 float top_left, | 40 float top_left, |
| 39 float top_right, | 41 float top_right, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 55 SkBitmap bitmap_; | 57 SkBitmap bitmap_; |
| 56 | 58 |
| 57 gfx::PointF uv_top_left_; | 59 gfx::PointF uv_top_left_; |
| 58 gfx::PointF uv_bottom_right_; | 60 gfx::PointF uv_bottom_right_; |
| 59 float vertex_opacity_[4]; | 61 float vertex_opacity_[4]; |
| 60 | 62 |
| 61 private: | 63 private: |
| 62 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 64 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 63 void RecreateUIResourceHolder(); | 65 void RecreateUIResourceHolder(); |
| 64 | 66 |
| 65 | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(UIResourceLayer); | 67 DISALLOW_COPY_AND_ASSIGN(UIResourceLayer); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 } // namespace cc | 70 } // namespace cc |
| 71 | 71 |
| 72 #endif // CC_LAYERS_UI_RESOURCE_LAYER_H_ | 72 #endif // CC_LAYERS_UI_RESOURCE_LAYER_H_ |
| OLD | NEW |