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

Side by Side Diff: ui/surface/accelerated_surface_win.h

Issue 10829054: Support copying a partial rectangle region from the compositing surface on Win. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comment Created 8 years, 4 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) 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_SURFACE_ACCELERATED_SURFACE_WIN_H_ 5 #ifndef UI_SURFACE_ACCELERATED_SURFACE_WIN_H_
6 #define UI_SURFACE_ACCELERATED_SURFACE_WIN_H_ 6 #define UI_SURFACE_ACCELERATED_SURFACE_WIN_H_
7 7
8 #include <d3d9.h> 8 #include <d3d9.h>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/win/scoped_comptr.h" 14 #include "base/win/scoped_comptr.h"
15 #include "ui/gfx/native_widget_types.h" 15 #include "ui/gfx/native_widget_types.h"
16 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
17 #include "ui/surface/surface_export.h" 17 #include "ui/surface/surface_export.h"
18 18
19 class PresentThread; 19 class PresentThread;
20 20
21 namespace gfx {
22 class Rect;
23 }
24
21 class SURFACE_EXPORT AcceleratedPresenter 25 class SURFACE_EXPORT AcceleratedPresenter
22 : public base::RefCountedThreadSafe<AcceleratedPresenter> { 26 : public base::RefCountedThreadSafe<AcceleratedPresenter> {
23 public: 27 public:
24 typedef base::Callback<void(bool)> CompletionTaskl; 28 typedef base::Callback<void(bool)> CompletionTaskl;
25 29
26 explicit AcceleratedPresenter(gfx::NativeWindow window); 30 explicit AcceleratedPresenter(gfx::NativeWindow window);
27 31
28 // Returns a thread safe reference to the presenter for the given window or 32 // Returns a thread safe reference to the presenter for the given window or
29 // null is no such presenter exists. The thread safe refptr ensures the 33 // null is no such presenter exists. The thread safe refptr ensures the
30 // presenter will not be destroyed. This can be called on any thread. 34 // presenter will not be destroyed. This can be called on any thread.
(...skipping 14 matching lines...) Expand all
45 void Suspend(); 49 void Suspend();
46 50
47 // Indicates that the presenter has become invisible. 51 // Indicates that the presenter has become invisible.
48 void WasHidden(); 52 void WasHidden();
49 53
50 // Schedule the presenter to release its reference to the shared surface. 54 // Schedule the presenter to release its reference to the shared surface.
51 void ReleaseSurface(); 55 void ReleaseSurface();
52 56
53 // The public member functions are called on the main thread. 57 // The public member functions are called on the main thread.
54 bool Present(HDC dc); 58 bool Present(HDC dc);
55 bool CopyTo(const gfx::Size& size, void* buf); 59 bool CopyTo(const gfx::Rect& src_subrect,
60 const gfx::Size& dst_size,
61 void* buf);
56 void Invalidate(); 62 void Invalidate();
57 63
58 private: 64 private:
59 friend class base::RefCountedThreadSafe<AcceleratedPresenter>; 65 friend class base::RefCountedThreadSafe<AcceleratedPresenter>;
60 66
61 ~AcceleratedPresenter(); 67 ~AcceleratedPresenter();
62 68
63 // These member functions are called on the PresentThread with which the 69 // These member functions are called on the PresentThread with which the
64 // presenter has affinity. 70 // presenter has affinity.
65 void DoPresentAndAcknowledge( 71 void DoPresentAndAcknowledge(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 }; 114 };
109 115
110 class SURFACE_EXPORT AcceleratedSurface { 116 class SURFACE_EXPORT AcceleratedSurface {
111 public: 117 public:
112 AcceleratedSurface(gfx::NativeWindow window); 118 AcceleratedSurface(gfx::NativeWindow window);
113 ~AcceleratedSurface(); 119 ~AcceleratedSurface();
114 120
115 // Synchronously present a frame with no acknowledgement. 121 // Synchronously present a frame with no acknowledgement.
116 bool Present(HDC dc); 122 bool Present(HDC dc);
117 123
118 // Copies the surface data to |buf|. The image data is transformed so that it 124 // Copies the surface data to |buf|. The copied region is specified with
119 // fits in |size|. 125 // |src_subrect| and the image data is transformed so that it fits in
126 // |dst_size|.
120 // Caller must ensure that |buf| is allocated with the size no less than 127 // Caller must ensure that |buf| is allocated with the size no less than
121 // |4 * size.width() * size.height()| bytes. 128 // |4 * dst_size.width() * dst_size.height()| bytes.
122 bool CopyTo(const gfx::Size& size, void* buf); 129 bool CopyTo(const gfx::Rect& src_subrect,
130 const gfx::Size& dst_size,
131 void* buf);
123 132
124 // Temporarily release resources until a new surface is asynchronously 133 // Temporarily release resources until a new surface is asynchronously
125 // presented. Present will not be able to represent the last surface after 134 // presented. Present will not be able to represent the last surface after
126 // calling this and will return false. 135 // calling this and will return false.
127 void Suspend(); 136 void Suspend();
128 137
129 // Indicates that the surface has become invisible. 138 // Indicates that the surface has become invisible.
130 void WasHidden(); 139 void WasHidden();
131 140
132 private: 141 private:
133 const scoped_refptr<AcceleratedPresenter> presenter_; 142 const scoped_refptr<AcceleratedPresenter> presenter_;
134 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); 143 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface);
135 }; 144 };
136 145
137 #endif // UI_SURFACE_ACCELERATED_SURFACE_WIN_H_ 146 #endif // UI_SURFACE_ACCELERATED_SURFACE_WIN_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.cc ('k') | ui/surface/accelerated_surface_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698