| Index: experimental/webtry/main.cpp
|
| diff --git a/experimental/webtry/main.cpp b/experimental/webtry/main.cpp
|
| index 0a71d9613333de2f86b45fb9dd2265608ab87dda..98c2f5e4e68aa6a6421d32bb6533da005a1414e3 100644
|
| --- a/experimental/webtry/main.cpp
|
| +++ b/experimental/webtry/main.cpp
|
| @@ -9,6 +9,7 @@
|
| #include "SkImageDecoder.h"
|
| #include "SkImageEncoder.h"
|
| #include "SkImageInfo.h"
|
| +#include "SkOSFile.h"
|
| #include "SkStream.h"
|
| #include "SkSurface.h"
|
|
|
| @@ -18,6 +19,8 @@ __SK_FORCE_IMAGE_DECODER_LINKING;
|
|
|
| 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.");
|
|
|
| // Defined in template.cpp.
|
| extern SkBitmap source;
|
| @@ -102,14 +105,20 @@ int main(int argc, char** argv) {
|
| }
|
|
|
| if (FLAGS_source.count() == 1) {
|
| - if (!SkImageDecoder::DecodeFile(FLAGS_source[0], &source)) {
|
| - perror("Unable to read the source image.");
|
| - }
|
| + const char *sourceDir = getenv("WEBTRY_INOUT");
|
| + if (NULL == sourceDir) {
|
| + sourceDir = "/skia_build/inout";
|
| + }
|
| +
|
| + SkString sourcePath = SkOSPath::Join(sourceDir, FLAGS_source[0]);
|
| + if (!SkImageDecoder::DecodeFile(sourcePath.c_str(), &source)) {
|
| + perror("Unable to read the source image.");
|
| + }
|
| }
|
|
|
| SkFILEWStream stream(FLAGS_out[0]);
|
|
|
| - SkImageInfo info = SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType);
|
| + SkImageInfo info = SkImageInfo::MakeN32(FLAGS_width, FLAGS_height, kPremul_SkAlphaType);
|
| SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
|
| SkCanvas* canvas = surface->getCanvas();
|
|
|
|
|