OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_COMPOSITOR_LAYER_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_H_ |
6 #define UI_COMPOSITOR_LAYER_H_ | 6 #define UI_COMPOSITOR_LAYER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 // delegated frame. | 320 // delegated frame. |
321 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip); | 321 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip); |
322 | 322 |
323 // Requets a copy of the layer's output as a texture or bitmap. | 323 // Requets a copy of the layer's output as a texture or bitmap. |
324 void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request); | 324 void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request); |
325 | 325 |
326 // ContentLayerClient | 326 // ContentLayerClient |
327 virtual void PaintContents( | 327 virtual void PaintContents( |
328 SkCanvas* canvas, | 328 SkCanvas* canvas, |
329 const gfx::Rect& clip, | 329 const gfx::Rect& clip, |
330 ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE; | 330 ContentLayerClient::GraphicsContextStatus gc_status) override; |
331 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} | 331 virtual void DidChangeLayerCanUseLCDText() override {} |
332 virtual bool FillsBoundsCompletely() const OVERRIDE; | 332 virtual bool FillsBoundsCompletely() const override; |
333 | 333 |
334 cc::Layer* cc_layer() { return cc_layer_; } | 334 cc::Layer* cc_layer() { return cc_layer_; } |
335 | 335 |
336 // TextureLayerClient | 336 // TextureLayerClient |
337 virtual bool PrepareTextureMailbox( | 337 virtual bool PrepareTextureMailbox( |
338 cc::TextureMailbox* mailbox, | 338 cc::TextureMailbox* mailbox, |
339 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 339 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
340 bool use_shared_memory) OVERRIDE; | 340 bool use_shared_memory) override; |
341 | 341 |
342 float device_scale_factor() const { return device_scale_factor_; } | 342 float device_scale_factor() const { return device_scale_factor_; } |
343 | 343 |
344 // Forces a render surface to be used on this layer. This has no positive | 344 // Forces a render surface to be used on this layer. This has no positive |
345 // impact, and is only used for benchmarking/testing purpose. | 345 // impact, and is only used for benchmarking/testing purpose. |
346 void SetForceRenderSurface(bool force); | 346 void SetForceRenderSurface(bool force); |
347 bool force_render_surface() const { return force_render_surface_; } | 347 bool force_render_surface() const { return force_render_surface_; } |
348 | 348 |
349 // LayerClient | 349 // LayerClient |
350 virtual scoped_refptr<base::debug::ConvertableToTraceFormat> | 350 virtual scoped_refptr<base::debug::ConvertableToTraceFormat> |
351 TakeDebugInfo() OVERRIDE; | 351 TakeDebugInfo() override; |
352 | 352 |
353 // LayerAnimationEventObserver | 353 // LayerAnimationEventObserver |
354 virtual void OnAnimationStarted(const cc::AnimationEvent& event) OVERRIDE; | 354 virtual void OnAnimationStarted(const cc::AnimationEvent& event) override; |
355 | 355 |
356 // Whether this layer has animations waiting to get sent to its cc::Layer. | 356 // Whether this layer has animations waiting to get sent to its cc::Layer. |
357 bool HasPendingThreadedAnimations() { | 357 bool HasPendingThreadedAnimations() { |
358 return pending_threaded_animations_.size() != 0; | 358 return pending_threaded_animations_.size() != 0; |
359 } | 359 } |
360 | 360 |
361 // Triggers a call to SwitchToLayer. | 361 // Triggers a call to SwitchToLayer. |
362 void SwitchCCLayerForTest(); | 362 void SwitchCCLayerForTest(); |
363 | 363 |
364 private: | 364 private: |
365 friend class LayerOwner; | 365 friend class LayerOwner; |
366 | 366 |
367 void CollectAnimators(std::vector<scoped_refptr<LayerAnimator> >* animators); | 367 void CollectAnimators(std::vector<scoped_refptr<LayerAnimator> >* animators); |
368 | 368 |
369 // Stacks |child| above or below |other|. Helper method for StackAbove() and | 369 // Stacks |child| above or below |other|. Helper method for StackAbove() and |
370 // StackBelow(). | 370 // StackBelow(). |
371 void StackRelativeTo(Layer* child, Layer* other, bool above); | 371 void StackRelativeTo(Layer* child, Layer* other, bool above); |
372 | 372 |
373 bool ConvertPointForAncestor(const Layer* ancestor, gfx::Point* point) const; | 373 bool ConvertPointForAncestor(const Layer* ancestor, gfx::Point* point) const; |
374 bool ConvertPointFromAncestor(const Layer* ancestor, gfx::Point* point) const; | 374 bool ConvertPointFromAncestor(const Layer* ancestor, gfx::Point* point) const; |
375 | 375 |
376 // Implementation of LayerAnimatorDelegate | 376 // Implementation of LayerAnimatorDelegate |
377 virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE; | 377 virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) override; |
378 virtual void SetTransformFromAnimation( | 378 virtual void SetTransformFromAnimation( |
379 const gfx::Transform& transform) OVERRIDE; | 379 const gfx::Transform& transform) override; |
380 virtual void SetOpacityFromAnimation(float opacity) OVERRIDE; | 380 virtual void SetOpacityFromAnimation(float opacity) override; |
381 virtual void SetVisibilityFromAnimation(bool visibility) OVERRIDE; | 381 virtual void SetVisibilityFromAnimation(bool visibility) override; |
382 virtual void SetBrightnessFromAnimation(float brightness) OVERRIDE; | 382 virtual void SetBrightnessFromAnimation(float brightness) override; |
383 virtual void SetGrayscaleFromAnimation(float grayscale) OVERRIDE; | 383 virtual void SetGrayscaleFromAnimation(float grayscale) override; |
384 virtual void SetColorFromAnimation(SkColor color) OVERRIDE; | 384 virtual void SetColorFromAnimation(SkColor color) override; |
385 virtual void ScheduleDrawForAnimation() OVERRIDE; | 385 virtual void ScheduleDrawForAnimation() override; |
386 virtual const gfx::Rect& GetBoundsForAnimation() const OVERRIDE; | 386 virtual const gfx::Rect& GetBoundsForAnimation() const override; |
387 virtual gfx::Transform GetTransformForAnimation() const OVERRIDE; | 387 virtual gfx::Transform GetTransformForAnimation() const override; |
388 virtual float GetOpacityForAnimation() const OVERRIDE; | 388 virtual float GetOpacityForAnimation() const override; |
389 virtual bool GetVisibilityForAnimation() const OVERRIDE; | 389 virtual bool GetVisibilityForAnimation() const override; |
390 virtual float GetBrightnessForAnimation() const OVERRIDE; | 390 virtual float GetBrightnessForAnimation() const override; |
391 virtual float GetGrayscaleForAnimation() const OVERRIDE; | 391 virtual float GetGrayscaleForAnimation() const override; |
392 virtual SkColor GetColorForAnimation() const OVERRIDE; | 392 virtual SkColor GetColorForAnimation() const override; |
393 virtual float GetDeviceScaleFactor() const OVERRIDE; | 393 virtual float GetDeviceScaleFactor() const override; |
394 virtual void AddThreadedAnimation( | 394 virtual void AddThreadedAnimation( |
395 scoped_ptr<cc::Animation> animation) OVERRIDE; | 395 scoped_ptr<cc::Animation> animation) override; |
396 virtual void RemoveThreadedAnimation(int animation_id) OVERRIDE; | 396 virtual void RemoveThreadedAnimation(int animation_id) override; |
397 virtual LayerAnimatorCollection* GetLayerAnimatorCollection() OVERRIDE; | 397 virtual LayerAnimatorCollection* GetLayerAnimatorCollection() override; |
398 | 398 |
399 // Creates a corresponding composited layer for |type_|. | 399 // Creates a corresponding composited layer for |type_|. |
400 void CreateWebLayer(); | 400 void CreateWebLayer(); |
401 | 401 |
402 // Recomputes and sets to |cc_layer_|. | 402 // Recomputes and sets to |cc_layer_|. |
403 void RecomputeDrawsContentAndUVRect(); | 403 void RecomputeDrawsContentAndUVRect(); |
404 void RecomputePosition(); | 404 void RecomputePosition(); |
405 | 405 |
406 // Set all filters which got applied to the layer. | 406 // Set all filters which got applied to the layer. |
407 void SetLayerFilters(); | 407 void SetLayerFilters(); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 // The size of the frame or texture in DIP, set when SetShowDelegatedContent | 509 // The size of the frame or texture in DIP, set when SetShowDelegatedContent |
510 // or SetTextureMailbox was called. | 510 // or SetTextureMailbox was called. |
511 gfx::Size frame_size_in_dip_; | 511 gfx::Size frame_size_in_dip_; |
512 | 512 |
513 DISALLOW_COPY_AND_ASSIGN(Layer); | 513 DISALLOW_COPY_AND_ASSIGN(Layer); |
514 }; | 514 }; |
515 | 515 |
516 } // namespace ui | 516 } // namespace ui |
517 | 517 |
518 #endif // UI_COMPOSITOR_LAYER_H_ | 518 #endif // UI_COMPOSITOR_LAYER_H_ |
OLD | NEW |