aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2016-01-27 08:26:44 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-27 08:26:44 -0800
commit0edf1693dfd8360f5b8256e0700c2240854c010f (patch)
tree81fa016ed543c262d07d952438ad0775349d73f3 /dm
parent076d83d09a5717913cfecabac0440b6c854ca86d (diff)
Stop testing SkImageDecoder in DM/nanobench
We have already used it for comparison, and are switching forward to using SkCodec. This also allows us to simplify the code for checking the extensions we support for images. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1641663002 Review URL: https://codereview.chromium.org/1641663002
Diffstat (limited to 'dm')
-rw-r--r--dm/DM.cpp20
-rw-r--r--dm/DMSrcSink.cpp50
-rw-r--r--dm/DMSrcSink.h12
3 files changed, 0 insertions, 82 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 9f2684cea9..d53402e723 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -519,20 +519,6 @@ 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()));
@@ -561,9 +547,6 @@ static void gather_srcs() {
SkOSFile::Iter it(flag, exts[j]);
for (SkString file; it.next(&file); ) {
SkString path = SkOSPath::Join(flag, file.c_str());
- 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);
@@ -572,9 +555,6 @@ static void gather_srcs() {
}
} else if (sk_exists(flag)) {
// assume that FLAGS_images[i] is a valid image if it is a file.
- if (!is_raw(SkString(flag))) {
- push_src("image", "decode", new ImageSrc(flag)); // Decode entire image.
- }
push_codec_srcs(flag);
push_brd_srcs(flag);
}
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 5b20e3959f..29886807a7 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -733,56 +733,6 @@ Name AndroidCodecSrc::name() const {
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-ImageSrc::ImageSrc(Path path) : fPath(path) {}
-
-bool ImageSrc::veto(SinkFlags flags) const {
- // No need to test decoding to non-raster or indirect backend.
- // TODO: Instead, use lazy decoding to allow the GPU to handle cases like YUV.
- return flags.type != SinkFlags::kRaster
- || flags.approach != SinkFlags::kDirect;
-}
-
-Error ImageSrc::draw(SkCanvas* canvas) const {
- SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str()));
- if (!encoded) {
- return SkStringPrintf("Couldn't read %s.", fPath.c_str());
- }
- const SkColorType dstColorType = canvas->imageInfo().colorType();
-
- // Decode the full image.
- SkBitmap bitmap;
- if (!SkImageDecoder::DecodeMemory(encoded->data(), encoded->size(), &bitmap,
- dstColorType, SkImageDecoder::kDecodePixels_Mode)) {
- return SkStringPrintf("Couldn't decode %s.", fPath.c_str());
- }
- if (kRGB_565_SkColorType == dstColorType && !bitmap.isOpaque()) {
- // Do not draw a bitmap with alpha to a destination without alpha.
- return Error::Nonfatal("Uninteresting to decode image with alpha into 565.");
- }
- encoded.reset((SkData*)nullptr); // Might as well drop this when we're done with it.
- canvas->drawBitmap(bitmap, 0,0);
- return "";
-}
-
-SkISize ImageSrc::size() const {
- SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str()));
- SkBitmap bitmap;
- if (!encoded || !SkImageDecoder::DecodeMemory(encoded->data(),
- encoded->size(),
- &bitmap,
- kUnknown_SkColorType,
- SkImageDecoder::kDecodeBounds_Mode)) {
- return SkISize::Make(0,0);
- }
- return bitmap.dimensions();
-}
-
-Name ImageSrc::name() const {
- return SkOSPath::Basename(fPath.c_str());
-}
-
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
static const SkRect kSKPViewport = {0,0, 1000,1000};
SKPSrc::SKPSrc(Path path) : fPath(path) {}
diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h
index 632744cd62..d02eeaf101 100644
--- a/dm/DMSrcSink.h
+++ b/dm/DMSrcSink.h
@@ -180,18 +180,6 @@ private:
uint32_t fSampleSize;
};
-class ImageSrc : public Src {
-public:
- explicit ImageSrc(Path path);
-
- Error draw(SkCanvas*) const override;
- SkISize size() const override;
- Name name() const override;
- bool veto(SinkFlags) const override;
-private:
- Path fPath;
-};
-
class SKPSrc : public Src {
public:
explicit SKPSrc(Path path);