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

Side by Side Diff: tools/render_pictures_main.cpp

Issue 338633011: Deprecate SkPicture::clone(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add define for chrome Created 6 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 unified diff | Download patch
OLDNEW
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 "LazyDecodeBitmap.h" 8 #include "LazyDecodeBitmap.h"
9 #include "CopyTilesRenderer.h" 9 #include "CopyTilesRenderer.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkDevice.h" 11 #include "SkDevice.h"
12 #include "SkCommandLineFlags.h" 12 #include "SkCommandLineFlags.h"
13 #include "SkGraphics.h" 13 #include "SkGraphics.h"
14 #include "SkImageDecoder.h" 14 #include "SkImageDecoder.h"
15 #include "SkImageEncoder.h" 15 #include "SkImageEncoder.h"
16 #include "SkMath.h" 16 #include "SkMath.h"
17 #include "SkOSFile.h" 17 #include "SkOSFile.h"
18 #include "SkPicture.h" 18 #include "SkPicture.h"
19 #include "SkPictureRecorder.h" 19 #include "SkPictureRecorder.h"
20 #include "SkStream.h" 20 #include "SkStream.h"
21 #include "SkString.h" 21 #include "SkString.h"
22 22
23 #include "image_expectations.h" 23 #include "image_expectations.h"
24 #include "PictureRenderer.h" 24 #include "PictureRenderer.h"
25 #include "PictureRenderingFlags.h" 25 #include "PictureRenderingFlags.h"
26 #include "picture_utils.h" 26 #include "picture_utils.h"
27 27
28 // Flags used by this file, alphabetically: 28 // Flags used by this file, alphabetically:
29 DEFINE_int32(clone, 0, "Clone the picture n times before rendering.");
30 DECLARE_bool(deferImageDecoding); 29 DECLARE_bool(deferImageDecoding);
31 DEFINE_int32(maxComponentDiff, 256, "Maximum diff on a component, 0 - 256. Compo nents that differ " 30 DEFINE_int32(maxComponentDiff, 256, "Maximum diff on a component, 0 - 256. Compo nents that differ "
32 "by more than this amount are considered errors, though all diffs a re reported. " 31 "by more than this amount are considered errors, though all diffs a re reported. "
33 "Requires --validate."); 32 "Requires --validate.");
34 DEFINE_string(mismatchPath, "", "Write images for tests that failed due to " 33 DEFINE_string(mismatchPath, "", "Write images for tests that failed due to "
35 "pixel mismatches into this directory."); 34 "pixel mismatches into this directory.");
36 DEFINE_string(readJsonSummaryPath, "", "JSON file to read image expectations fro m."); 35 DEFINE_string(readJsonSummaryPath, "", "JSON file to read image expectations fro m.");
37 DECLARE_string(readPath); 36 DECLARE_string(readPath);
38 DEFINE_bool(writeChecksumBasedFilenames, false, 37 DEFINE_bool(writeChecksumBasedFilenames, false,
39 "When writing out images, use checksum-based filenames."); 38 "When writing out images, use checksum-based filenames.");
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str()); 178 SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str());
180 return false; 179 return false;
181 } 180 }
182 181
183 while (FLAGS_bench_record) { 182 while (FLAGS_bench_record) {
184 SkPictureRecorder recorder; 183 SkPictureRecorder recorder;
185 picture->draw(recorder.beginRecording(picture->width(), picture->height( ), NULL, 0)); 184 picture->draw(recorder.beginRecording(picture->width(), picture->height( ), NULL, 0));
186 SkAutoTUnref<SkPicture> other(recorder.endRecording()); 185 SkAutoTUnref<SkPicture> other(recorder.endRecording());
187 } 186 }
188 187
189 for (int i = 0; i < FLAGS_clone; ++i) {
190 SkPicture* clone = picture->clone();
191 SkDELETE(picture);
192 picture = clone;
193 }
194
195 SkDebugf("drawing... [%i %i] %s\n", picture->width(), picture->height(), 188 SkDebugf("drawing... [%i %i] %s\n", picture->width(), picture->height(),
196 inputPath.c_str()); 189 inputPath.c_str());
197 190
198 renderer.init(picture, &writePathString, &mismatchPathString, &inputFilename , 191 renderer.init(picture, &writePathString, &mismatchPathString, &inputFilename ,
199 FLAGS_writeChecksumBasedFilenames); 192 FLAGS_writeChecksumBasedFilenames);
200 193
201 if (FLAGS_preprocess) { 194 if (FLAGS_preprocess) {
202 if (NULL != renderer.getCanvas()) { 195 if (NULL != renderer.getCanvas()) {
203 renderer.getCanvas()->EXPERIMENTAL_optimize(renderer.getPicture()); 196 renderer.getCanvas()->EXPERIMENTAL_optimize(renderer.getPicture());
204 } 197 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 if (FLAGS_maxComponentDiff < 0 || FLAGS_maxComponentDiff > 256) { 410 if (FLAGS_maxComponentDiff < 0 || FLAGS_maxComponentDiff > 256) {
418 SkDebugf("--maxComponentDiff must be between 0 and 256\n"); 411 SkDebugf("--maxComponentDiff must be between 0 and 256\n");
419 exit(-1); 412 exit(-1);
420 } 413 }
421 414
422 if (FLAGS_maxComponentDiff != 256 && !FLAGS_validate) { 415 if (FLAGS_maxComponentDiff != 256 && !FLAGS_validate) {
423 SkDebugf("--maxComponentDiff requires --validate\n"); 416 SkDebugf("--maxComponentDiff requires --validate\n");
424 exit(-1); 417 exit(-1);
425 } 418 }
426 419
427 if (FLAGS_clone < 0) {
428 SkDebugf("--clone must be >= 0. Was %i\n", FLAGS_clone);
429 exit(-1);
430 }
431
432 if (FLAGS_writeEncodedImages) { 420 if (FLAGS_writeEncodedImages) {
433 if (FLAGS_writePath.isEmpty()) { 421 if (FLAGS_writePath.isEmpty()) {
434 SkDebugf("--writeEncodedImages requires --writePath\n"); 422 SkDebugf("--writeEncodedImages requires --writePath\n");
435 exit(-1); 423 exit(-1);
436 } 424 }
437 if (FLAGS_deferImageDecoding) { 425 if (FLAGS_deferImageDecoding) {
438 SkDebugf("--writeEncodedImages is not compatible with --deferImageDe coding\n"); 426 SkDebugf("--writeEncodedImages is not compatible with --deferImageDe coding\n");
439 exit(-1); 427 exit(-1);
440 } 428 }
441 } 429 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]); 482 jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]);
495 } 483 }
496 return 0; 484 return 0;
497 } 485 }
498 486
499 #if !defined SK_BUILD_FOR_IOS 487 #if !defined SK_BUILD_FOR_IOS
500 int main(int argc, char * const argv[]) { 488 int main(int argc, char * const argv[]) {
501 return tool_main(argc, (char**) argv); 489 return tool_main(argc, (char**) argv);
502 } 490 }
503 #endif 491 #endif
OLDNEW
« src/core/SkPicturePlayback.cpp ('K') | « tools/bench_pictures_main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698