Chromium Code Reviews| Index: dm/DMSrcSink.cpp |
| diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp |
| index a0dcb1cfc5b08ce16c3455f5097b44ba288b233a..a6c912abda309c3e76e4c1ce4818c4a056ed1546 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 |
| +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)); |
| @@ -46,6 +49,14 @@ static bool lazy_decode_bitmap(const void* src, size_t size, SkBitmap* dst) { |
| namespace DM { |
| +const char* SkStringExtension(const SkString& string) { |
| + int index = string.findLastOf('.'); |
| + if (index >= 0 && (size_t) ++index < string.size()) { |
| + return &string.c_str()[index]; |
| + } |
| + return ""; |
| +} |
| + |
| GMSrc::GMSrc(skiagm::GMRegistry::Factory factory) : fFactory(factory) {} |
| Error GMSrc::draw(SkCanvas* canvas) const { |
| @@ -603,6 +614,24 @@ Name CodecSrc::name() const { |
| return get_scaled_name(fPath, fScale); |
| } |
| +int CodecSrc::enclave() const { |
|
msarett
2016/02/08 19:35:37
I think AndroidCodecSrc should also override encla
scroggo
2016/02/08 20:08:12
Yep. That's at least partially responsible for my
|
| +#ifdef SK_CODEC_DECODES_RAW |
|
mtklein
2016/02/08 21:26:55
Why #ifdef? Doesn't the actual logic you wrote st
|
| + 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 = SkStringExtension(fPath); |
| + for (auto* ext : exts) { |
| + if (0 == strcmp(ext, actualExt)) { |
| + return kRAW_Enclave; |
| + } |
| + } |
| + } |
| +#endif |
| + return kAnyThread_Enclave; |
| +} |
| + |
| /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
| AndroidCodecSrc::AndroidCodecSrc(Path path, Mode mode, CodecSrc::DstColorType dstColorType, |