Index: dm/DM.cpp |
diff --git a/dm/DM.cpp b/dm/DM.cpp |
index acd4410974c6bef80ef8fe9bec9459832273eb11..d8b9c0630e70887261336df5f5a0f8f000273e65 100644 |
--- a/dm/DM.cpp |
+++ b/dm/DM.cpp |
@@ -133,20 +133,24 @@ static void gather_gold() { |
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
template <typename T> |
-struct Tagged : public SkAutoTDelete<T> { const char* tag; }; |
+struct Tagged : public SkAutoTDelete<T> { |
+ const char* tag; |
+ const char* options; |
djsollen
2015/04/02 17:25:07
I'm thinking of storing an SkString on this struct
mtklein
2015/04/02 17:48:08
Let's leave them apart for now, given that we're n
|
+}; |
static const bool kMemcpyOK = true; |
static SkTArray<Tagged<Src>, kMemcpyOK> gSrcs; |
static SkTArray<Tagged<Sink>, kMemcpyOK> gSinks; |
-static void push_src(const char* tag, Src* s) { |
+static void push_src(const char* tag, Src* s, const char* options = nullptr) { |
mtklein
2015/04/02 17:48:09
Let's pass this as the second argument and explici
|
SkAutoTDelete<Src> src(s); |
if (FLAGS_src.contains(tag) && |
!SkCommandLineFlags::ShouldSkip(FLAGS_match, src->name().c_str())) { |
Tagged<Src>& s = gSrcs.push_back(); |
s.reset(src.detach()); |
s.tag = tag; |
+ s.options = options; |
} |
} |
@@ -192,20 +196,20 @@ static void gather_srcs() { |
SkOSFile::Iter it(flag, exts[j]); |
for (SkString file; it.next(&file); ) { |
SkString path = SkOSPath::Join(flag, file.c_str()); |
- push_src("image", new ImageSrc(path)); // Decode entire image. |
- push_src("subset", new ImageSrc(path, 2)); // Decode into 2 x 2 subsets |
+ push_src("image", new ImageSrc(path), "image"); // Decode entire image |
mtklein
2015/04/02 17:48:08
Might want this "image" to be "default" so we don'
|
+ push_src("image", new ImageSrc(path, 2), "subset"); // Decode into 2x2 subsets |
if (codec_supported(exts[j])) { |
- push_src("codec", new CodecSrc(path, CodecSrc::kNormal_Mode)); |
- push_src("scanline", new CodecSrc(path, CodecSrc::kScanline_Mode)); |
+ push_src("image", new CodecSrc(path, CodecSrc::kNormal_Mode), "codec"); |
+ push_src("image", new CodecSrc(path, CodecSrc::kScanline_Mode), "scanline"); |
} |
} |
} |
} else if (sk_exists(flag)) { |
// assume that FLAGS_images[i] is a valid image if it is a file. |
- push_src("image", new ImageSrc(flag)); // Decode entire image. |
- push_src("subset", new ImageSrc(flag, 2)); // Decode into 2 x 2 subsets |
- push_src("codec", new CodecSrc(flag, CodecSrc::kNormal_Mode)); |
- push_src("scanline", new CodecSrc(flag, CodecSrc::kScanline_Mode)); |
+ push_src("image", new ImageSrc(flag), "image"); // Decode entire image. |
+ push_src("image", new ImageSrc(flag, 2), "subset"); // Decode into 2 x 2 subsets |
+ push_src("image", new CodecSrc(flag, CodecSrc::kNormal_Mode), "codec"); |
+ push_src("image", new CodecSrc(flag, CodecSrc::kScanline_Mode), "scanline"); |
} |
} |
} |
@@ -438,11 +442,12 @@ struct Task { |
SkStream* data, size_t len, |
const SkBitmap* bitmap) { |
JsonWriter::BitmapResult result; |
- result.name = task.src->name(); |
- result.config = task.sink.tag; |
- result.sourceType = task.src.tag; |
- result.ext = ext; |
- result.md5 = md5; |
+ result.name = task.src->name(); |
+ result.config = task.sink.tag; |
+ result.sourceType = task.src.tag; |
+ result.sourceOptions = task.src.options; |
+ result.ext = ext; |
+ result.md5 = md5; |
JsonWriter::AddBitmapResult(result); |
const char* dir = FLAGS_writePath[0]; |