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

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: . 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
« no previous file with comments | « aura/window_unittest.cc ('k') | ui/gfx/compositor/compositor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
99 delegate_->ScheduleCompositorPaint();
100 }
91 101
92 // Notifies the compositor that the size of the widget that it is 102 // Notifies the compositor that the size of the widget that it is
93 // drawing to has changed. 103 // drawing to has changed.
94 void WidgetSizeChanged(const gfx::Size& size) { 104 void WidgetSizeChanged(const gfx::Size& size) {
95 size_ = size; 105 size_ = size;
96 OnWidgetSizeChanged(); 106 OnWidgetSizeChanged();
97 } 107 }
98 108
99 // Returns the size of the widget that is being drawn to. 109 // Returns the size of the widget that is being drawn to.
100 const gfx::Size& size() { return size_; } 110 const gfx::Size& size() { return size_; }
101 111
102 protected: 112 protected:
103 explicit Compositor(const gfx::Size& size) : size_(size) {} 113 Compositor(CompositorDelegate* delegate, const gfx::Size& size)
114 : delegate_(delegate),
115 size_(size) {}
104 virtual ~Compositor() {} 116 virtual ~Compositor() {}
105 117
106 virtual void OnWidgetSizeChanged() = 0; 118 virtual void OnWidgetSizeChanged() = 0;
107 119
120 CompositorDelegate* delegate() { return delegate_; }
121
108 private: 122 private:
123 CompositorDelegate* delegate_;
109 gfx::Size size_; 124 gfx::Size size_;
110 125
111 friend class base::RefCounted<Compositor>; 126 friend class base::RefCounted<Compositor>;
112 }; 127 };
113 128
114 } // namespace ui 129 } // namespace ui
115 130
116 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ 131 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « aura/window_unittest.cc ('k') | ui/gfx/compositor/compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698