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

Side by Side Diff: ui/gfx/gl/gl_context_osmesa.cc

Issue 8060045: Use shared D3D9 texture to transport the compositor's backing buffer to the browser... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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) 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 #include <GL/osmesa.h> 5 #include <GL/osmesa.h>
6 6
7 #include "ui/gfx/gl/gl_context_osmesa.h" 7 #include "ui/gfx/gl/gl_context_osmesa.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/gfx/gl/gl_bindings.h" 10 #include "ui/gfx/gl/gl_bindings.h"
11 #include "ui/gfx/gl/gl_surface_osmesa.h" 11 #include "ui/gfx/gl/gl_surface.h"
12 #include "ui/gfx/size.h"
12 13
13 namespace gfx { 14 namespace gfx {
14 15
15 GLContextOSMesa::GLContextOSMesa(GLShareGroup* share_group) 16 GLContextOSMesa::GLContextOSMesa(GLShareGroup* share_group)
16 : GLContext(share_group), 17 : GLContext(share_group),
17 context_(NULL) { 18 context_(NULL) {
18 } 19 }
19 20
20 GLContextOSMesa::~GLContextOSMesa() { 21 GLContextOSMesa::~GLContextOSMesa() {
21 Destroy(); 22 Destroy();
22 } 23 }
23 24
24 bool GLContextOSMesa::Initialize( 25 bool GLContextOSMesa::Initialize(
25 GLSurface* compatible_surface, GpuPreference gpu_preference) { 26 GLSurface* compatible_surface, GpuPreference gpu_preference) {
26 DCHECK(!context_); 27 DCHECK(!context_);
27 28
28 OSMesaContext share_handle = static_cast<OSMesaContext>( 29 OSMesaContext share_handle = static_cast<OSMesaContext>(
29 share_group() ? share_group()->GetHandle() : NULL); 30 share_group() ? share_group()->GetHandle() : NULL);
30 31
31 GLuint format = 32 GLuint format = compatible_surface->GetFormat();
32 static_cast<GLSurfaceOSMesa*>(compatible_surface)->GetFormat();
33 DCHECK_NE(format, (unsigned)0); 33 DCHECK_NE(format, (unsigned)0);
34 context_ = OSMesaCreateContextExt(format, 34 context_ = OSMesaCreateContextExt(format,
35 0, // depth bits 35 0, // depth bits
36 0, // stencil bits 36 0, // stencil bits
37 0, // accum bits 37 0, // accum bits
38 share_handle); 38 share_handle);
39 if (!context_) { 39 if (!context_) {
40 LOG(ERROR) << "OSMesaCreateContextExt failed."; 40 LOG(ERROR) << "OSMesaCreateContextExt failed.";
41 return false; 41 return false;
42 } 42 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 void* GLContextOSMesa::GetHandle() { 116 void* GLContextOSMesa::GetHandle() {
117 return context_; 117 return context_;
118 } 118 }
119 119
120 void GLContextOSMesa::SetSwapInterval(int interval) { 120 void GLContextOSMesa::SetSwapInterval(int interval) {
121 DCHECK(IsCurrent(NULL)); 121 DCHECK(IsCurrent(NULL));
122 LOG(WARNING) << "GLContextOSMesa::SetSwapInterval is ignored."; 122 LOG(WARNING) << "GLContextOSMesa::SetSwapInterval is ignored.";
123 } 123 }
124 124
125 } // namespace gfx 125 } // namespace gfx
OLDNEW
« gpu/DEPS ('K') | « ui/gfx/gl/gl_context_glx.cc ('k') | ui/gfx/gl/gl_context_wgl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698