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

Side by Side Diff: ui/gl/gl_surface_win.cc

Issue 1084173004: Adding status to swap complete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change swapbuffers return Created 5 years, 7 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
« no previous file with comments | « ui/gl/gl_surface_wgl.cc ('k') | ui/gl/gl_surface_x11.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) 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 #include "ui/gl/gl_surface.h" 5 #include "ui/gl/gl_surface.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 21 matching lines...) Expand all
32 // view. 32 // view.
33 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { 33 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa {
34 public: 34 public:
35 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); 35 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window);
36 ~NativeViewGLSurfaceOSMesa() override; 36 ~NativeViewGLSurfaceOSMesa() override;
37 37
38 // Implement subset of GLSurface. 38 // Implement subset of GLSurface.
39 bool Initialize() override; 39 bool Initialize() override;
40 void Destroy() override; 40 void Destroy() override;
41 bool IsOffscreen() override; 41 bool IsOffscreen() override;
42 bool SwapBuffers() override; 42 gfx::SwapResult SwapBuffers() override;
43 bool SupportsPostSubBuffer() override; 43 gfx::SwapResult SupportsPostSubBuffer() override;
44 bool PostSubBuffer(int x, int y, int width, int height) override; 44 bool PostSubBuffer(int x, int y, int width, int height) override;
45 45
46 private: 46 private:
47 gfx::AcceleratedWidget window_; 47 gfx::AcceleratedWidget window_;
48 HDC device_context_; 48 HDC device_context_;
49 49
50 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceOSMesa); 50 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceOSMesa);
51 }; 51 };
52 52
53 class WinVSyncProvider : public VSyncProvider { 53 class WinVSyncProvider : public VSyncProvider {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 183
184 device_context_ = NULL; 184 device_context_ = NULL;
185 185
186 GLSurfaceOSMesa::Destroy(); 186 GLSurfaceOSMesa::Destroy();
187 } 187 }
188 188
189 bool NativeViewGLSurfaceOSMesa::IsOffscreen() { 189 bool NativeViewGLSurfaceOSMesa::IsOffscreen() {
190 return false; 190 return false;
191 } 191 }
192 192
193 bool NativeViewGLSurfaceOSMesa::SwapBuffers() { 193 gfx::SwapResult NativeViewGLSurfaceOSMesa::SwapBuffers() {
194 DCHECK(device_context_); 194 DCHECK(device_context_);
195 195
196 gfx::Size size = GetSize(); 196 gfx::Size size = GetSize();
197 197
198 // Note: negating the height below causes GDI to treat the bitmap data as row 198 // Note: negating the height below causes GDI to treat the bitmap data as row
199 // 0 being at the top. 199 // 0 being at the top.
200 BITMAPV4HEADER info = { sizeof(BITMAPV4HEADER) }; 200 BITMAPV4HEADER info = { sizeof(BITMAPV4HEADER) };
201 info.bV4Width = size.width(); 201 info.bV4Width = size.width();
202 info.bV4Height = -size.height(); 202 info.bV4Height = -size.height();
203 info.bV4Planes = 1; 203 info.bV4Planes = 1;
(...skipping 12 matching lines...) Expand all
216 // browser test to become flaky if there is a race condition between GL 216 // browser test to become flaky if there is a race condition between GL
217 // context destruction and window destruction. 217 // context destruction and window destruction.
218 StretchDIBits(device_context_, 218 StretchDIBits(device_context_,
219 0, 0, size.width(), size.height(), 219 0, 0, size.width(), size.height(),
220 0, 0, size.width(), size.height(), 220 0, 0, size.width(), size.height(),
221 GetHandle(), 221 GetHandle(),
222 reinterpret_cast<BITMAPINFO*>(&info), 222 reinterpret_cast<BITMAPINFO*>(&info),
223 DIB_RGB_COLORS, 223 DIB_RGB_COLORS,
224 SRCCOPY); 224 SRCCOPY);
225 225
226 return true; 226 return gfx::SWAP_ACK;
227 } 227 }
228 228
229 bool NativeViewGLSurfaceOSMesa::SupportsPostSubBuffer() { 229 bool NativeViewGLSurfaceOSMesa::SupportsPostSubBuffer() {
230 return true; 230 return true;
231 } 231 }
232 232
233 bool NativeViewGLSurfaceOSMesa::PostSubBuffer( 233 gfx::SwapResult NativeViewGLSurfaceOSMesa::PostSubBuffer(int x,
234 int x, int y, int width, int height) { 234 int y,
235 int width,
236 int height) {
235 DCHECK(device_context_); 237 DCHECK(device_context_);
236 238
237 gfx::Size size = GetSize(); 239 gfx::Size size = GetSize();
238 240
239 // Note: negating the height below causes GDI to treat the bitmap data as row 241 // Note: negating the height below causes GDI to treat the bitmap data as row
240 // 0 being at the top. 242 // 0 being at the top.
241 BITMAPV4HEADER info = { sizeof(BITMAPV4HEADER) }; 243 BITMAPV4HEADER info = { sizeof(BITMAPV4HEADER) };
242 info.bV4Width = size.width(); 244 info.bV4Width = size.width();
243 info.bV4Height = -size.height(); 245 info.bV4Height = -size.height();
244 info.bV4Planes = 1; 246 info.bV4Planes = 1;
(...skipping 12 matching lines...) Expand all
257 // browser test to become flaky if there is a race condition between GL 259 // browser test to become flaky if there is a race condition between GL
258 // context destruction and window destruction. 260 // context destruction and window destruction.
259 StretchDIBits(device_context_, 261 StretchDIBits(device_context_,
260 x, size.height() - y - height, width, height, 262 x, size.height() - y - height, width, height,
261 x, y, width, height, 263 x, y, width, height,
262 GetHandle(), 264 GetHandle(),
263 reinterpret_cast<BITMAPINFO*>(&info), 265 reinterpret_cast<BITMAPINFO*>(&info),
264 DIB_RGB_COLORS, 266 DIB_RGB_COLORS,
265 SRCCOPY); 267 SRCCOPY);
266 268
267 return true; 269 return return gfx::SWAP_ACK;
piman 2015/05/14 20:58:54 nit: return return = typo
268 } 270 }
269 271
270 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( 272 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface(
271 gfx::AcceleratedWidget window) { 273 gfx::AcceleratedWidget window) {
272 TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface"); 274 TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface");
273 switch (GetGLImplementation()) { 275 switch (GetGLImplementation()) {
274 case kGLImplementationOSMesaGL: { 276 case kGLImplementationOSMesaGL: {
275 scoped_refptr<GLSurface> surface( 277 scoped_refptr<GLSurface> surface(
276 new NativeViewGLSurfaceOSMesa(window)); 278 new NativeViewGLSurfaceOSMesa(window));
277 if (!surface->Initialize()) 279 if (!surface->Initialize())
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 344
343 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 345 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
344 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 346 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
345 switches::kDisableD3D11) || 347 switches::kDisableD3D11) ||
346 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp)) 348 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp))
347 return GetDC(NULL); 349 return GetDC(NULL);
348 return EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE; 350 return EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE;
349 } 351 }
350 352
351 } // namespace gfx 353 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_wgl.cc ('k') | ui/gl/gl_surface_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698