| 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_IMPL_H_ | 5 #ifndef CC_LAYERS_UI_RESOURCE_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_UI_RESOURCE_LAYER_IMPL_H_ | 6 #define CC_LAYERS_UI_RESOURCE_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
| 11 #include "cc/layers/layer_impl.h" | 11 #include "cc/layers/layer_impl.h" |
| 12 #include "cc/resources/resource_provider.h" | 12 #include "cc/resources/resource_provider.h" |
| 13 #include "cc/resources/ui_resource_client.h" | 13 #include "cc/resources/ui_resource_client.h" |
| 14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 15 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class DictionaryValue; | 18 class DictionaryValue; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace cc { | 21 namespace cc { |
| 22 | 22 |
| 23 class CC_EXPORT UIResourceLayerImpl : public LayerImpl { | 23 class CC_EXPORT UIResourceLayerImpl : public LayerImpl { |
| 24 public: | 24 public: |
| 25 static scoped_ptr<UIResourceLayerImpl> Create(LayerTreeImpl* tree_impl, | 25 static scoped_ptr<UIResourceLayerImpl> Create(LayerTreeImpl* tree_impl, |
| 26 int id) { | 26 int id) { |
| 27 return make_scoped_ptr(new UIResourceLayerImpl(tree_impl, id)); | 27 return make_scoped_ptr(new UIResourceLayerImpl(tree_impl, id)); |
| 28 } | 28 } |
| 29 virtual ~UIResourceLayerImpl(); | 29 ~UIResourceLayerImpl() override; |
| 30 | 30 |
| 31 void SetUIResourceId(UIResourceId uid); | 31 void SetUIResourceId(UIResourceId uid); |
| 32 | 32 |
| 33 void SetImageBounds(const gfx::Size& image_bounds); | 33 void SetImageBounds(const gfx::Size& image_bounds); |
| 34 | 34 |
| 35 // 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). |
| 36 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); |
| 37 | 37 |
| 38 // 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 |
| 39 // opacity value. | 39 // opacity value. |
| 40 void SetVertexOpacity(const float vertex_opacity[4]); | 40 void SetVertexOpacity(const float vertex_opacity[4]); |
| 41 | 41 |
| 42 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 42 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 43 override; | 43 void PushPropertiesTo(LayerImpl* layer) override; |
| 44 virtual void PushPropertiesTo(LayerImpl* layer) override; | |
| 45 | 44 |
| 46 virtual bool WillDraw(DrawMode draw_mode, | 45 bool WillDraw(DrawMode draw_mode, |
| 47 ResourceProvider* resource_provider) override; | 46 ResourceProvider* resource_provider) override; |
| 48 virtual void AppendQuads(RenderPass* render_pass, | 47 void AppendQuads(RenderPass* render_pass, |
| 49 const Occlusion& occlusion_in_content_space, | 48 const Occlusion& occlusion_in_content_space, |
| 50 AppendQuadsData* append_quads_data) override; | 49 AppendQuadsData* append_quads_data) override; |
| 51 | 50 |
| 52 virtual base::DictionaryValue* LayerTreeAsJson() const override; | 51 base::DictionaryValue* LayerTreeAsJson() const override; |
| 53 | 52 |
| 54 protected: | 53 protected: |
| 55 UIResourceLayerImpl(LayerTreeImpl* tree_impl, int id); | 54 UIResourceLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 56 | 55 |
| 57 // The size of the resource bitmap in pixels. | 56 // The size of the resource bitmap in pixels. |
| 58 gfx::Size image_bounds_; | 57 gfx::Size image_bounds_; |
| 59 | 58 |
| 60 UIResourceId ui_resource_id_; | 59 UIResourceId ui_resource_id_; |
| 61 | 60 |
| 62 gfx::PointF uv_top_left_; | 61 gfx::PointF uv_top_left_; |
| 63 gfx::PointF uv_bottom_right_; | 62 gfx::PointF uv_bottom_right_; |
| 64 float vertex_opacity_[4]; | 63 float vertex_opacity_[4]; |
| 65 | 64 |
| 66 private: | 65 private: |
| 67 virtual const char* LayerTypeAsString() const override; | 66 const char* LayerTypeAsString() const override; |
| 68 | 67 |
| 69 DISALLOW_COPY_AND_ASSIGN(UIResourceLayerImpl); | 68 DISALLOW_COPY_AND_ASSIGN(UIResourceLayerImpl); |
| 70 }; | 69 }; |
| 71 | 70 |
| 72 } // namespace cc | 71 } // namespace cc |
| 73 | 72 |
| 74 #endif // CC_LAYERS_UI_RESOURCE_LAYER_IMPL_H_ | 73 #endif // CC_LAYERS_UI_RESOURCE_LAYER_IMPL_H_ |
| OLD | NEW |