Index: dm/DMSrcSink.cpp |
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp |
index 30cdbf085d0ccbc1f326778057f58f7d8a16d2b8..6c37c3c3723c7aa8ead1bd141fd74345d52f4f0f 100644 |
--- a/dm/DMSrcSink.cpp |
+++ b/dm/DMSrcSink.cpp |
@@ -38,6 +38,9 @@ |
DEFINE_bool(multiPage, false, "For document-type backends, render the source" |
" into multiple pages"); |
+#ifdef SK_CODEC_DECODES_RAW |
mtklein
2016/02/08 21:26:55
Doesn't need an ifdef?
scroggo
2016/02/08 21:31:30
Not needed, but I think it makes sense. If it's no
mtklein
2016/02/08 21:45:47
Please no ifdefs that don't strictly matter.
scroggo
2016/02/08 21:47:48
Done.
|
+DEFINE_bool(RAW_threading, true, "Allow RAW decodes to run on multiple threads?"); |
+#endif |
static bool lazy_decode_bitmap(const void* src, size_t size, SkBitmap* dst) { |
SkAutoTUnref<SkData> encoded(SkData::NewWithCopy(src, size)); |
@@ -238,6 +241,27 @@ Name BRDSrc::name() const { |
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
+static bool serial_from_path_name(const SkString& path) { |
+#ifdef SK_CODEC_DECODES_RAW |
mtklein
2016/02/08 21:26:55
Doesn't need an ifdef?
scroggo
2016/02/08 21:31:30
This ifdef isn't strictly necessary, but it skips
mtklein
2016/02/08 21:45:47
Ditto.
(We're not allowed to pretend we're optimi
scroggo
2016/02/08 21:47:48
Done.
|
+ if (!FLAGS_RAW_threading) { |
+ static const char* const exts[] = { |
+ "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", |
+ "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", |
+ }; |
+ const char* actualExt = strrchr(path.c_str(), '.'); |
+ if (actualExt) { |
+ actualExt++; |
+ for (auto* ext : exts) { |
+ if (0 == strcmp(ext, actualExt)) { |
+ return true; |
+ } |
+ } |
+ } |
+ } |
+#endif |
+ return false; |
+} |
+ |
CodecSrc::CodecSrc(Path path, Mode mode, DstColorType dstColorType, SkAlphaType dstAlphaType, |
float scale) |
: fPath(path) |
@@ -245,6 +269,7 @@ CodecSrc::CodecSrc(Path path, Mode mode, DstColorType dstColorType, SkAlphaType |
, fDstColorType(dstColorType) |
, fDstAlphaType(dstAlphaType) |
, fScale(scale) |
+ , fRunSerially(serial_from_path_name(path)) |
{} |
bool CodecSrc::veto(SinkFlags flags) const { |
@@ -612,6 +637,7 @@ AndroidCodecSrc::AndroidCodecSrc(Path path, Mode mode, CodecSrc::DstColorType ds |
, fDstColorType(dstColorType) |
, fDstAlphaType(dstAlphaType) |
, fSampleSize(sampleSize) |
+ , fRunSerially(serial_from_path_name(path)) |
{} |
bool AndroidCodecSrc::veto(SinkFlags flags) const { |