aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar yujieqin <yujieqin@google.com>2016-01-25 05:29:03 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-25 05:29:03 -0800
commit6bd8639f8c142eedf543f4e5f3b02d2bf11df308 (patch)
tree5bd59bdc08a970d257a5851c25851c0f7bac730b /dm
parent4d8b7bafb22bf587145fc0a2b6109fa1d7981370 (diff)
Add RAW decoding into Skia.
Diffstat (limited to 'dm')
-rw-r--r--dm/DM.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 5124442a20..12ce23c6a1 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -520,6 +520,20 @@ static bool brd_supported(const char* ext) {
return false;
}
+static bool is_raw(const SkString& file) {
+ 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",
+ };
+
+ for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) {
+ if (file.endsWith(exts[i])) {
+ return true;
+ }
+ }
+ return false;
+}
+
static void gather_srcs() {
for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->next()) {
push_src("gm", "", new GMSrc(r->factory()));
@@ -538,6 +552,8 @@ static void gather_srcs() {
static const char* const exts[] = {
"bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico",
"BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO",
+ "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw",
+ "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW",
};
for (int i = 0; i < FLAGS_images.count(); i++) {
const char* flag = FLAGS_images[i];
@@ -546,7 +562,9 @@ 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", "decode", new ImageSrc(path)); // Decode entire image
+ if (!is_raw(file)) {
+ push_src("image", "decode", new ImageSrc(path)); // Decode entire image
+ }
push_codec_srcs(path);
if (brd_supported(exts[j])) {
push_brd_srcs(path);
@@ -555,7 +573,9 @@ static void gather_srcs() {
}
} else if (sk_exists(flag)) {
// assume that FLAGS_images[i] is a valid image if it is a file.
- push_src("image", "decode", new ImageSrc(flag)); // Decode entire image.
+ if (!is_raw(SkString(flag))) {
+ push_src("image", "decode", new ImageSrc(flag)); // Decode entire image.
+ }
push_codec_srcs(flag);
push_brd_srcs(flag);
}