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

Unified Diff: experimental/webtry/main.cpp

Issue 649313002: add ganesh checkbox to skfiddle interface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Integrate the ganesh checkbox into the hash and DB 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | experimental/webtry/res/js/webtry.js » ('j') | experimental/webtry/scripts/fiddle_gyp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/webtry/main.cpp
diff --git a/experimental/webtry/main.cpp b/experimental/webtry/main.cpp
index 98c2f5e4e68aa6a6421d32bb6533da005a1414e3..bd6ffb2aba9e2a54eabd89417553491070a827b7 100644
--- a/experimental/webtry/main.cpp
+++ b/experimental/webtry/main.cpp
@@ -13,6 +13,8 @@
#include "SkStream.h"
#include "SkSurface.h"
+#include "GrContextFactory.h"
tfarina 2014/10/13 21:28:12 might keep this sorted while at this?
humper 2014/10/13 21:50:06 Done.
+
#include "seccomp_bpf.h"
__SK_FORCE_IMAGE_DECODER_LINKING;
@@ -21,6 +23,7 @@ DEFINE_string(out, "", "Filename of the PNG to write to.");
DEFINE_string(source, "", "Filename of the source image.");
DEFINE_int32(width, 256, "Width of output image.");
DEFINE_int32(height, 256, "Height of output image.");
+DEFINE_bool(gpu, false, "Use GPU (Mesa) rendering.");
// Defined in template.cpp.
extern SkBitmap source;
@@ -119,8 +122,22 @@ int main(int argc, char** argv) {
SkFILEWStream stream(FLAGS_out[0]);
SkImageInfo info = SkImageInfo::MakeN32(FLAGS_width, FLAGS_height, kPremul_SkAlphaType);
- SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
- SkCanvas* canvas = surface->getCanvas();
+
+ SkCanvas *canvas;
tfarina 2014/10/13 21:28:12 'SkCanvas* canvas;'?
humper 2014/10/13 21:50:06 Done.
+ SkAutoTUnref<SkSurface> surface;
+
+ GrContextFactory* grFactory = NULL;
+
+ if (FLAGS_gpu) {
+ GrContext::Options grContextOpts;
+ grFactory = new GrContextFactory(grContextOpts);
+ GrContext *gr = grFactory->get(GrContextFactory::kMESA_GLContextType);
tfarina 2014/10/13 21:28:12 keep the "*" with the type rather than the variabl
humper 2014/10/13 21:50:06 Done.
+ surface.reset(SkSurface::NewRenderTarget(gr,info));
+ } else {
+ surface.reset(SkSurface::NewRaster(info));
+ }
+
+ canvas = surface->getCanvas();
setLimits();
« no previous file with comments | « no previous file | experimental/webtry/res/js/webtry.js » ('j') | experimental/webtry/scripts/fiddle_gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698