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

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

Issue 11266023: Make GL calls go through subclassable class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | « ui/gl/gl_osmesa_api_implementation.cc ('k') | ui/gl/gl_surface_glx.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_egl.h" 5 #include "ui/gl/gl_surface_egl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 LOG(ERROR) << "Trying to create surface with invalid display."; 193 LOG(ERROR) << "Trying to create surface with invalid display.";
194 return false; 194 return false;
195 } 195 }
196 196
197 static const EGLint egl_window_attributes_sub_buffer[] = { 197 static const EGLint egl_window_attributes_sub_buffer[] = {
198 EGL_POST_SUB_BUFFER_SUPPORTED_NV, EGL_TRUE, 198 EGL_POST_SUB_BUFFER_SUPPORTED_NV, EGL_TRUE,
199 EGL_NONE 199 EGL_NONE
200 }; 200 };
201 201
202 // Create a surface for the native window. 202 // Create a surface for the native window.
203 surface_ = eglCreateWindowSurface(GetDisplay(), 203 surface_ = eglCreateWindowSurface(
204 GetConfig(), 204 GetDisplay(),
205 window_, 205 GetConfig(),
206 gfx::g_EGL_NV_post_sub_buffer ? 206 window_,
207 egl_window_attributes_sub_buffer : 207 gfx::g_driver_egl.ext.b_EGL_NV_post_sub_buffer ?
208 NULL); 208 egl_window_attributes_sub_buffer :
209 NULL);
209 210
210 if (!surface_) { 211 if (!surface_) {
211 LOG(ERROR) << "eglCreateWindowSurface failed with error " 212 LOG(ERROR) << "eglCreateWindowSurface failed with error "
212 << GetLastEGLErrorString(); 213 << GetLastEGLErrorString();
213 Destroy(); 214 Destroy();
214 return false; 215 return false;
215 } 216 }
216 217
217 EGLint surfaceVal; 218 EGLint surfaceVal;
218 EGLBoolean retVal = eglQuerySurface(GetDisplay(), 219 EGLBoolean retVal = eglQuerySurface(GetDisplay(),
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 484
484 EGLSurface PbufferGLSurfaceEGL::GetHandle() { 485 EGLSurface PbufferGLSurfaceEGL::GetHandle() {
485 return surface_; 486 return surface_;
486 } 487 }
487 488
488 void* PbufferGLSurfaceEGL::GetShareHandle() { 489 void* PbufferGLSurfaceEGL::GetShareHandle() {
489 #if defined(OS_ANDROID) 490 #if defined(OS_ANDROID)
490 NOTREACHED(); 491 NOTREACHED();
491 return NULL; 492 return NULL;
492 #else 493 #else
493 if (!g_EGL_ANGLE_query_surface_pointer) 494 if (!gfx::g_driver_egl.ext.b_EGL_ANGLE_query_surface_pointer)
494 return NULL; 495 return NULL;
495 496
496 if (!g_EGL_ANGLE_surface_d3d_texture_2d_share_handle) 497 if (!gfx::g_driver_egl.ext.b_EGL_ANGLE_surface_d3d_texture_2d_share_handle)
497 return NULL; 498 return NULL;
498 499
499 void* handle; 500 void* handle;
500 if (!eglQuerySurfacePointerANGLE(g_display, 501 if (!eglQuerySurfacePointerANGLE(g_display,
501 GetHandle(), 502 GetHandle(),
502 EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, 503 EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE,
503 &handle)) { 504 &handle)) {
504 return NULL; 505 return NULL;
505 } 506 }
506 507
507 return handle; 508 return handle;
508 #endif 509 #endif
509 } 510 }
510 511
511 PbufferGLSurfaceEGL::~PbufferGLSurfaceEGL() { 512 PbufferGLSurfaceEGL::~PbufferGLSurfaceEGL() {
512 Destroy(); 513 Destroy();
513 } 514 }
514 515
515 } // namespace gfx 516 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_osmesa_api_implementation.cc ('k') | ui/gl/gl_surface_glx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698