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

Unified Diff: experimental/webtry/main.cpp

Issue 638003008: Re-land ganesh checkbox. I needed to increase the size of the address (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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') | no next file with comments »
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..4116446add3ee2f269def0c5e3a201e15ea7906c 100644
--- a/experimental/webtry/main.cpp
+++ b/experimental/webtry/main.cpp
@@ -1,6 +1,8 @@
#include <sys/time.h>
#include <sys/resource.h>
+#include "GrContextFactory.h"
+
#include "SkCanvas.h"
#include "SkCommandLineFlags.h"
#include "SkData.h"
@@ -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;
@@ -85,9 +88,9 @@ static void setLimits() {
perror("setrlimit(RLIMIT_CPU)");
}
- // Limit to 50M of Address space.
- n.rlim_cur = 50000000;
- n.rlim_max = 50000000;
+ // Limit to 150M of Address space.
+ n.rlim_cur = 150000000;
+ n.rlim_max = 150000000;
if (setrlimit(RLIMIT_AS, &n)) {
perror("setrlimit(RLIMIT_CPU)");
}
@@ -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;
+ SkAutoTUnref<SkSurface> surface;
+
+ GrContextFactory* grFactory = NULL;
+
+ if (FLAGS_gpu) {
+ GrContext::Options grContextOpts;
+ grFactory = new GrContextFactory(grContextOpts);
+ GrContext* gr = grFactory->get(GrContextFactory::kMESA_GLContextType);
+ surface.reset(SkSurface::NewRenderTarget(gr,info));
+ } else {
+ surface.reset(SkSurface::NewRaster(info));
+ }
+
+ canvas = surface->getCanvas();
setLimits();
@@ -138,4 +155,5 @@ int main(int argc, char** argv) {
exit(1);
}
stream.write(data->data(), data->size());
+ delete grFactory;
}
« no previous file with comments | « no previous file | experimental/webtry/res/js/webtry.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698