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

Unified Diff: dm/DMSrcSink.cpp

Issue 1681553003: Optionally run RAW images serially (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove ifdefs Created 4 years, 10 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 | « dm/DMSrcSink.h ('k') | tools/dm_flags.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 30cdbf085d0ccbc1f326778057f58f7d8a16d2b8..dd994b609015e31d951df3eab3bc29cee631cafa 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -38,6 +38,7 @@
DEFINE_bool(multiPage, false, "For document-type backends, render the source"
" into multiple pages");
+DEFINE_bool(RAW_threading, true, "Allow RAW decodes to run on multiple threads?");
static bool lazy_decode_bitmap(const void* src, size_t size, SkBitmap* dst) {
SkAutoTUnref<SkData> encoded(SkData::NewWithCopy(src, size));
@@ -238,6 +239,25 @@ Name BRDSrc::name() const {
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+static bool serial_from_path_name(const SkString& path) {
+ 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;
+ }
+ }
+ }
+ }
+ return false;
+}
+
CodecSrc::CodecSrc(Path path, Mode mode, DstColorType dstColorType, SkAlphaType dstAlphaType,
float scale)
: fPath(path)
@@ -245,6 +265,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 +633,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 {
« no previous file with comments | « dm/DMSrcSink.h ('k') | tools/dm_flags.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698