viewer: Add a "Path renderer" dropdown menu
BUG=skia:
Change-Id: Ia3ed812d24f0f83631ab238bc418a3c95d49b9dc
Reviewed-on: https://skia-review.googlesource.com/9000
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/tools/viewer/sk_app/DisplayParams.h b/tools/viewer/sk_app/DisplayParams.h
index 0c649c0..959735e 100644
--- a/tools/viewer/sk_app/DisplayParams.h
+++ b/tools/viewer/sk_app/DisplayParams.h
@@ -7,6 +7,7 @@
#ifndef DisplayParams_DEFINED
#define DisplayParams_DEFINED
+#include "GrContextOptions.h"
#include "SkImageInfo.h"
namespace sk_app {
@@ -20,6 +21,7 @@
SkColorType fColorType;
sk_sp<SkColorSpace> fColorSpace;
int fMSAASampleCount;
+ GrContextOptions fGrContextOptions;
};
} // namespace sk_app
diff --git a/tools/viewer/sk_app/GLWindowContext.cpp b/tools/viewer/sk_app/GLWindowContext.cpp
index 89cd858..ff56ce8 100644
--- a/tools/viewer/sk_app/GLWindowContext.cpp
+++ b/tools/viewer/sk_app/GLWindowContext.cpp
@@ -7,7 +7,6 @@
*/
#include "GrContext.h"
-#include "SkCommonFlagsPathRenderer.h"
#include "SkSurface.h"
#include "GLWindowContext.h"
@@ -37,11 +36,9 @@
this->onInitializeContext();
SkASSERT(nullptr == fContext);
- GrContextOptions ctxOptions;
- ctxOptions.fGpuPathRenderers = CollectGpuPathRenderersFromFlags();
fBackendContext.reset(GrGLCreateNativeInterface());
fContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)fBackendContext.get(),
- ctxOptions);
+ fDisplayParams.fGrContextOptions);
if (!fContext && fDisplayParams.fMSAASampleCount) {
fDisplayParams.fMSAASampleCount /= 2;
this->initializeContext();
diff --git a/tools/viewer/sk_app/VulkanWindowContext.cpp b/tools/viewer/sk_app/VulkanWindowContext.cpp
index b8071d3..8e8c059 100644
--- a/tools/viewer/sk_app/VulkanWindowContext.cpp
+++ b/tools/viewer/sk_app/VulkanWindowContext.cpp
@@ -8,7 +8,6 @@
#include "GrContext.h"
#include "GrRenderTarget.h"
-#include "SkCommonFlagsPathRenderer.h"
#include "SkAutoMalloc.h"
#include "SkSurface.h"
#include "VulkanWindowContext.h"
@@ -62,10 +61,8 @@
GET_DEV_PROC(AcquireNextImageKHR);
GET_DEV_PROC(QueuePresentKHR);
- GrContextOptions ctxOptions;
- ctxOptions.fGpuPathRenderers = CollectGpuPathRenderersFromFlags();
fContext = GrContext::Create(kVulkan_GrBackend, (GrBackendContext) fBackendContext.get(),
- ctxOptions);
+ params.fGrContextOptions);
fSurface = createVkSurface(instance);
if (VK_NULL_HANDLE == fSurface) {
diff --git a/tools/viewer/sk_app/Window.cpp b/tools/viewer/sk_app/Window.cpp
index d57daf9..a63e1e3 100644
--- a/tools/viewer/sk_app/Window.cpp
+++ b/tools/viewer/sk_app/Window.cpp
@@ -146,6 +146,13 @@
return fWindowContext->stencilBits();
}
+const GrContext* Window::getGrContext() const {
+ if (!fWindowContext) {
+ return nullptr;
+ }
+ return fWindowContext->getGrContext();
+}
+
void Window::inval() {
if (!fWindowContext) {
return;
diff --git a/tools/viewer/sk_app/Window.h b/tools/viewer/sk_app/Window.h
index 4ae23b1..85cf3ac 100644
--- a/tools/viewer/sk_app/Window.h
+++ b/tools/viewer/sk_app/Window.h
@@ -14,6 +14,7 @@
#include "SkTypes.h"
#include "SkJSONCPP.h"
+class GrContext;
class SkCanvas;
class SkSurface;
@@ -198,6 +199,9 @@
int sampleCount() const;
int stencilBits() const;
+ // Returns null if there is not a GPU backend or if the backend is not yet created.
+ const GrContext* getGrContext() const;
+
protected:
Window();