| 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_DELEGATE_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_DELEGATE_H_ |
| 6 #define UI_COMPOSITOR_LAYER_DELEGATE_H_ | 6 #define UI_COMPOSITOR_LAYER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "ui/compositor/compositor_export.h" | 8 #include "ui/compositor/compositor_export.h" |
| 9 | 9 |
| 10 namespace gfx { | 10 namespace gfx { |
| 11 class Canvas; | |
| 12 class Rect; | 11 class Rect; |
| 13 } | 12 } |
| 14 | 13 |
| 15 namespace ui { | 14 namespace ui { |
| 16 class PaintContext; | 15 class PaintContext; |
| 17 | 16 |
| 18 // A delegate interface implemented by an object that renders to a Layer. | 17 // A delegate interface implemented by an object that renders to a Layer. |
| 19 class COMPOSITOR_EXPORT LayerDelegate { | 18 class COMPOSITOR_EXPORT LayerDelegate { |
| 20 public: | 19 public: |
| 21 // Paint content for the layer to the specified context. | 20 // Paint content for the layer to the specified context. |
| 22 virtual void OnPaintLayer(const PaintContext& context) = 0; | 21 virtual void OnPaintLayer(const PaintContext& context) = 0; |
| 23 | 22 |
| 24 // A notification that this layer has had a delegated frame swap and | 23 // A notification that this layer has had a delegated frame swap and |
| 25 // will be repainted. | 24 // will be repainted. |
| 26 virtual void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) = 0; | 25 virtual void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) = 0; |
| 27 | 26 |
| 28 // Called when the layer's device scale factor has changed. | 27 // Called when the layer's device scale factor has changed. |
| 29 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; | 28 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; |
| 30 | 29 |
| 31 // Invoked when the bounds have changed. | 30 // Invoked when the bounds have changed. |
| 32 virtual void OnLayerBoundsChanged(const gfx::Rect& old_bounds); | 31 virtual void OnLayerBoundsChanged(const gfx::Rect& old_bounds); |
| 33 | 32 |
| 34 protected: | 33 protected: |
| 35 virtual ~LayerDelegate() {} | 34 virtual ~LayerDelegate() {} |
| 36 }; | 35 }; |
| 37 | 36 |
| 38 } // namespace ui | 37 } // namespace ui |
| 39 | 38 |
| 40 #endif // UI_COMPOSITOR_LAYER_DELEGATE_H_ | 39 #endif // UI_COMPOSITOR_LAYER_DELEGATE_H_ |
| OLD | NEW |