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

Unified Diff: tools/skiaserve/Request.cpp

Issue 2059263002: skiaserve no longer crashes when no X server is present (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: added support for MESA software rendering Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skiaserve/Request.cpp
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp
index 97719e2bd2ad7905d2bd96dbbea05f00d01014e5..c3eaaff387a3f90e45b497876372c26f87c05401 100644
--- a/tools/skiaserve/Request.cpp
+++ b/tools/skiaserve/Request.cpp
@@ -71,8 +71,14 @@ SkCanvas* Request::getCanvas() {
#if SK_SUPPORT_GPU
GrContextFactory* factory = fContextFactory;
GLTestContext* gl = factory->getContextInfo(GrContextFactory::kNativeGL_ContextType,
- GrContextFactory::kNone_ContextOptions).glContext();
- gl->makeCurrent();
+ GrContextFactory::kNone_ContextOptions).glContext();
+ if (!gl) {
+ gl = factory->getContextInfo(GrContextFactory::kMESA_ContextType,
+ GrContextFactory::kNone_ContextOptions).glContext();
+ }
+ if (gl) {
+ gl->makeCurrent();
+ }
#endif
SkASSERT(fDebugCanvas);
@@ -115,10 +121,15 @@ SkData* Request::writeOutSkp() {
GrContext* Request::getContext() {
#if SK_SUPPORT_GPU
- return fContextFactory->get(GrContextFactory::kNativeGL_ContextType,
- GrContextFactory::kNone_ContextOptions);
+ GrContext* result = fContextFactory->get(GrContextFactory::kNativeGL_ContextType,
+ GrContextFactory::kNone_ContextOptions);
+ if (!result) {
+ result = fContextFactory->get(GrContextFactory::kMESA_ContextType,
+ GrContextFactory::kNone_ContextOptions);
+ }
+ return result;
#else
- return nullptr;
+ return nullptr;
#endif
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698