OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_LAYER_H_ | 5 #ifndef CC_LAYERS_LAYER_H_ |
6 #define CC_LAYERS_LAYER_H_ | 6 #define CC_LAYERS_LAYER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "cc/animation/layer_animation_controller.h" | 13 #include "cc/animation/layer_animation_controller.h" |
14 #include "cc/animation/layer_animation_event_observer.h" | 14 #include "cc/animation/layer_animation_event_observer.h" |
15 #include "cc/animation/layer_animation_value_observer.h" | 15 #include "cc/animation/layer_animation_value_observer.h" |
16 #include "cc/base/cc_export.h" | 16 #include "cc/base/cc_export.h" |
17 #include "cc/base/region.h" | 17 #include "cc/base/region.h" |
18 #include "cc/layers/draw_properties.h" | 18 #include "cc/layers/draw_properties.h" |
| 19 #include "cc/layers/layer_lists.h" |
19 #include "cc/layers/render_surface.h" | 20 #include "cc/layers/render_surface.h" |
20 #include "cc/trees/occlusion_tracker.h" | 21 #include "cc/trees/occlusion_tracker.h" |
21 #include "skia/ext/refptr.h" | 22 #include "skia/ext/refptr.h" |
22 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" | 23 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
23 #include "third_party/skia/include/core/SkColor.h" | 24 #include "third_party/skia/include/core/SkColor.h" |
24 #include "third_party/skia/include/core/SkImageFilter.h" | 25 #include "third_party/skia/include/core/SkImageFilter.h" |
25 #include "ui/gfx/rect.h" | 26 #include "ui/gfx/rect.h" |
26 #include "ui/gfx/rect_f.h" | 27 #include "ui/gfx/rect_f.h" |
27 #include "ui/gfx/transform.h" | 28 #include "ui/gfx/transform.h" |
28 | 29 |
(...skipping 15 matching lines...) Expand all Loading... |
44 class ResourceUpdateQueue; | 45 class ResourceUpdateQueue; |
45 class ScrollbarLayer; | 46 class ScrollbarLayer; |
46 struct AnimationEvent; | 47 struct AnimationEvent; |
47 struct RenderingStats; | 48 struct RenderingStats; |
48 | 49 |
49 // Base class for composited layers. Special layer types are derived from | 50 // Base class for composited layers. Special layer types are derived from |
50 // this class. | 51 // this class. |
51 class CC_EXPORT Layer : public base::RefCounted<Layer>, | 52 class CC_EXPORT Layer : public base::RefCounted<Layer>, |
52 public LayerAnimationValueObserver { | 53 public LayerAnimationValueObserver { |
53 public: | 54 public: |
54 typedef std::vector<scoped_refptr<Layer> > LayerList; | |
55 enum LayerIdLabels { | 55 enum LayerIdLabels { |
56 PINCH_ZOOM_ROOT_SCROLL_LAYER_ID = -2, | 56 PINCH_ZOOM_ROOT_SCROLL_LAYER_ID = -2, |
57 INVALID_ID = -1, | 57 INVALID_ID = -1, |
58 }; | 58 }; |
59 | 59 |
60 static scoped_refptr<Layer> Create(); | 60 static scoped_refptr<Layer> Create(); |
61 | 61 |
62 int id() const { return layer_id_; } | 62 int id() const { return layer_id_; } |
63 | 63 |
64 Layer* RootLayer(); | 64 Layer* RootLayer(); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 virtual void Update(ResourceUpdateQueue* queue, | 270 virtual void Update(ResourceUpdateQueue* queue, |
271 const OcclusionTracker* occlusion, | 271 const OcclusionTracker* occlusion, |
272 RenderingStats* stats) {} | 272 RenderingStats* stats) {} |
273 virtual bool NeedMoreUpdates(); | 273 virtual bool NeedMoreUpdates(); |
274 virtual void SetIsMask(bool is_mask) {} | 274 virtual void SetIsMask(bool is_mask) {} |
275 | 275 |
276 void SetDebugName(const std::string& debug_name); | 276 void SetDebugName(const std::string& debug_name); |
277 | 277 |
278 virtual void PushPropertiesTo(LayerImpl* layer); | 278 virtual void PushPropertiesTo(LayerImpl* layer); |
279 | 279 |
280 void ClearRenderSurface() { draw_properties_.render_surface.reset(); } | |
281 void CreateRenderSurface(); | 280 void CreateRenderSurface(); |
| 281 void ClearRenderSurface(); |
282 | 282 |
283 // The contents scale converts from logical, non-page-scaled pixels to target | 283 // The contents scale converts from logical, non-page-scaled pixels to target |
284 // pixels. The contents scale is 1 for the root layer as it is already in | 284 // pixels. The contents scale is 1 for the root layer as it is already in |
285 // physical pixels. By default contents scale is forced to be 1 except for | 285 // physical pixels. By default contents scale is forced to be 1 except for |
286 // subclasses of ContentsScalingLayer. | 286 // subclasses of ContentsScalingLayer. |
287 float contents_scale_x() const { return draw_properties_.contents_scale_x; } | 287 float contents_scale_x() const { return draw_properties_.contents_scale_x; } |
288 float contents_scale_y() const { return draw_properties_.contents_scale_y; } | 288 float contents_scale_y() const { return draw_properties_.contents_scale_y; } |
289 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } | 289 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } |
290 | 290 |
291 virtual void CalculateContentsScale(float ideal_contents_scale, | 291 virtual void CalculateContentsScale(float ideal_contents_scale, |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 WebKit::WebLayerScrollClient* layer_scroll_client_; | 482 WebKit::WebLayerScrollClient* layer_scroll_client_; |
483 | 483 |
484 DrawProperties<Layer, RenderSurface> draw_properties_; | 484 DrawProperties<Layer, RenderSurface> draw_properties_; |
485 | 485 |
486 DISALLOW_COPY_AND_ASSIGN(Layer); | 486 DISALLOW_COPY_AND_ASSIGN(Layer); |
487 }; | 487 }; |
488 | 488 |
489 } // namespace cc | 489 } // namespace cc |
490 | 490 |
491 #endif // CC_LAYERS_LAYER_H_ | 491 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |