Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GFX_COMPOSITOR_COMPOSITOR_H_ | 5 #ifndef UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
| 6 #define UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 6 #define UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "ui/gfx/compositor/compositor_export.h" | 10 #include "ui/gfx/compositor/compositor_export.h" |
| 11 #include "ui/gfx/transform.h" | 11 #include "ui/gfx/transform.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/gfx/size.h" | |
| 13 | 14 |
| 14 class SkCanvas; | 15 class SkCanvas; |
| 15 namespace gfx { | 16 namespace gfx { |
| 16 class Point; | 17 class Point; |
| 17 class Rect; | 18 class Rect; |
| 18 class Size; | |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace ui { | 21 namespace ui { |
| 22 | 22 |
| 23 struct TextureDrawParams { | 23 struct TextureDrawParams { |
| 24 TextureDrawParams() : transform(), blend(false) {} | 24 TextureDrawParams() : transform(), blend(false) {} |
| 25 | 25 |
| 26 // The transform to be applied to the texture. | 26 // The transform to be applied to the texture. |
| 27 ui::Transform transform; | 27 ui::Transform transform; |
| 28 | 28 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 43 // Views own the Texture. | 43 // Views own the Texture. |
| 44 class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { | 44 class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { |
| 45 public: | 45 public: |
| 46 // Sets the canvas of this texture. The origin is at |origin|. | 46 // Sets the canvas of this texture. The origin is at |origin|. |
| 47 // |overall_size| gives the total size of texture. | 47 // |overall_size| gives the total size of texture. |
| 48 virtual void SetCanvas(const SkCanvas& canvas, | 48 virtual void SetCanvas(const SkCanvas& canvas, |
| 49 const gfx::Point& origin, | 49 const gfx::Point& origin, |
| 50 const gfx::Size& overall_size) = 0; | 50 const gfx::Size& overall_size) = 0; |
| 51 | 51 |
| 52 // Draws the texture. | 52 // Draws the texture. |
| 53 virtual void Draw(const ui::TextureDrawParams& params) = 0; | 53 virtual void Draw(const ui::TextureDrawParams& params, |
| 54 const gfx::Size& surface_size) = 0; | |
|
sky
2011/08/24 21:17:08
Move this into TextureDrawParams. I think the name
jonathan.backer
2011/08/25 18:57:18
Done.
| |
| 54 | 55 |
| 55 // Draws the portion of the texture contained within clip_bounds | 56 // Draws the portion of the texture contained within clip_bounds |
| 56 virtual void Draw(const ui::TextureDrawParams& params, | 57 virtual void Draw(const ui::TextureDrawParams& params, |
| 57 const gfx::Rect& clip_bounds_in_texture) = 0; | 58 const gfx::Rect& clip_bounds_in_texture, |
| 59 const gfx::Size& surface_size) = 0; | |
| 58 | 60 |
| 59 protected: | 61 protected: |
| 60 virtual ~Texture() {} | 62 virtual ~Texture() {} |
| 61 | 63 |
| 62 private: | 64 private: |
| 63 friend class base::RefCounted<Texture>; | 65 friend class base::RefCounted<Texture>; |
| 64 }; | 66 }; |
| 65 | 67 |
| 66 // Compositor object to take care of GPU painting. | 68 // Compositor object to take care of GPU painting. |
| 67 // A Browser compositor object is responsible for generating the final | 69 // A Browser compositor object is responsible for generating the final |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 84 virtual void NotifyEnd() = 0; | 86 virtual void NotifyEnd() = 0; |
| 85 | 87 |
| 86 // Blurs the specific region in the compositor. | 88 // Blurs the specific region in the compositor. |
| 87 virtual void Blur(const gfx::Rect& bounds) = 0; | 89 virtual void Blur(const gfx::Rect& bounds) = 0; |
| 88 | 90 |
| 89 // Schedules a paint on the widget this Compositor was created for. | 91 // Schedules a paint on the widget this Compositor was created for. |
| 90 virtual void SchedulePaint() = 0; | 92 virtual void SchedulePaint() = 0; |
| 91 | 93 |
| 92 // Notifies the compositor that the size of the widget that it is | 94 // Notifies the compositor that the size of the widget that it is |
| 93 // drawing to has changed. | 95 // drawing to has changed. |
| 94 virtual void OnWidgetSizeChanged(const gfx::Size& size) = 0; | 96 virtual void OnWidgetSizeChanged(const gfx::Size& size) = 0; |
|
sky
2011/08/24 21:17:08
Rename this to WidgetSizeChanged, make it concrete
jonathan.backer
2011/08/25 18:57:18
Done.
| |
| 95 | 97 |
| 98 // Returns the size of the widget that is being drawn to. | |
| 99 const gfx::Size& size() { return size_; } | |
| 100 | |
| 96 protected: | 101 protected: |
| 102 explicit Compositor(const gfx::Size& size) : size_(size) {} | |
| 97 virtual ~Compositor() {} | 103 virtual ~Compositor() {} |
| 98 | 104 |
| 105 void SetSize(const gfx::Size& size) { size_ = size; } | |
|
sky
2011/08/24 21:17:08
Is this needed?
jonathan.backer
2011/08/25 18:57:18
Done.
| |
| 106 | |
| 99 private: | 107 private: |
| 108 gfx::Size size_; | |
| 109 | |
| 100 friend class base::RefCounted<Compositor>; | 110 friend class base::RefCounted<Compositor>; |
| 101 }; | 111 }; |
| 102 | 112 |
| 103 } // namespace ui | 113 } // namespace ui |
| 104 | 114 |
| 105 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 115 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
| OLD | NEW |