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

Unified Diff: src/gpu/gl/mesa/SkMesaGLContext.cpp

Issue 1815823002: Move SkGLContext and some GrGLInterface implementations to skgputest module (Closed) Base URL: https://chromium.googlesource.com/skia.git@debugobject
Patch Set: fix windows and android? Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/mesa/SkMesaGLContext.h ('k') | src/gpu/gl/nacl/SkCreatePlatformGLContext_nacl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/mesa/SkMesaGLContext.cpp
diff --git a/src/gpu/gl/mesa/SkMesaGLContext.cpp b/src/gpu/gl/mesa/SkMesaGLContext.cpp
deleted file mode 100644
index eeccbd64ae6964a84ca15bbf0269b6259acd92e6..0000000000000000000000000000000000000000
--- a/src/gpu/gl/mesa/SkMesaGLContext.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <GL/osmesa.h>
-
-#include "gl/mesa/SkMesaGLContext.h"
-#include "gl/GrGLDefines.h"
-
-static const GrGLint gBOGUS_SIZE = 16;
-
-SkMesaGLContext::SkMesaGLContext()
- : fContext(static_cast<Context>(0))
- , fImage(nullptr) {
- GR_STATIC_ASSERT(sizeof(Context) == sizeof(OSMesaContext));
-
- /* Create an RGBA-mode context */
-#if OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 305
- /* specify Z, stencil, accum sizes */
- fContext = (Context)OSMesaCreateContextExt(OSMESA_BGRA, 0, 0, 0, nullptr);
-#else
- fContext = (Context)OSMesaCreateContext(OSMESA_BGRA, nullptr);
-#endif
- if (!fContext) {
- SkDebugf("OSMesaCreateContext failed!\n");
- this->destroyGLContext();
- return;
- }
- // Allocate the image buffer
- fImage = (GrGLubyte *) sk_malloc_throw(gBOGUS_SIZE * gBOGUS_SIZE *
- 4 * sizeof(GrGLubyte));
- if (!fImage) {
- SkDebugf("Alloc image buffer failed!\n");
- this->destroyGLContext();
- return;
- }
-
- // Bind the buffer to the context and make it current
- if (!OSMesaMakeCurrent((OSMesaContext)fContext,
- fImage,
- GR_GL_UNSIGNED_BYTE,
- gBOGUS_SIZE,
- gBOGUS_SIZE)) {
- SkDebugf("OSMesaMakeCurrent failed!\n");
- this->destroyGLContext();
- return;
- }
-
- SkAutoTUnref<const GrGLInterface> gl(GrGLCreateMesaInterface());
- if (nullptr == gl.get()) {
- SkDebugf("Could not create GL interface!\n");
- this->destroyGLContext();
- return;
- }
-
- if (!gl->validate()) {
- SkDebugf("Could not validate GL interface!\n");
- this->destroyGLContext();
- return;
- }
-
- this->init(gl.release());
-}
-
-SkMesaGLContext::~SkMesaGLContext() {
- this->teardown();
- this->destroyGLContext();
-}
-
-void SkMesaGLContext::destroyGLContext() {
- if (fImage) {
- sk_free(fImage);
- fImage = nullptr;
- }
-
- if (fContext) {
- OSMesaDestroyContext((OSMesaContext)fContext);
- fContext = static_cast<Context>(0);
- }
-}
-
-
-
-void SkMesaGLContext::onPlatformMakeCurrent() const {
- if (fContext) {
- if (!OSMesaMakeCurrent((OSMesaContext)fContext, fImage,
- GR_GL_UNSIGNED_BYTE, gBOGUS_SIZE, gBOGUS_SIZE)) {
- SkDebugf("Could not make MESA context current.");
- }
- }
-}
-
-void SkMesaGLContext::onPlatformSwapBuffers() const { }
-
-GrGLFuncPtr SkMesaGLContext::onPlatformGetProcAddress(const char* procName) const {
- return OSMesaGetProcAddress(procName);
-}
« no previous file with comments | « src/gpu/gl/mesa/SkMesaGLContext.h ('k') | src/gpu/gl/nacl/SkCreatePlatformGLContext_nacl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698