OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkCommandLineFlags.h" | 10 #include "SkCommandLineFlags.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 SkString subsetDim = SkStringPrintf("[%d,%d,%d,%d]", rect.fLeft,
rect.fTop, | 199 SkString subsetDim = SkStringPrintf("[%d,%d,%d,%d]", rect.fLeft,
rect.fTop, |
200 rect.fRight, rect.fBottom); | 200 rect.fRight, rect.fBottom); |
201 if (codec->decodeSubset(&bitmapFromDecodeSubset, rect, SkBitmap:
:kNo_Config)) { | 201 if (codec->decodeSubset(&bitmapFromDecodeSubset, rect, SkBitmap:
:kNo_Config)) { |
202 gSuccessfulSubsetDecodes.push_back().printf("Decoded subset
%s from %s", | 202 gSuccessfulSubsetDecodes.push_back().printf("Decoded subset
%s from %s", |
203 subsetDim.c_str(), src
Path); | 203 subsetDim.c_str(), src
Path); |
204 if (writePath != NULL) { | 204 if (writePath != NULL) { |
205 // Write the region to a file whose name includes the di
mensions. | 205 // Write the region to a file whose name includes the di
mensions. |
206 SkString suffix = SkStringPrintf("_%s.png", subsetDim.c_
str()); | 206 SkString suffix = SkStringPrintf("_%s.png", subsetDim.c_
str()); |
207 SkString outPath; | 207 SkString outPath; |
208 make_outname(&outPath, writePath->c_str(), srcPath, suff
ix.c_str()); | 208 make_outname(&outPath, writePath->c_str(), srcPath, suff
ix.c_str()); |
209 bool success = write_bitmap(outPath.c_str(), &bitmapFrom
DecodeSubset); | 209 SkDEBUGCODE(bool success =) |
| 210 write_bitmap(outPath.c_str(), &bitmapFromDecodeSubset); |
210 SkASSERT(success); | 211 SkASSERT(success); |
211 gSuccessfulSubsetDecodes.push_back().printf("\twrote %s"
, outPath.c_str()); | 212 gSuccessfulSubsetDecodes.push_back().printf("\twrote %s"
, outPath.c_str()); |
212 // Also use extractSubset from the original for visual c
omparison. | 213 // Also use extractSubset from the original for visual c
omparison. |
213 SkBitmap extractedSubset; | 214 SkBitmap extractedSubset; |
214 if (bitmap.extractSubset(&extractedSubset, rect)) { | 215 if (bitmap.extractSubset(&extractedSubset, rect)) { |
215 suffix.printf("_%s_extracted.png", subsetDim.c_str()
); | 216 suffix.printf("_%s_extracted.png", subsetDim.c_str()
); |
216 make_outname(&outPath, writePath->c_str(), srcPath,
suffix.c_str()); | 217 make_outname(&outPath, writePath->c_str(), srcPath,
suffix.c_str()); |
217 success = write_bitmap(outPath.c_str(), &extractedSu
bset); | 218 success = write_bitmap(outPath.c_str(), &extractedSu
bset); |
218 SkASSERT(success); | 219 SkASSERT(success); |
219 } | 220 } |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 } | 384 } |
384 | 385 |
385 return failed ? -1 : 0; | 386 return failed ? -1 : 0; |
386 } | 387 } |
387 | 388 |
388 #if !defined SK_BUILD_FOR_IOS | 389 #if !defined SK_BUILD_FOR_IOS |
389 int main(int argc, char * const argv[]) { | 390 int main(int argc, char * const argv[]) { |
390 return tool_main(argc, (char**) argv); | 391 return tool_main(argc, (char**) argv); |
391 } | 392 } |
392 #endif | 393 #endif |
OLD | NEW |