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

Unified Diff: dm/DM.cpp

Issue 1322773004: Revert of Provides multiple implementations of Android's SkBitmapRegionDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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.h » ('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 154f8aa846ea2c9fa3f2e7a3aeced180802aa2be..becea6ca6cf00c2c6eae2c548ec4692cd850628b 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -327,116 +327,12 @@
}
}
-static bool brd_color_type_supported(SkBitmapRegionDecoderInterface::Strategy strategy,
- CodecSrc::DstColorType dstColorType) {
- switch (strategy) {
- case SkBitmapRegionDecoderInterface::kCanvas_Strategy:
- if (CodecSrc::kGetFromCanvas_DstColorType == dstColorType) {
- return true;
- }
- return false;
- case SkBitmapRegionDecoderInterface::kOriginal_Strategy:
- switch (dstColorType) {
- case CodecSrc::kGetFromCanvas_DstColorType:
- case CodecSrc::kIndex8_Always_DstColorType:
- case CodecSrc::kGrayscale_Always_DstColorType:
- return true;
- default:
- return false;
- }
- default:
- SkASSERT(false);
- return false;
- }
-}
-
-static void push_brd_src(Path path, SkBitmapRegionDecoderInterface::Strategy strategy,
- CodecSrc::DstColorType dstColorType, BRDSrc::Mode mode, uint32_t sampleSize) {
- SkString folder;
- switch (strategy) {
- case SkBitmapRegionDecoderInterface::kCanvas_Strategy:
- folder.append("brd_canvas");
- break;
- case SkBitmapRegionDecoderInterface::kOriginal_Strategy:
- folder.append("brd_sample");
- break;
- default:
- SkASSERT(false);
- return;
- }
-
- switch (mode) {
- case BRDSrc::kFullImage_Mode:
- break;
- case BRDSrc::kDivisor_Mode:
- folder.append("_divisor");
- break;
- default:
- SkASSERT(false);
- return;
- }
-
- switch (dstColorType) {
- case CodecSrc::kGetFromCanvas_DstColorType:
- break;
- case CodecSrc::kIndex8_Always_DstColorType:
- folder.append("_kIndex");
- break;
- case CodecSrc::kGrayscale_Always_DstColorType:
- folder.append("_kGray");
- break;
- default:
- SkASSERT(false);
- return;
- }
-
- if (1 != sampleSize) {
- folder.appendf("_%.3f", BRDSrc::GetScale(sampleSize));
- }
-
- BRDSrc* src = new BRDSrc(path, strategy, mode, dstColorType, sampleSize);
- push_src("image", folder, src);
-}
-
-static void push_brd_srcs(Path path) {
-
- const SkBitmapRegionDecoderInterface::Strategy strategies[] = {
- SkBitmapRegionDecoderInterface::kCanvas_Strategy,
- SkBitmapRegionDecoderInterface::kOriginal_Strategy
- };
-
- // We will only test to one backend (8888), but we will test all of the
- // color types that we need to decode to on this backend.
- const CodecSrc::DstColorType dstColorTypes[] = {
- CodecSrc::kGetFromCanvas_DstColorType,
- CodecSrc::kIndex8_Always_DstColorType,
- CodecSrc::kGrayscale_Always_DstColorType,
- };
-
- const BRDSrc::Mode modes[] = {
- BRDSrc::kFullImage_Mode,
- BRDSrc::kDivisor_Mode
- };
-
- const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
-
- for (SkBitmapRegionDecoderInterface::Strategy strategy : strategies) {
- for (CodecSrc::DstColorType dstColorType : dstColorTypes) {
- if (brd_color_type_supported(strategy, dstColorType)) {
- for (BRDSrc::Mode mode : modes) {
- for (uint32_t sampleSize : sampleSizes) {
- push_brd_src(path, strategy, dstColorType, mode, sampleSize);
- }
- }
- }
- }
- }
-}
-
-static bool brd_supported(const char* ext) {
+static bool codec_supported(const char* ext) {
+ // FIXME: Once other versions of SkCodec are available, we can add them to this
+ // list (and eventually we can remove this check once they are all supported).
static const char* const exts[] = {
- "jpg", "jpeg", "png", "webp",
- "JPG", "JPEG", "PNG", "WEBP",
+ "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", "webp",
+ "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP", "WEBP",
};
for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) {
@@ -475,9 +371,8 @@
SkString path = SkOSPath::Join(flag, file.c_str());
push_src("image", "decode", new ImageSrc(path)); // Decode entire image
push_src("image", "subset", new ImageSrc(path, 2)); // Decode into 2x2 subsets
- push_codec_srcs(path);
- if (brd_supported(exts[j])) {
- push_brd_srcs(path);
+ if (codec_supported(exts[j])) {
+ push_codec_srcs(path);
}
}
}
@@ -486,7 +381,6 @@
push_src("image", "decode", new ImageSrc(flag)); // Decode entire image.
push_src("image", "subset", new ImageSrc(flag, 2)); // Decode into 2 x 2 subsets
push_codec_srcs(flag);
- push_brd_srcs(flag);
}
}
}
« no previous file with comments | « no previous file | dm/DMSrcSink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698