| 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);
|
| }
|
| }
|
|
|
|
|