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_value_observer.h" | 14 #include "cc/animation/layer_animation_value_observer.h" |
15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
16 #include "cc/base/region.h" | 16 #include "cc/base/region.h" |
17 #include "cc/layers/draw_properties.h" | 17 #include "cc/layers/draw_properties.h" |
18 #include "cc/layers/layer_lists.h" | 18 #include "cc/layers/layer_lists.h" |
19 #include "cc/layers/layer_position_constraint.h" | 19 #include "cc/layers/layer_position_constraint.h" |
| 20 #include "cc/layers/paint_properties.h" |
20 #include "cc/layers/render_surface.h" | 21 #include "cc/layers/render_surface.h" |
21 #include "cc/trees/occlusion_tracker.h" | 22 #include "cc/trees/occlusion_tracker.h" |
22 #include "skia/ext/refptr.h" | 23 #include "skia/ext/refptr.h" |
23 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" | 24 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
24 #include "third_party/skia/include/core/SkColor.h" | 25 #include "third_party/skia/include/core/SkColor.h" |
25 #include "third_party/skia/include/core/SkImageFilter.h" | 26 #include "third_party/skia/include/core/SkImageFilter.h" |
26 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
27 #include "ui/gfx/rect_f.h" | 28 #include "ui/gfx/rect_f.h" |
28 #include "ui/gfx/transform.h" | 29 #include "ui/gfx/transform.h" |
29 | 30 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 const Layer* replica_layer() const { return replica_layer_.get(); } | 262 const Layer* replica_layer() const { return replica_layer_.get(); } |
262 | 263 |
263 bool has_mask() const { return !!mask_layer_; } | 264 bool has_mask() const { return !!mask_layer_; } |
264 bool has_replica() const { return !!replica_layer_; } | 265 bool has_replica() const { return !!replica_layer_; } |
265 bool replica_has_mask() const { | 266 bool replica_has_mask() const { |
266 return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_); | 267 return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_); |
267 } | 268 } |
268 | 269 |
269 // These methods typically need to be overwritten by derived classes. | 270 // These methods typically need to be overwritten by derived classes. |
270 virtual bool DrawsContent() const; | 271 virtual bool DrawsContent() const; |
| 272 virtual void SavePaintProperties(); |
271 virtual void Update(ResourceUpdateQueue* queue, | 273 virtual void Update(ResourceUpdateQueue* queue, |
272 const OcclusionTracker* occlusion, | 274 const OcclusionTracker* occlusion, |
273 RenderingStats* stats) {} | 275 RenderingStats* stats) {} |
274 virtual bool NeedMoreUpdates(); | 276 virtual bool NeedMoreUpdates(); |
275 virtual void SetIsMask(bool is_mask) {} | 277 virtual void SetIsMask(bool is_mask) {} |
276 | 278 |
277 void SetDebugName(const std::string& debug_name); | 279 void SetDebugName(const std::string& debug_name); |
278 | 280 |
279 virtual void PushPropertiesTo(LayerImpl* layer); | 281 virtual void PushPropertiesTo(LayerImpl* layer); |
280 | 282 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 virtual bool CanClipSelf() const; | 365 virtual bool CanClipSelf() const; |
364 | 366 |
365 // Constructs a LayerImpl of the correct runtime type for this Layer type. | 367 // Constructs a LayerImpl of the correct runtime type for this Layer type. |
366 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); | 368 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); |
367 | 369 |
368 bool NeedsDisplayForTesting() const { return needs_display_; } | 370 bool NeedsDisplayForTesting() const { return needs_display_; } |
369 void ResetNeedsDisplayForTesting() { needs_display_ = false; } | 371 void ResetNeedsDisplayForTesting() { needs_display_ = false; } |
370 | 372 |
371 RenderingStatsInstrumentation* rendering_stats_instrumentation() const; | 373 RenderingStatsInstrumentation* rendering_stats_instrumentation() const; |
372 | 374 |
| 375 const PaintProperties& paint_properties() const { |
| 376 return paint_properties_; |
| 377 } |
| 378 |
373 protected: | 379 protected: |
374 friend class LayerImpl; | 380 friend class LayerImpl; |
375 friend class TreeSynchronizer; | 381 friend class TreeSynchronizer; |
376 virtual ~Layer(); | 382 virtual ~Layer(); |
377 | 383 |
378 Layer(); | 384 Layer(); |
379 | 385 |
380 void SetNeedsCommit(); | 386 void SetNeedsCommit(); |
381 void SetNeedsFullTreeSync(); | 387 void SetNeedsFullTreeSync(); |
| 388 bool IsPropertyChangeAllowed() const; |
382 | 389 |
383 // This flag is set when layer need repainting/updating. | 390 // This flag is set when layer need repainting/updating. |
384 bool needs_display_; | 391 bool needs_display_; |
385 | 392 |
386 // Tracks whether this layer may have changed stacking order with its | 393 // Tracks whether this layer may have changed stacking order with its |
387 // siblings. | 394 // siblings. |
388 bool stacking_order_changed_; | 395 bool stacking_order_changed_; |
389 | 396 |
390 // The update rect is the region of the compositor resource that was | 397 // The update rect is the region of the compositor resource that was |
391 // actually updated by the compositor. For layers that may do updating | 398 // actually updated by the compositor. For layers that may do updating |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 float raster_scale_; | 477 float raster_scale_; |
471 bool automatically_compute_raster_scale_; | 478 bool automatically_compute_raster_scale_; |
472 bool bounds_contain_page_scale_; | 479 bool bounds_contain_page_scale_; |
473 | 480 |
474 gfx::Transform impl_transform_; | 481 gfx::Transform impl_transform_; |
475 | 482 |
476 WebKit::WebLayerScrollClient* layer_scroll_client_; | 483 WebKit::WebLayerScrollClient* layer_scroll_client_; |
477 | 484 |
478 DrawProperties<Layer, RenderSurface> draw_properties_; | 485 DrawProperties<Layer, RenderSurface> draw_properties_; |
479 | 486 |
| 487 PaintProperties paint_properties_; |
| 488 |
480 DISALLOW_COPY_AND_ASSIGN(Layer); | 489 DISALLOW_COPY_AND_ASSIGN(Layer); |
481 }; | 490 }; |
482 | 491 |
483 } // namespace cc | 492 } // namespace cc |
484 | 493 |
485 #endif // CC_LAYERS_LAYER_H_ | 494 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |