aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm/DM.cpp
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@chromium.org>2016-02-25 11:03:47 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-25 11:03:47 -0800
commite4499849df904c30c21e0eacaf11b9e9a985313f (patch)
tree95ef40eab92a0bbbb363e0be139e2a72fea8170c /dm/DM.cpp
parent3552ba18ee41e135d6fc52228adae37794fc15ff (diff)
Add a DM flag to limit the types of Codec decodes
When the flag "simpleCodec" is set to true, we will only decode to the canvas colortype and to a scale of 1. No SkAndroidCodec or BRDCodec tests are run. This makes it easier to find the simple case when running locally. Clean up some SkImageDecoder references along the way. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1735743003 Review URL: https://codereview.chromium.org/1735743003
Diffstat (limited to 'dm/DM.cpp')
-rw-r--r--dm/DM.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 91a92ea76b..9021f3c789 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -17,7 +17,6 @@
#include "SkCommonFlags.h"
#include "SkCommonFlagsConfig.h"
#include "SkFontMgr.h"
-#include "SkForceLinking.h"
#include "SkGraphics.h"
#include "SkMD5.h"
#include "SkMutex.h"
@@ -65,8 +64,8 @@ DEFINE_string(uninterestingHashesFile, "",
DEFINE_int32(shards, 1, "We're splitting source data into this many shards.");
DEFINE_int32(shard, 0, "Which shard do I run?");
+DEFINE_bool(simpleCodec, false, "Only decode images to native scale");
-__SK_FORCE_IMAGE_DECODER_LINKING;
using namespace DM;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
@@ -239,6 +238,12 @@ static void push_src(const char* tag, ImplicitString options, Src* s) {
static void push_codec_src(Path path, CodecSrc::Mode mode, CodecSrc::DstColorType dstColorType,
SkAlphaType dstAlphaType, float scale) {
+ if (FLAGS_simpleCodec) {
+ if (mode != CodecSrc::kCodec_Mode || dstColorType != CodecSrc::kGetFromCanvas_DstColorType
+ || scale != 1.0f)
+ // Only decode in the simple case.
+ return;
+ }
SkString folder;
switch (mode) {
case CodecSrc::kCodec_Mode:
@@ -355,8 +360,6 @@ static void push_codec_srcs(Path path) {
}
// Native Scales
- // TODO (msarett): Implement scaling tests for SkImageDecoder in order to compare with these
- // tests. SkImageDecoder supports downscales by integer factors.
// SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875
const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f, 1.0f };
@@ -434,6 +437,10 @@ static void push_codec_srcs(Path path) {
}
}
+ if (FLAGS_simpleCodec) {
+ return;
+ }
+
// https://bug.skia.org/4428
bool subset = false;
// The following image types are supported by BitmapRegionDecoder,
@@ -613,6 +620,10 @@ static bool gather_srcs() {
for (auto image : images) {
push_codec_srcs(image);
+ if (FLAGS_simpleCodec) {
+ continue;
+ }
+
const char* ext = strrchr(image.c_str(), '.');
if (ext && brd_supported(ext+1)) {
push_brd_srcs(image);