| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "BenchTimer.h" | 8 #include "BenchTimer.h" |
| 9 #include "CopyTilesRenderer.h" | 9 #include "CopyTilesRenderer.h" |
| 10 #include "PictureBenchmark.h" | 10 #include "PictureBenchmark.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 return false; | 166 return false; |
| 167 } | 167 } |
| 168 | 168 |
| 169 // Since the old picture has been deleted, all pixels should be cleared. | 169 // Since the old picture has been deleted, all pixels should be cleared. |
| 170 SkASSERT(gLruImageCache.getImageCacheUsed() == 0); | 170 SkASSERT(gLruImageCache.getImageCacheUsed() == 0); |
| 171 if (FLAGS_countRAM) { | 171 if (FLAGS_countRAM) { |
| 172 // Set the limit to zero, so all pixels will be kept | 172 // Set the limit to zero, so all pixels will be kept |
| 173 gLruImageCache.setImageCacheLimit(0); | 173 gLruImageCache.setImageCacheLimit(0); |
| 174 } | 174 } |
| 175 | 175 |
| 176 bool success = false; | 176 SkPicture::InstallPixelRefProc proc; |
| 177 SkPicture* picture; | |
| 178 if (FLAGS_deferImageDecoding) { | 177 if (FLAGS_deferImageDecoding) { |
| 179 picture = SkNEW_ARGS(SkPicture, (&inputStream, &success, &lazy_decode_bi
tmap)); | 178 proc = &lazy_decode_bitmap; |
| 180 } else { | 179 } else { |
| 181 picture = SkNEW_ARGS(SkPicture, (&inputStream, &success, &SkImageDecoder
::DecodeMemory)); | 180 proc = &SkImageDecoder::DecodeMemory; |
| 182 } | 181 } |
| 183 SkAutoTDelete<SkPicture> ad(picture); | 182 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); |
| 184 | 183 |
| 185 if (!success) { | 184 if (NULL == picture.get()) { |
| 186 SkString err; | 185 SkString err; |
| 187 err.printf("Could not read an SkPicture from %s\n", inputPath.c_str()); | 186 err.printf("Could not read an SkPicture from %s\n", inputPath.c_str()); |
| 188 gLogger.logError(err); | 187 gLogger.logError(err); |
| 189 return false; | 188 return false; |
| 190 } | 189 } |
| 191 | 190 |
| 192 SkString filename; | 191 SkString filename; |
| 193 sk_tools::get_basename(&filename, inputPath); | 192 sk_tools::get_basename(&filename, inputPath); |
| 194 | 193 |
| 195 SkString result; | 194 SkString result; |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 } | 441 } |
| 443 #endif | 442 #endif |
| 444 return 0; | 443 return 0; |
| 445 } | 444 } |
| 446 | 445 |
| 447 #if !defined SK_BUILD_FOR_IOS | 446 #if !defined SK_BUILD_FOR_IOS |
| 448 int main(int argc, char * const argv[]) { | 447 int main(int argc, char * const argv[]) { |
| 449 return tool_main(argc, (char**) argv); | 448 return tool_main(argc, (char**) argv); |
| 450 } | 449 } |
| 451 #endif | 450 #endif |
| OLD | NEW |