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 |
11 #include "gl/SkMesaGLContext.h" | 11 #include "gl/SkMesaGLContext.h" |
12 #include "gl/GrGLDefines.h" | 12 #include "gl/GrGLDefines.h" |
13 | 13 |
14 SkMesaGLContext::AutoContextRestore::AutoContextRestore() { | 14 SkMesaGLContext::AutoContextRestore::AutoContextRestore() { |
15 fOldContext = (Context)OSMesaGetCurrentContext(); | 15 fOldContext = (Context)OSMesaGetCurrentContext(); |
16 if (NULL != (OSMesaContext)fOldContext) { | 16 if (fOldContext) { |
17 OSMesaGetColorBuffer((OSMesaContext)fOldContext, | 17 OSMesaGetColorBuffer((OSMesaContext)fOldContext, |
18 &fOldWidth, &fOldHeight, | 18 &fOldWidth, &fOldHeight, |
19 &fOldFormat, &fOldImage); | 19 &fOldFormat, &fOldImage); |
20 } | 20 } |
21 } | 21 } |
22 | 22 |
23 SkMesaGLContext::AutoContextRestore::~AutoContextRestore() { | 23 SkMesaGLContext::AutoContextRestore::~AutoContextRestore() { |
24 if (NULL != (OSMesaContext)fOldContext) { | 24 if (fOldContext) { |
25 OSMesaMakeCurrent((OSMesaContext)fOldContext, fOldImage, | 25 OSMesaMakeCurrent((OSMesaContext)fOldContext, fOldImage, |
26 fOldFormat, fOldWidth, fOldHeight); | 26 fOldFormat, fOldWidth, fOldHeight); |
27 } | 27 } |
28 } | 28 } |
29 | 29 |
30 /////////////////////////////////////////////////////////////////////////////// | 30 /////////////////////////////////////////////////////////////////////////////// |
31 | 31 |
32 SkMesaGLContext::SkMesaGLContext() | 32 SkMesaGLContext::SkMesaGLContext() |
33 : fContext(static_cast<Context>(NULL)) | 33 : fContext(static_cast<Context>(NULL)) |
34 , fImage(NULL) { | 34 , fImage(NULL) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void SkMesaGLContext::makeCurrent() const { | 103 void SkMesaGLContext::makeCurrent() const { |
104 if (fContext) { | 104 if (fContext) { |
105 if (!OSMesaMakeCurrent((OSMesaContext)fContext, fImage, | 105 if (!OSMesaMakeCurrent((OSMesaContext)fContext, fImage, |
106 GR_GL_UNSIGNED_BYTE, gBOGUS_SIZE, gBOGUS_SIZE)) { | 106 GR_GL_UNSIGNED_BYTE, gBOGUS_SIZE, gBOGUS_SIZE)) { |
107 SkDebugf("Could not make MESA context current."); | 107 SkDebugf("Could not make MESA context current."); |
108 } | 108 } |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 void SkMesaGLContext::swapBuffers() const { } | 112 void SkMesaGLContext::swapBuffers() const { } |
OLD | NEW |