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

Unified Diff: experimental/fiddle/OSMesaContextHolder.cpp

Issue 1349163003: experiment/fiddle (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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
Index: experimental/fiddle/OSMesaContextHolder.cpp
diff --git a/experimental/fiddle/OSMesaContextHolder.cpp b/experimental/fiddle/OSMesaContextHolder.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9b2c73de487ffd715f465a98a0c01f9d33636a3a
--- /dev/null
+++ b/experimental/fiddle/OSMesaContextHolder.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+
+#include <GL/osmesa.h>
+
+#include "OSMesaContextHolder.h"
+
+OSMesaContextHolder::OSMesaContextHolder() {
+ fOSMesaContext = OSMesaCreateContextExt(0x1, 0, 0, 0, nullptr);
+ if (!fOSMesaContext) {
+ fputs("Unable to get OSMesa context.\n", stderr);
+ } else {
+ static uint32_t buffer[16 * 16];
+ OSMesaMakeCurrent(fOSMesaContext, &buffer, 0x1401, 16, 16);
+ }
+}
+
+OSMesaContextHolder::~OSMesaContextHolder() {
+ if (fOSMesaContext) {
+ OSMesaDestroyContext(fOSMesaContext);
+ }
+}
+

Powered by Google App Engine
This is Rietveld 408576698