| 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" | |
| 11 #include "ui/gfx/transform.h" | 10 #include "ui/gfx/transform.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 13 | 12 |
| 14 class SkCanvas; | 13 class SkCanvas; |
| 15 namespace gfx { | 14 namespace gfx { |
| 16 class Point; | 15 class Point; |
| 17 class Rect; | 16 class Rect; |
| 18 class Size; | 17 class Size; |
| 19 } | 18 } |
| 20 | 19 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 34 }; | 33 }; |
| 35 | 34 |
| 36 // Textures are created by a Compositor for managing an accelerated view. | 35 // Textures are created by a Compositor for managing an accelerated view. |
| 37 // Any time a View with a texture needs to redraw itself it invokes SetCanvas(). | 36 // Any time a View with a texture needs to redraw itself it invokes SetCanvas(). |
| 38 // When the view is ready to be drawn Draw() is invoked. | 37 // When the view is ready to be drawn Draw() is invoked. |
| 39 // | 38 // |
| 40 // Texture is really a proxy to the gpu. Texture does not itself keep a copy of | 39 // Texture is really a proxy to the gpu. Texture does not itself keep a copy of |
| 41 // the bitmap. | 40 // the bitmap. |
| 42 // | 41 // |
| 43 // Views own the Texture. | 42 // Views own the Texture. |
| 44 class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { | 43 class Texture : public base::RefCounted<Texture> { |
| 45 public: | 44 public: |
| 46 // Sets the canvas of this texture. The origin is at |origin|. | 45 // Sets the canvas of this texture. The origin is at |origin|. |
| 47 // |overall_size| gives the total size of texture. | 46 // |overall_size| gives the total size of texture. |
| 48 virtual void SetCanvas(const SkCanvas& canvas, | 47 virtual void SetCanvas(const SkCanvas& canvas, |
| 49 const gfx::Point& origin, | 48 const gfx::Point& origin, |
| 50 const gfx::Size& overall_size) = 0; | 49 const gfx::Size& overall_size) = 0; |
| 51 | 50 |
| 52 // Draws the texture. | 51 // Draws the texture. |
| 53 virtual void Draw(const ui::TextureDrawParams& params) = 0; | 52 virtual void Draw(const ui::TextureDrawParams& params) = 0; |
| 54 | 53 |
| 55 // Draws the portion of the texture contained within clip_bounds | 54 // Draws the portion of the texture contained within clip_bounds |
| 56 virtual void Draw(const ui::TextureDrawParams& params, | 55 virtual void Draw(const ui::TextureDrawParams& params, |
| 57 const gfx::Rect& clip_bounds_in_texture) = 0; | 56 const gfx::Rect& clip_bounds_in_texture) = 0; |
| 58 | 57 |
| 59 protected: | 58 protected: |
| 60 virtual ~Texture() {} | 59 virtual ~Texture() {} |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 friend class base::RefCounted<Texture>; | 62 friend class base::RefCounted<Texture>; |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 // Compositor object to take care of GPU painting. | 65 // Compositor object to take care of GPU painting. |
| 67 // A Browser compositor object is responsible for generating the final | 66 // A Browser compositor object is responsible for generating the final |
| 68 // displayable form of pixels comprising a single widget's contents. It draws an | 67 // displayable form of pixels comprising a single widget's contents. It draws an |
| 69 // appropriately transformed texture for each transformed view in the widget's | 68 // appropriately transformed texture for each transformed view in the widget's |
| 70 // view hierarchy. | 69 // view hierarchy. |
| 71 class COMPOSITOR_EXPORT Compositor : public base::RefCounted<Compositor> { | 70 class Compositor : public base::RefCounted<Compositor> { |
| 72 public: | 71 public: |
| 73 // Create a compositor from the provided handle. | 72 // Create a compositor from the provided handle. |
| 74 static Compositor* Create(gfx::AcceleratedWidget widget, | 73 static Compositor* Create(gfx::AcceleratedWidget widget, |
| 75 const gfx::Size& size); | 74 const gfx::Size& size); |
| 76 | 75 |
| 77 // Creates a new texture. The caller owns the returned object. | 76 // Creates a new texture. The caller owns the returned object. |
| 78 virtual Texture* CreateTexture() = 0; | 77 virtual Texture* CreateTexture() = 0; |
| 79 | 78 |
| 80 // Notifies the compositor that compositing is about to start. | 79 // Notifies the compositor that compositing is about to start. |
| 81 virtual void NotifyStart() = 0; | 80 virtual void NotifyStart() = 0; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 96 protected: | 95 protected: |
| 97 virtual ~Compositor() {} | 96 virtual ~Compositor() {} |
| 98 | 97 |
| 99 private: | 98 private: |
| 100 friend class base::RefCounted<Compositor>; | 99 friend class base::RefCounted<Compositor>; |
| 101 }; | 100 }; |
| 102 | 101 |
| 103 } // namespace ui | 102 } // namespace ui |
| 104 | 103 |
| 105 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 104 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
| OLD | NEW |