Manual fixups for scoped_refptr operator T* removal in base/
[chromium-blink-merge.git] / cc / layers / layer_impl.h
blobc10710c4000f77f706b20833e8561ec6c3e1c14e
1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_LAYERS_LAYER_IMPL_H_
6 #define CC_LAYERS_LAYER_IMPL_H_
8 #include <set>
9 #include <string>
11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/values.h"
14 #include "cc/animation/animation_delegate.h"
15 #include "cc/animation/layer_animation_controller.h"
16 #include "cc/animation/layer_animation_value_observer.h"
17 #include "cc/animation/layer_animation_value_provider.h"
18 #include "cc/base/cc_export.h"
19 #include "cc/base/region.h"
20 #include "cc/base/scoped_ptr_vector.h"
21 #include "cc/input/input_handler.h"
22 #include "cc/layers/draw_properties.h"
23 #include "cc/layers/layer_lists.h"
24 #include "cc/layers/layer_position_constraint.h"
25 #include "cc/layers/render_surface_impl.h"
26 #include "cc/output/filter_operations.h"
27 #include "cc/quads/shared_quad_state.h"
28 #include "cc/resources/resource_provider.h"
29 #include "skia/ext/refptr.h"
30 #include "third_party/skia/include/core/SkColor.h"
31 #include "third_party/skia/include/core/SkImageFilter.h"
32 #include "third_party/skia/include/core/SkPicture.h"
33 #include "ui/gfx/point3_f.h"
34 #include "ui/gfx/rect.h"
35 #include "ui/gfx/rect_f.h"
36 #include "ui/gfx/transform.h"
38 namespace base {
39 namespace debug {
40 class ConvertableToTraceFormat;
41 class TracedValue;
44 class DictionaryValue;
47 namespace cc {
49 class LayerTreeHostImpl;
50 class LayerTreeImpl;
51 class MicroBenchmarkImpl;
52 template <typename LayerType>
53 class OcclusionTracker;
54 class RenderPass;
55 class RenderPassId;
56 class Renderer;
57 class ScrollbarAnimationController;
58 class ScrollbarLayerImplBase;
59 class SimpleEnclosedRegion;
60 class Tile;
62 struct AppendQuadsData;
64 enum DrawMode {
65 DRAW_MODE_NONE,
66 DRAW_MODE_HARDWARE,
67 DRAW_MODE_SOFTWARE,
68 DRAW_MODE_RESOURCELESS_SOFTWARE
71 class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
72 public LayerAnimationValueProvider,
73 public AnimationDelegate {
74 public:
75 // Allows for the ownership of the total scroll offset to be delegated outside
76 // of the layer.
77 class ScrollOffsetDelegate {
78 public:
79 virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) = 0;
80 virtual gfx::Vector2dF GetTotalScrollOffset() = 0;
81 virtual bool IsExternalFlingActive() const = 0;
84 typedef LayerImplList RenderSurfaceListType;
85 typedef LayerImplList LayerListType;
86 typedef RenderSurfaceImpl RenderSurfaceType;
88 enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 };
90 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
91 return make_scoped_ptr(new LayerImpl(tree_impl, id));
94 virtual ~LayerImpl();
96 int id() const { return layer_id_; }
98 // LayerAnimationValueProvider implementation.
99 virtual gfx::Vector2dF ScrollOffsetForAnimation() const OVERRIDE;
101 // LayerAnimationValueObserver implementation.
102 virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE;
103 virtual void OnOpacityAnimated(float opacity) OVERRIDE;
104 virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE;
105 virtual void OnScrollOffsetAnimated(
106 const gfx::Vector2dF& scroll_offset) OVERRIDE;
107 virtual void OnAnimationWaitingForDeletion() OVERRIDE;
108 virtual bool IsActive() const OVERRIDE;
110 // AnimationDelegate implementation.
111 virtual void NotifyAnimationStarted(
112 base::TimeTicks monotonic_time,
113 Animation::TargetProperty target_property) OVERRIDE{};
114 virtual void NotifyAnimationFinished(
115 base::TimeTicks monotonic_time,
116 Animation::TargetProperty target_property) OVERRIDE;
118 // Tree structure.
119 LayerImpl* parent() { return parent_; }
120 const LayerImpl* parent() const { return parent_; }
121 const OwnedLayerImplList& children() const { return children_; }
122 OwnedLayerImplList& children() { return children_; }
123 LayerImpl* child_at(size_t index) const { return children_[index]; }
124 void AddChild(scoped_ptr<LayerImpl> child);
125 scoped_ptr<LayerImpl> RemoveChild(LayerImpl* child);
126 void SetParent(LayerImpl* parent);
128 // Warning: This does not preserve tree structure invariants.
129 void ClearChildList();
131 bool HasAncestor(const LayerImpl* ancestor) const;
133 void SetScrollParent(LayerImpl* parent);
135 LayerImpl* scroll_parent() { return scroll_parent_; }
136 const LayerImpl* scroll_parent() const { return scroll_parent_; }
138 void SetScrollChildren(std::set<LayerImpl*>* children);
140 std::set<LayerImpl*>* scroll_children() { return scroll_children_.get(); }
141 const std::set<LayerImpl*>* scroll_children() const {
142 return scroll_children_.get();
145 void SetNumDescendantsThatDrawContent(int num_descendants);
146 void SetClipParent(LayerImpl* ancestor);
148 LayerImpl* clip_parent() {
149 return clip_parent_;
151 const LayerImpl* clip_parent() const {
152 return clip_parent_;
155 void SetClipChildren(std::set<LayerImpl*>* children);
157 std::set<LayerImpl*>* clip_children() { return clip_children_.get(); }
158 const std::set<LayerImpl*>* clip_children() const {
159 return clip_children_.get();
162 void PassCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests);
163 // Can only be called when the layer has a copy request.
164 void TakeCopyRequestsAndTransformToTarget(
165 ScopedPtrVector<CopyOutputRequest>* request);
166 bool HasCopyRequest() const { return !copy_requests_.empty(); }
168 void SetMaskLayer(scoped_ptr<LayerImpl> mask_layer);
169 LayerImpl* mask_layer() { return mask_layer_.get(); }
170 const LayerImpl* mask_layer() const { return mask_layer_.get(); }
171 scoped_ptr<LayerImpl> TakeMaskLayer();
173 void SetReplicaLayer(scoped_ptr<LayerImpl> replica_layer);
174 LayerImpl* replica_layer() { return replica_layer_.get(); }
175 const LayerImpl* replica_layer() const { return replica_layer_.get(); }
176 scoped_ptr<LayerImpl> TakeReplicaLayer();
178 bool has_mask() const { return mask_layer_; }
179 bool has_replica() const { return replica_layer_; }
180 bool replica_has_mask() const {
181 return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_);
184 LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; }
186 void PopulateSharedQuadState(SharedQuadState* state) const;
187 // WillDraw must be called before AppendQuads. If WillDraw returns false,
188 // AppendQuads and DidDraw will not be called. If WillDraw returns true,
189 // DidDraw is guaranteed to be called before another WillDraw or before
190 // the layer is destroyed. To enforce this, any class that overrides
191 // WillDraw/DidDraw must call the base class version only if WillDraw
192 // returns true.
193 virtual bool WillDraw(DrawMode draw_mode,
194 ResourceProvider* resource_provider);
195 virtual void AppendQuads(RenderPass* render_pass,
196 const OcclusionTracker<LayerImpl>& occlusion_tracker,
197 AppendQuadsData* append_quads_data) {}
198 virtual void DidDraw(ResourceProvider* resource_provider);
200 virtual ResourceProvider::ResourceId ContentsResourceId() const;
202 virtual bool HasDelegatedContent() const;
203 virtual bool HasContributingDelegatedRenderPasses() const;
204 virtual RenderPassId FirstContributingRenderPassId() const;
205 virtual RenderPassId NextContributingRenderPassId(RenderPassId id) const;
207 virtual void UpdateTiles(
208 const OcclusionTracker<LayerImpl>* occlusion_tracker) {}
209 virtual void NotifyTileStateChanged(const Tile* tile) {}
211 virtual ScrollbarLayerImplBase* ToScrollbarLayer();
213 // Returns true if this layer has content to draw.
214 void SetDrawsContent(bool draws_content);
215 bool DrawsContent() const { return draws_content_; }
217 int NumDescendantsThatDrawContent() const;
218 void SetHideLayerAndSubtree(bool hide);
219 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; }
221 bool force_render_surface() const { return force_render_surface_; }
222 void SetForceRenderSurface(bool force) { force_render_surface_ = force; }
224 void SetTransformOrigin(const gfx::Point3F& transform_origin);
225 gfx::Point3F transform_origin() const { return transform_origin_; }
227 void SetBackgroundColor(SkColor background_color);
228 SkColor background_color() const { return background_color_; }
229 // If contents_opaque(), return an opaque color else return a
230 // non-opaque color. Tries to return background_color(), if possible.
231 SkColor SafeOpaqueBackgroundColor() const;
233 void SetFilters(const FilterOperations& filters);
234 const FilterOperations& filters() const { return filters_; }
235 bool FilterIsAnimating() const;
236 bool FilterIsAnimatingOnImplOnly() const;
238 void SetBackgroundFilters(const FilterOperations& filters);
239 const FilterOperations& background_filters() const {
240 return background_filters_;
243 void SetMasksToBounds(bool masks_to_bounds);
244 bool masks_to_bounds() const { return masks_to_bounds_; }
246 void SetContentsOpaque(bool opaque);
247 bool contents_opaque() const { return contents_opaque_; }
249 void SetOpacity(float opacity);
250 float opacity() const { return opacity_; }
251 bool OpacityIsAnimating() const;
252 bool OpacityIsAnimatingOnImplOnly() const;
254 void SetBlendMode(SkXfermode::Mode);
255 SkXfermode::Mode blend_mode() const { return blend_mode_; }
256 bool uses_default_blend_mode() const {
257 return blend_mode_ == SkXfermode::kSrcOver_Mode;
260 void SetIsRootForIsolatedGroup(bool root);
261 bool is_root_for_isolated_group() const {
262 return is_root_for_isolated_group_;
265 void SetPosition(const gfx::PointF& position);
266 gfx::PointF position() const { return position_; }
268 void SetIsContainerForFixedPositionLayers(bool container) {
269 is_container_for_fixed_position_layers_ = container;
271 // This is a non-trivial function in Layer.
272 bool IsContainerForFixedPositionLayers() const {
273 return is_container_for_fixed_position_layers_;
276 gfx::Vector2dF FixedContainerSizeDelta() const;
278 void SetPositionConstraint(const LayerPositionConstraint& constraint) {
279 position_constraint_ = constraint;
281 const LayerPositionConstraint& position_constraint() const {
282 return position_constraint_;
285 void SetShouldFlattenTransform(bool flatten);
286 bool should_flatten_transform() const { return should_flatten_transform_; }
288 bool Is3dSorted() const { return sorting_context_id_ != 0; }
290 void SetUseParentBackfaceVisibility(bool use) {
291 use_parent_backface_visibility_ = use;
293 bool use_parent_backface_visibility() const {
294 return use_parent_backface_visibility_;
297 bool ShowDebugBorders() const;
299 // These invalidate the host's render surface layer list. The caller
300 // is responsible for calling set_needs_update_draw_properties on the tree
301 // so that its list can be recreated.
302 void CreateRenderSurface();
303 void ClearRenderSurface();
304 void ClearRenderSurfaceLayerList();
306 DrawProperties<LayerImpl>& draw_properties() {
307 return draw_properties_;
309 const DrawProperties<LayerImpl>& draw_properties() const {
310 return draw_properties_;
313 // The following are shortcut accessors to get various information from
314 // draw_properties_
315 const gfx::Transform& draw_transform() const {
316 return draw_properties_.target_space_transform;
318 const gfx::Transform& screen_space_transform() const {
319 return draw_properties_.screen_space_transform;
321 float draw_opacity() const { return draw_properties_.opacity; }
322 bool draw_opacity_is_animating() const {
323 return draw_properties_.opacity_is_animating;
325 bool draw_transform_is_animating() const {
326 return draw_properties_.target_space_transform_is_animating;
328 bool screen_space_transform_is_animating() const {
329 return draw_properties_.screen_space_transform_is_animating;
331 bool screen_space_opacity_is_animating() const {
332 return draw_properties_.screen_space_opacity_is_animating;
334 bool can_use_lcd_text() const { return draw_properties_.can_use_lcd_text; }
335 bool is_clipped() const { return draw_properties_.is_clipped; }
336 gfx::Rect clip_rect() const { return draw_properties_.clip_rect; }
337 gfx::Rect drawable_content_rect() const {
338 return draw_properties_.drawable_content_rect;
340 gfx::Rect visible_content_rect() const {
341 return draw_properties_.visible_content_rect;
343 LayerImpl* render_target() {
344 DCHECK(!draw_properties_.render_target ||
345 draw_properties_.render_target->render_surface());
346 return draw_properties_.render_target;
348 const LayerImpl* render_target() const {
349 DCHECK(!draw_properties_.render_target ||
350 draw_properties_.render_target->render_surface());
351 return draw_properties_.render_target;
353 RenderSurfaceImpl* render_surface() const {
354 return draw_properties_.render_surface.get();
356 int num_unclipped_descendants() const {
357 return draw_properties_.num_unclipped_descendants;
360 // The client should be responsible for setting bounds, content bounds and
361 // contents scale to appropriate values. LayerImpl doesn't calculate any of
362 // them from the other values.
364 void SetBounds(const gfx::Size& bounds);
365 gfx::Size bounds() const;
366 void SetBoundsDelta(const gfx::Vector2dF& bounds_delta);
367 gfx::Vector2dF bounds_delta() const { return bounds_delta_; }
369 void SetContentBounds(const gfx::Size& content_bounds);
370 gfx::Size content_bounds() const { return draw_properties_.content_bounds; }
372 float contents_scale_x() const { return draw_properties_.contents_scale_x; }
373 float contents_scale_y() const { return draw_properties_.contents_scale_y; }
374 void SetContentsScale(float contents_scale_x, float contents_scale_y);
376 void SetScrollOffsetDelegate(ScrollOffsetDelegate* scroll_offset_delegate);
377 bool IsExternalFlingActive() const;
379 void SetScrollOffset(const gfx::Vector2d& scroll_offset);
380 void SetScrollOffsetAndDelta(const gfx::Vector2d& scroll_offset,
381 const gfx::Vector2dF& scroll_delta);
382 gfx::Vector2d scroll_offset() const { return scroll_offset_; }
384 gfx::Vector2d MaxScrollOffset() const;
385 gfx::Vector2dF ClampScrollToMaxScrollOffset();
386 void SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
387 LayerImpl* scrollbar_clip_layer) const;
388 void SetScrollDelta(const gfx::Vector2dF& scroll_delta);
389 gfx::Vector2dF ScrollDelta() const;
391 gfx::Vector2dF TotalScrollOffset() const;
393 void SetSentScrollDelta(const gfx::Vector2d& sent_scroll_delta);
394 gfx::Vector2d sent_scroll_delta() const { return sent_scroll_delta_; }
396 // Returns the delta of the scroll that was outside of the bounds of the
397 // initial scroll
398 gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll);
400 void SetScrollClipLayer(int scroll_clip_layer_id);
401 LayerImpl* scroll_clip_layer() const { return scroll_clip_layer_; }
402 bool scrollable() const { return !!scroll_clip_layer_; }
404 void set_user_scrollable_horizontal(bool scrollable) {
405 user_scrollable_horizontal_ = scrollable;
407 void set_user_scrollable_vertical(bool scrollable) {
408 user_scrollable_vertical_ = scrollable;
411 void ApplySentScrollDeltasFromAbortedCommit();
412 void ApplyScrollDeltasSinceBeginMainFrame();
414 void SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) {
415 should_scroll_on_main_thread_ = should_scroll_on_main_thread;
417 bool should_scroll_on_main_thread() const {
418 return should_scroll_on_main_thread_;
421 void SetHaveWheelEventHandlers(bool have_wheel_event_handlers) {
422 have_wheel_event_handlers_ = have_wheel_event_handlers;
424 bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; }
426 void SetHaveScrollEventHandlers(bool have_scroll_event_handlers) {
427 have_scroll_event_handlers_ = have_scroll_event_handlers;
429 bool have_scroll_event_handlers() const {
430 return have_scroll_event_handlers_;
433 void SetNonFastScrollableRegion(const Region& region) {
434 non_fast_scrollable_region_ = region;
436 const Region& non_fast_scrollable_region() const {
437 return non_fast_scrollable_region_;
440 void SetTouchEventHandlerRegion(const Region& region) {
441 touch_event_handler_region_ = region;
443 const Region& touch_event_handler_region() const {
444 return touch_event_handler_region_;
447 void SetDrawCheckerboardForMissingTiles(bool checkerboard) {
448 draw_checkerboard_for_missing_tiles_ = checkerboard;
450 bool draw_checkerboard_for_missing_tiles() const {
451 return draw_checkerboard_for_missing_tiles_;
454 InputHandler::ScrollStatus TryScroll(
455 const gfx::PointF& screen_space_point,
456 InputHandler::ScrollInputType type) const;
458 void SetDoubleSided(bool double_sided);
459 bool double_sided() const { return double_sided_; }
461 void SetTransform(const gfx::Transform& transform);
462 const gfx::Transform& transform() const { return transform_; }
463 bool TransformIsAnimating() const;
464 bool TransformIsAnimatingOnImplOnly() const;
465 void SetTransformAndInvertibility(const gfx::Transform& transform,
466 bool transform_is_invertible);
467 bool transform_is_invertible() const { return transform_is_invertible_; }
469 // Note this rect is in layer space (not content space).
470 void SetUpdateRect(const gfx::RectF& update_rect);
472 const gfx::RectF& update_rect() const { return update_rect_; }
474 void AddDamageRect(const gfx::RectF& damage_rect);
476 const gfx::RectF& damage_rect() const { return damage_rect_; }
478 virtual base::DictionaryValue* LayerTreeAsJson() const;
480 void SetStackingOrderChanged(bool stacking_order_changed);
482 bool LayerPropertyChanged() const { return layer_property_changed_; }
484 void ResetAllChangeTrackingForSubtree();
486 LayerAnimationController* layer_animation_controller() {
487 return layer_animation_controller_.get();
490 const LayerAnimationController* layer_animation_controller() const {
491 return layer_animation_controller_.get();
494 virtual SimpleEnclosedRegion VisibleContentOpaqueRegion() const;
496 virtual void DidBecomeActive();
498 virtual void DidBeginTracing();
500 // Release resources held by this layer. Called when the output surface
501 // that rendered this layer was lost or a rendering mode switch has occured.
502 virtual void ReleaseResources();
504 ScrollbarAnimationController* scrollbar_animation_controller() const {
505 return scrollbar_animation_controller_.get();
508 typedef std::set<ScrollbarLayerImplBase*> ScrollbarSet;
509 ScrollbarSet* scrollbars() { return scrollbars_.get(); }
510 void ClearScrollbars();
511 void AddScrollbar(ScrollbarLayerImplBase* layer);
512 void RemoveScrollbar(ScrollbarLayerImplBase* layer);
513 bool HasScrollbar(ScrollbarOrientation orientation) const;
514 void ScrollbarParametersDidChange();
515 int clip_height() {
516 return scroll_clip_layer_ ? scroll_clip_layer_->bounds().height() : 0;
519 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const;
521 virtual skia::RefPtr<SkPicture> GetPicture();
523 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl);
524 virtual void PushPropertiesTo(LayerImpl* layer);
526 virtual void GetAllTilesForTracing(std::set<const Tile*>* tiles) const;
527 virtual void AsValueInto(base::debug::TracedValue* dict) const;
529 virtual size_t GPUMemoryUsageInBytes() const;
531 void SetNeedsPushProperties();
532 void AddDependentNeedsPushProperties();
533 void RemoveDependentNeedsPushProperties();
534 bool parent_should_know_need_push_properties() const {
535 return needs_push_properties() || descendant_needs_push_properties();
538 bool needs_push_properties() const { return needs_push_properties_; }
539 bool descendant_needs_push_properties() const {
540 return num_dependents_need_push_properties_ > 0;
543 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark);
545 virtual void SetDebugInfo(
546 scoped_refptr<base::debug::ConvertableToTraceFormat> other);
548 bool IsDrawnRenderSurfaceLayerListMember() const;
550 void Set3dSortingContextId(int id);
551 int sorting_context_id() { return sorting_context_id_; }
553 protected:
554 LayerImpl(LayerTreeImpl* layer_impl, int id);
556 // Get the color and size of the layer's debug border.
557 virtual void GetDebugBorderProperties(SkColor* color, float* width) const;
559 void AppendDebugBorderQuad(RenderPass* render_pass,
560 const gfx::Size& content_bounds,
561 const SharedQuadState* shared_quad_state,
562 AppendQuadsData* append_quads_data) const;
563 void AppendDebugBorderQuad(RenderPass* render_pass,
564 const gfx::Size& content_bounds,
565 const SharedQuadState* shared_quad_state,
566 AppendQuadsData* append_quads_data,
567 SkColor color,
568 float width) const;
570 void NoteLayerPropertyChanged();
571 void NoteLayerPropertyChangedForSubtree();
573 // Note carefully this does not affect the current layer.
574 void NoteLayerPropertyChangedForDescendants();
576 private:
577 void NoteLayerPropertyChangedForDescendantsInternal();
579 virtual const char* LayerTypeAsString() const;
581 // Properties internal to LayerImpl
582 LayerImpl* parent_;
583 OwnedLayerImplList children_;
585 LayerImpl* scroll_parent_;
587 // Storing a pointer to a set rather than a set since this will be rarely
588 // used. If this pointer turns out to be too heavy, we could have this (and
589 // the scroll parent above) be stored in a LayerImpl -> scroll_info
590 // map somewhere.
591 scoped_ptr<std::set<LayerImpl*> > scroll_children_;
593 LayerImpl* clip_parent_;
594 scoped_ptr<std::set<LayerImpl*> > clip_children_;
596 // mask_layer_ can be temporarily stolen during tree sync, we need this ID to
597 // confirm newly assigned layer is still the previous one
598 int mask_layer_id_;
599 scoped_ptr<LayerImpl> mask_layer_;
600 int replica_layer_id_; // ditto
601 scoped_ptr<LayerImpl> replica_layer_;
602 int layer_id_;
603 LayerTreeImpl* layer_tree_impl_;
605 // Properties synchronized from the associated Layer.
606 gfx::Point3F transform_origin_;
607 gfx::Size bounds_;
608 gfx::Vector2dF bounds_delta_;
609 gfx::Vector2d scroll_offset_;
610 ScrollOffsetDelegate* scroll_offset_delegate_;
611 LayerImpl* scroll_clip_layer_;
612 bool scrollable_ : 1;
613 bool should_scroll_on_main_thread_ : 1;
614 bool have_wheel_event_handlers_ : 1;
615 bool have_scroll_event_handlers_ : 1;
616 bool user_scrollable_horizontal_ : 1;
617 bool user_scrollable_vertical_ : 1;
618 bool stacking_order_changed_ : 1;
619 // Whether the "back" of this layer should draw.
620 bool double_sided_ : 1;
621 bool should_flatten_transform_ : 1;
623 // Tracks if drawing-related properties have changed since last redraw.
624 bool layer_property_changed_ : 1;
626 bool masks_to_bounds_ : 1;
627 bool contents_opaque_ : 1;
628 bool is_root_for_isolated_group_ : 1;
629 bool use_parent_backface_visibility_ : 1;
630 bool draw_checkerboard_for_missing_tiles_ : 1;
631 bool draws_content_ : 1;
632 bool hide_layer_and_subtree_ : 1;
633 bool force_render_surface_ : 1;
635 // Cache transform_'s invertibility.
636 bool transform_is_invertible_ : 1;
638 // Set for the layer that other layers are fixed to.
639 bool is_container_for_fixed_position_layers_ : 1;
640 Region non_fast_scrollable_region_;
641 Region touch_event_handler_region_;
642 SkColor background_color_;
644 float opacity_;
645 SkXfermode::Mode blend_mode_;
646 gfx::PointF position_;
647 gfx::Transform transform_;
649 LayerPositionConstraint position_constraint_;
651 gfx::Vector2dF scroll_delta_;
652 gfx::Vector2d sent_scroll_delta_;
653 gfx::Vector2dF last_scroll_offset_;
655 int num_descendants_that_draw_content_;
657 // The global depth value of the center of the layer. This value is used
658 // to sort layers from back to front.
659 float draw_depth_;
661 FilterOperations filters_;
662 FilterOperations background_filters_;
664 protected:
665 friend class TreeSynchronizer;
667 // This flag is set when the layer needs to push properties to the active
668 // side.
669 bool needs_push_properties_;
671 // The number of direct children or dependent layers that need to be recursed
672 // to in order for them or a descendent of them to push properties to the
673 // active side.
674 int num_dependents_need_push_properties_;
676 // Layers that share a sorting context id will be sorted together in 3d
677 // space. 0 is a special value that means this layer will not be sorted and
678 // will be drawn in paint order.
679 int sorting_context_id_;
681 DrawMode current_draw_mode_;
683 private:
684 // Rect indicating what was repainted/updated during update.
685 // Note that plugin layers bypass this and leave it empty.
686 // Uses layer (not content) space.
687 gfx::RectF update_rect_;
689 // This rect is in layer space.
690 gfx::RectF damage_rect_;
692 // Manages animations for this layer.
693 scoped_refptr<LayerAnimationController> layer_animation_controller_;
695 // Manages scrollbars for this layer
696 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_;
698 scoped_ptr<ScrollbarSet> scrollbars_;
700 ScopedPtrVector<CopyOutputRequest> copy_requests_;
702 // Group of properties that need to be computed based on the layer tree
703 // hierarchy before layers can be drawn.
704 DrawProperties<LayerImpl> draw_properties_;
706 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_;
708 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
711 } // namespace cc
713 #endif // CC_LAYERS_LAYER_IMPL_H_