OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include <GL/osmesa.h> | 9 #include <GL/osmesa.h> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 if (fContext) { | 48 if (fContext) { |
49 OSMesaDestroyContext((OSMesaContext)fContext); | 49 OSMesaDestroyContext((OSMesaContext)fContext); |
50 fContext = static_cast<Context>(NULL); | 50 fContext = static_cast<Context>(NULL); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 static const GrGLint gBOGUS_SIZE = 16; | 54 static const GrGLint gBOGUS_SIZE = 16; |
55 | 55 |
56 const GrGLInterface* SkMesaGLContext::createGLContext(GrGLStandard forcedGpuAPI)
{ | 56 const GrGLInterface* SkMesaGLContext::createGLContext() { |
57 if (kGLES_GrGLStandard == forcedGpuAPI) { | |
58 return NULL; | |
59 } | |
60 | |
61 /* Create an RGBA-mode context */ | 57 /* Create an RGBA-mode context */ |
62 #if OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 305 | 58 #if OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 305 |
63 /* specify Z, stencil, accum sizes */ | 59 /* specify Z, stencil, accum sizes */ |
64 fContext = (Context)OSMesaCreateContextExt(OSMESA_BGRA, 0, 0, 0, NULL); | 60 fContext = (Context)OSMesaCreateContextExt(OSMESA_BGRA, 0, 0, 0, NULL); |
65 #else | 61 #else |
66 fContext = (Context)OSMesaCreateContext(OSMESA_BGRA, NULL); | 62 fContext = (Context)OSMesaCreateContext(OSMESA_BGRA, NULL); |
67 #endif | 63 #endif |
68 if (!fContext) { | 64 if (!fContext) { |
69 SkDebugf("OSMesaCreateContext failed!\n"); | 65 SkDebugf("OSMesaCreateContext failed!\n"); |
70 this->destroyGLContext(); | 66 this->destroyGLContext(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void SkMesaGLContext::makeCurrent() const { | 99 void SkMesaGLContext::makeCurrent() const { |
104 if (fContext) { | 100 if (fContext) { |
105 if (!OSMesaMakeCurrent((OSMesaContext)fContext, fImage, | 101 if (!OSMesaMakeCurrent((OSMesaContext)fContext, fImage, |
106 GR_GL_UNSIGNED_BYTE, gBOGUS_SIZE, gBOGUS_SIZE)) { | 102 GR_GL_UNSIGNED_BYTE, gBOGUS_SIZE, gBOGUS_SIZE)) { |
107 SkDebugf("Could not make MESA context current."); | 103 SkDebugf("Could not make MESA context current."); |
108 } | 104 } |
109 } | 105 } |
110 } | 106 } |
111 | 107 |
112 void SkMesaGLContext::swapBuffers() const { } | 108 void SkMesaGLContext::swapBuffers() const { } |
OLD | NEW |