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

Side by Side Diff: src/gpu/gl/mesa/SkMesaGLContext.cpp

Issue 639793002: Revert of Make the Sk GL context class an abstract base class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
OLDNEW
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() {
15 fOldContext = (Context)OSMesaGetCurrentContext();
16 if (fOldContext) {
17 OSMesaGetColorBuffer((OSMesaContext)fOldContext,
18 &fOldWidth, &fOldHeight,
19 &fOldFormat, &fOldImage);
20 }
21 }
22
23 SkMesaGLContext::AutoContextRestore::~AutoContextRestore() {
24 if (fOldContext) {
25 OSMesaMakeCurrent((OSMesaContext)fOldContext, fOldImage,
26 fOldFormat, fOldWidth, fOldHeight);
27 }
28 }
29
30 ///////////////////////////////////////////////////////////////////////////////
31
14 SkMesaGLContext::SkMesaGLContext() 32 SkMesaGLContext::SkMesaGLContext()
15 : fContext(static_cast<Context>(NULL)) 33 : fContext(static_cast<Context>(NULL))
16 , fImage(NULL) { 34 , fImage(NULL) {
17 GR_STATIC_ASSERT(sizeof(Context) == sizeof(OSMesaContext)); 35 GR_STATIC_ASSERT(sizeof(Context) == sizeof(OSMesaContext));
18 } 36 }
19 37
20 SkMesaGLContext::~SkMesaGLContext() { 38 SkMesaGLContext::~SkMesaGLContext() {
21 this->destroyGLContext(); 39 this->destroyGLContext();
22 } 40 }
23 41
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 void SkMesaGLContext::makeCurrent() const { 103 void SkMesaGLContext::makeCurrent() const {
86 if (fContext) { 104 if (fContext) {
87 if (!OSMesaMakeCurrent((OSMesaContext)fContext, fImage, 105 if (!OSMesaMakeCurrent((OSMesaContext)fContext, fImage,
88 GR_GL_UNSIGNED_BYTE, gBOGUS_SIZE, gBOGUS_SIZE)) { 106 GR_GL_UNSIGNED_BYTE, gBOGUS_SIZE, gBOGUS_SIZE)) {
89 SkDebugf("Could not make MESA context current."); 107 SkDebugf("Could not make MESA context current.");
90 } 108 }
91 } 109 }
92 } 110 }
93 111
94 void SkMesaGLContext::swapBuffers() const { } 112 void SkMesaGLContext::swapBuffers() const { }
OLDNEW
« no previous file with comments | « src/gpu/gl/mac/SkNativeGLContext_mac.cpp ('k') | src/gpu/gl/nacl/SkCreatePlatformGLContext_nacl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698