Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: ui/gfx/compositor/compositor.h

Issue 7770002: gfx::Compositor: SchedulePaint. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix aura, win compile Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 virtual void Draw(const ui::TextureDrawParams& params, 56 virtual void Draw(const ui::TextureDrawParams& params,
57 const gfx::Rect& clip_bounds_in_texture) = 0; 57 const gfx::Rect& clip_bounds_in_texture) = 0;
58 58
59 protected: 59 protected:
60 virtual ~Texture() {} 60 virtual ~Texture() {}
61 61
62 private: 62 private:
63 friend class base::RefCounted<Texture>; 63 friend class base::RefCounted<Texture>;
64 }; 64 };
65 65
66 // An interface to allow the compositor to communicate with its owner.
67 class COMPOSITOR_EXPORT CompositorDelegate {
68 public:
69 // Requests the owner to schedule a paint.
70 virtual void ScheduleCompositorPaint() = 0;
71 };
72
66 // Compositor object to take care of GPU painting. 73 // Compositor object to take care of GPU painting.
67 // A Browser compositor object is responsible for generating the final 74 // A Browser compositor object is responsible for generating the final
68 // displayable form of pixels comprising a single widget's contents. It draws an 75 // 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 76 // appropriately transformed texture for each transformed view in the widget's
70 // view hierarchy. 77 // view hierarchy.
71 class COMPOSITOR_EXPORT Compositor : public base::RefCounted<Compositor> { 78 class COMPOSITOR_EXPORT Compositor : public base::RefCounted<Compositor> {
72 public: 79 public:
73 // Create a compositor from the provided handle. 80 // Create a compositor from the provided handle.
74 static Compositor* Create(gfx::AcceleratedWidget widget, 81 static Compositor* Create(CompositorDelegate* delegate,
82 gfx::AcceleratedWidget widget,
75 const gfx::Size& size); 83 const gfx::Size& size);
76 84
77 // Creates a new texture. The caller owns the returned object. 85 // Creates a new texture. The caller owns the returned object.
78 virtual Texture* CreateTexture() = 0; 86 virtual Texture* CreateTexture() = 0;
79 87
80 // Notifies the compositor that compositing is about to start. 88 // Notifies the compositor that compositing is about to start.
81 virtual void NotifyStart() = 0; 89 virtual void NotifyStart() = 0;
82 90
83 // Notifies the compositor that compositing is complete. 91 // Notifies the compositor that compositing is complete.
84 virtual void NotifyEnd() = 0; 92 virtual void NotifyEnd() = 0;
85 93
86 // Blurs the specific region in the compositor. 94 // Blurs the specific region in the compositor.
87 virtual void Blur(const gfx::Rect& bounds) = 0; 95 virtual void Blur(const gfx::Rect& bounds) = 0;
88 96
89 // Schedules a paint on the widget this Compositor was created for. 97 // Schedules a paint on the widget this Compositor was created for.
90 virtual void SchedulePaint() = 0; 98 virtual void SchedulePaint() = 0;
91 99
92 // Notifies the compositor that the size of the widget that it is 100 // Notifies the compositor that the size of the widget that it is
93 // drawing to has changed. 101 // drawing to has changed.
94 void WidgetSizeChanged(const gfx::Size& size) { 102 void WidgetSizeChanged(const gfx::Size& size) {
95 size_ = size; 103 size_ = size;
96 OnWidgetSizeChanged(); 104 OnWidgetSizeChanged();
97 } 105 }
98 106
99 // Returns the size of the widget that is being drawn to. 107 // Returns the size of the widget that is being drawn to.
100 const gfx::Size& size() { return size_; } 108 const gfx::Size& size() { return size_; }
101 109
102 protected: 110 protected:
103 explicit Compositor(const gfx::Size& size) : size_(size) {} 111 Compositor(CompositorDelegate* delegate, const gfx::Size& size)
112 : delegate_(delegate),
113 size_(size) {}
104 virtual ~Compositor() {} 114 virtual ~Compositor() {}
105 115
106 virtual void OnWidgetSizeChanged() = 0; 116 virtual void OnWidgetSizeChanged() = 0;
107 117
118 CompositorDelegate* delegate() { return delegate_; }
119
108 private: 120 private:
121 CompositorDelegate* delegate_;
109 gfx::Size size_; 122 gfx::Size size_;
110 123
111 friend class base::RefCounted<Compositor>; 124 friend class base::RefCounted<Compositor>;
112 }; 125 };
113 126
114 } // namespace ui 127 } // namespace ui
115 128
116 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ 129 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698