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

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: fix ozone demo Created 5 years, 6 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 19 matching lines...) Expand all
30 // This OSMesa GL surface can use GDI to swap the contents of the buffer to a 30 // This OSMesa GL surface can use GDI to swap the contents of the buffer to a
31 // view. 31 // view.
32 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { 32 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa {
33 public: 33 public:
34 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); 34 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window);
35 35
36 // Implement subset of GLSurface. 36 // Implement subset of GLSurface.
37 bool Initialize() override; 37 bool Initialize() override;
38 void Destroy() override; 38 void Destroy() override;
39 bool IsOffscreen() override; 39 bool IsOffscreen() override;
40 bool SwapBuffers() override; 40 gfx::SwapResult SwapBuffers() override;
41 bool SupportsPostSubBuffer() override; 41 bool SupportsPostSubBuffer() override;
42 bool PostSubBuffer(int x, int y, int width, int height) override; 42 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override;
43 43
44 private: 44 private:
45 ~NativeViewGLSurfaceOSMesa() override; 45 ~NativeViewGLSurfaceOSMesa() override;
46 46
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
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 device_context_ = NULL; 202 device_context_ = NULL;
203 203
204 GLSurfaceOSMesa::Destroy(); 204 GLSurfaceOSMesa::Destroy();
205 } 205 }
206 206
207 bool NativeViewGLSurfaceOSMesa::IsOffscreen() { 207 bool NativeViewGLSurfaceOSMesa::IsOffscreen() {
208 return false; 208 return false;
209 } 209 }
210 210
211 bool NativeViewGLSurfaceOSMesa::SwapBuffers() { 211 gfx::SwapResult NativeViewGLSurfaceOSMesa::SwapBuffers() {
212 DCHECK(device_context_); 212 DCHECK(device_context_);
213 213
214 gfx::Size size = GetSize(); 214 gfx::Size size = GetSize();
215 215
216 // Note: negating the height below causes GDI to treat the bitmap data as row 216 // Note: negating the height below causes GDI to treat the bitmap data as row
217 // 0 being at the top. 217 // 0 being at the top.
218 BITMAPV4HEADER info = { sizeof(BITMAPV4HEADER) }; 218 BITMAPV4HEADER info = { sizeof(BITMAPV4HEADER) };
219 info.bV4Width = size.width(); 219 info.bV4Width = size.width();
220 info.bV4Height = -size.height(); 220 info.bV4Height = -size.height();
221 info.bV4Planes = 1; 221 info.bV4Planes = 1;
(...skipping 12 matching lines...) Expand all
234 // browser test to become flaky if there is a race condition between GL 234 // browser test to become flaky if there is a race condition between GL
235 // context destruction and window destruction. 235 // context destruction and window destruction.
236 StretchDIBits(device_context_, 236 StretchDIBits(device_context_,
237 0, 0, size.width(), size.height(), 237 0, 0, size.width(), size.height(),
238 0, 0, size.width(), size.height(), 238 0, 0, size.width(), size.height(),
239 GetHandle(), 239 GetHandle(),
240 reinterpret_cast<BITMAPINFO*>(&info), 240 reinterpret_cast<BITMAPINFO*>(&info),
241 DIB_RGB_COLORS, 241 DIB_RGB_COLORS,
242 SRCCOPY); 242 SRCCOPY);
243 243
244 return true; 244 return gfx::SwapResult::SWAP_ACK;
245 } 245 }
246 246
247 bool NativeViewGLSurfaceOSMesa::SupportsPostSubBuffer() { 247 bool NativeViewGLSurfaceOSMesa::SupportsPostSubBuffer() {
248 return true; 248 return true;
249 } 249 }
250 250
251 bool NativeViewGLSurfaceOSMesa::PostSubBuffer( 251 gfx::SwapResult NativeViewGLSurfaceOSMesa::PostSubBuffer(int x,
252 int x, int y, int width, int height) { 252 int y,
253 int width,
254 int height) {
253 DCHECK(device_context_); 255 DCHECK(device_context_);
254 256
255 gfx::Size size = GetSize(); 257 gfx::Size size = GetSize();
256 258
257 // Note: negating the height below causes GDI to treat the bitmap data as row 259 // Note: negating the height below causes GDI to treat the bitmap data as row
258 // 0 being at the top. 260 // 0 being at the top.
259 BITMAPV4HEADER info = { sizeof(BITMAPV4HEADER) }; 261 BITMAPV4HEADER info = { sizeof(BITMAPV4HEADER) };
260 info.bV4Width = size.width(); 262 info.bV4Width = size.width();
261 info.bV4Height = -size.height(); 263 info.bV4Height = -size.height();
262 info.bV4Planes = 1; 264 info.bV4Planes = 1;
(...skipping 12 matching lines...) Expand all
275 // browser test to become flaky if there is a race condition between GL 277 // browser test to become flaky if there is a race condition between GL
276 // context destruction and window destruction. 278 // context destruction and window destruction.
277 StretchDIBits(device_context_, 279 StretchDIBits(device_context_,
278 x, size.height() - y - height, width, height, 280 x, size.height() - y - height, width, height,
279 x, y, width, height, 281 x, y, width, height,
280 GetHandle(), 282 GetHandle(),
281 reinterpret_cast<BITMAPINFO*>(&info), 283 reinterpret_cast<BITMAPINFO*>(&info),
282 DIB_RGB_COLORS, 284 DIB_RGB_COLORS,
283 SRCCOPY); 285 SRCCOPY);
284 286
285 return true; 287 return gfx::SwapResult::SWAP_ACK;
286 } 288 }
287 289
288 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( 290 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface(
289 gfx::AcceleratedWidget window) { 291 gfx::AcceleratedWidget window) {
290 TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface"); 292 TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface");
291 switch (GetGLImplementation()) { 293 switch (GetGLImplementation()) {
292 case kGLImplementationOSMesaGL: { 294 case kGLImplementationOSMesaGL: {
293 scoped_refptr<GLSurface> surface( 295 scoped_refptr<GLSurface> surface(
294 new NativeViewGLSurfaceOSMesa(window)); 296 new NativeViewGLSurfaceOSMesa(window));
295 if (!surface->Initialize()) 297 if (!surface->Initialize())
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 NOTREACHED(); 358 NOTREACHED();
357 return NULL; 359 return NULL;
358 } 360 }
359 } 361 }
360 362
361 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 363 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
362 return GetDC(NULL); 364 return GetDC(NULL);
363 } 365 }
364 366
365 } // namespace gfx 367 } // 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