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

Unified Diff: experimental/webtry/main.cpp

Issue 294903017: Add the ability to select a source image to use in the code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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 | « experimental/webtry/DESIGN.md ('k') | experimental/webtry/res/css/webtry.css » ('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 7ccb9322f9c96554dd4e3a9f56aa7b21423338d7..44f8aab70f4c450a48db6bd5ecb8ab90cb2e3542 100644
--- a/experimental/webtry/main.cpp
+++ b/experimental/webtry/main.cpp
@@ -6,6 +6,7 @@
#include "SkData.h"
#include "SkForceLinking.h"
#include "SkGraphics.h"
+#include "SkImageDecoder.h"
#include "SkImageEncoder.h"
#include "SkImageInfo.h"
#include "SkStream.h"
@@ -16,6 +17,10 @@
__SK_FORCE_IMAGE_DECODER_LINKING;
DEFINE_string(out, "", "Filename of the PNG to write to.");
+DEFINE_string(source, "", "Filename of the source image.");
+
+// Defined in template.cpp.
+extern SkBitmap source;
static bool install_syscall_filter() {
struct sock_filter filter[] = {
@@ -89,6 +94,13 @@ int main(int argc, char** argv) {
perror("The --out flag must have an argument.");
return 1;
}
+
+ if (FLAGS_source.count() == 1) {
+ if (!SkImageDecoder::DecodeFile(FLAGS_source[0], &source)) {
+ perror("Unable to read the source image.");
+ }
+ }
+
SkFILEWStream stream(FLAGS_out[0]);
SkImageInfo info = SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType);
« no previous file with comments | « experimental/webtry/DESIGN.md ('k') | experimental/webtry/res/css/webtry.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698