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

Unified Diff: dm/DM.cpp

Issue 2000783002: Exit before reaching some Nonfatal errors (Closed) Base URL: https://skia.googlesource.com/skia.git@opaque
Patch Set: Created 4 years, 7 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 | « no previous file | dm/DMSrcSink.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DM.cpp
diff --git a/dm/DM.cpp b/dm/DM.cpp
index d35787e1c75d4a6492b7b5d16080e97d67fc6283..c8464599e5cf5f426be6c6d320962144ca415df0 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -463,18 +463,7 @@ static void push_image_gen_src(Path path, ImageGenSrc::Mode mode, SkAlphaType al
push_src("image", folder, src);
}
-static void push_codec_srcs(Path path) {
- SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
- if (!encoded) {
- info("Couldn't read %s.", path.c_str());
- return;
- }
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
- if (nullptr == codec.get()) {
- info("Couldn't create codec for %s.", path.c_str());
- return;
- }
-
+static void push_codec_srcs(Path path, SkCodec* codec) {
// native scaling is only supported by WEBP and JPEG
bool supportsNativeScaling = false;
@@ -641,7 +630,7 @@ static void push_brd_src(Path path, CodecSrc::DstColorType dstColorType, BRDSrc:
push_src("image", folder, src);
}
-static void push_brd_srcs(Path path) {
+static void push_brd_srcs(Path path, SkCodec* codec) {
// Only run Index8 and grayscale to one sampleSize and Mode. Though interesting
// to test these color types, they should not reveal anything across various
// sampleSizes and Modes
@@ -664,7 +653,14 @@ static void push_brd_srcs(Path path) {
BRDSrc::kDivisor_Mode,
};
+ const int width = codec->getInfo().width();
+ const int height = codec->getInfo().height();
for (uint32_t sampleSize : sampleSizes) {
+ if ((width / sampleSize <= 10 || height / sampleSize <= 10) && 1 != sampleSize) {
+ // Scaling very small images is uninteresting. After the first iteration,
+ // the image will only get smaller, so break here.
+ break;
+ }
for (BRDSrc::Mode mode : modes) {
push_brd_src(path, CodecSrc::kGetFromCanvas_DstColorType, mode, sampleSize);
}
@@ -707,14 +703,25 @@ static bool gather_srcs() {
}
for (auto image : images) {
- push_codec_srcs(image);
+ SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(image.c_str()));
+ if (!encoded) {
+ info("Couldn't read %s.", image.c_str());
+ continue;
+ }
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
+ if (nullptr == codec.get()) {
+ info("Couldn't create codec for %s.", image.c_str());
+ continue;
+ }
+
+ push_codec_srcs(image, codec);
if (FLAGS_simpleCodec) {
continue;
}
const char* ext = strrchr(image.c_str(), '.');
if (ext && brd_supported(ext+1)) {
- push_brd_srcs(image);
+ push_brd_srcs(image, codec);
}
}
« no previous file with comments | « no previous file | dm/DMSrcSink.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698