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

Unified Diff: tools/skimage_main.cpp

Issue 19587003: Test decoding the bounds in skimage. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove extra newline Created 7 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skimage_main.cpp
diff --git a/tools/skimage_main.cpp b/tools/skimage_main.cpp
index 6cfc36c7372820760d5986e5e03e434cba3b3de6..ef5c133fc6ba55e8b1003efb5faa261e622cebc8 100644
--- a/tools/skimage_main.cpp
+++ b/tools/skimage_main.cpp
@@ -327,6 +327,22 @@ static void decodeFileAndWrite(const char srcPath[], const SkString* writePath)
return;
}
+ // Test decoding just the bounds. The bounds should always match.
+ {
+ stream.rewind();
+ SkBitmap dim;
+ if (!codec->decode(&stream, &dim, SkImageDecoder::kDecodeBounds_Mode)) {
+ SkString failure = SkStringPrintf("failed to decode bounds for %s", srcPath);
+ gDecodeFailures.push_back() = failure;
+ } else {
+ // Now check that the bounds match:
+ if (dim.width() != bitmap.width() || dim.height() != bitmap.height()) {
+ SkString failure = SkStringPrintf("bounds do not match for %s", srcPath);
+ gDecodeFailures.push_back() = failure;
+ }
+ }
+ }
+
if (compare_to_expectations_if_necessary(bitmap, filename, &gDecodeFailures)) {
gSuccessfulDecodes.push_back().printf("%s [%d %d]", srcPath, bitmap.width(),
bitmap.height());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698