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

Side by Side Diff: gm/gmmain.cpp

Issue 12992003: gm: change ErrorBitfield to ErrorType/ErrorCombination (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: minor_adjustments Created 7 years, 9 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 | Annotate | Revision Log
« gm/gm_error.h ('K') | « gm/gm_error.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /* 8 /*
9 * Code for the "gm" (Golden Master) rendering comparison tool. 9 * Code for the "gm" (Golden Master) rendering comparison tool.
10 * 10 *
11 * If you make changes to this, re-run the self-tests at gm/tests/run.sh 11 * If you make changes to this, re-run the self-tests at gm/tests/run.sh
12 * to make sure they still pass... you may need to change the expected 12 * to make sure they still pass... you may need to change the expected
13 * results of the self-test. 13 * results of the self-test.
14 */ 14 */
15 15
16 #include "gm.h" 16 #include "gm.h"
17 #include "gm_error.h"
17 #include "gm_expectations.h" 18 #include "gm_expectations.h"
18 #include "system_preferences.h" 19 #include "system_preferences.h"
19 #include "SkBitmap.h" 20 #include "SkBitmap.h"
20 #include "SkBitmapChecksummer.h" 21 #include "SkBitmapChecksummer.h"
21 #include "SkColorPriv.h" 22 #include "SkColorPriv.h"
22 #include "SkData.h" 23 #include "SkData.h"
23 #include "SkDeferredCanvas.h" 24 #include "SkDeferredCanvas.h"
24 #include "SkDevice.h" 25 #include "SkDevice.h"
25 #include "SkDrawFilter.h" 26 #include "SkDrawFilter.h"
26 #include "SkFlags.h" 27 #include "SkFlags.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #include "SkXPSDevice.h" 74 #include "SkXPSDevice.h"
74 #endif 75 #endif
75 76
76 #ifdef SK_BUILD_FOR_MAC 77 #ifdef SK_BUILD_FOR_MAC
77 #include "SkCGUtils.h" 78 #include "SkCGUtils.h"
78 #define CAN_IMAGE_PDF 1 79 #define CAN_IMAGE_PDF 1
79 #else 80 #else
80 #define CAN_IMAGE_PDF 0 81 #define CAN_IMAGE_PDF 0
81 #endif 82 #endif
82 83
83 typedef int ErrorBitfield;
84 // an empty bitfield means no errors:
85 const static ErrorBitfield kEmptyErrorBitfield = 0x00;
86 // individual error types:
87 const static ErrorBitfield kNoGpuContext_ErrorBitmask = 0x01;
88 const static ErrorBitfield kImageMismatch_ErrorBitmask = 0x02;
89 const static ErrorBitfield kMissingExpectations_ErrorBitmask = 0x04;
90 const static ErrorBitfield kWritingReferenceImage_ErrorBitmask = 0x08;
91 // we typically ignore any errors matching this bitmask:
92 const static ErrorBitfield kIgnorable_ErrorBitmask = kMissingExpectations_ErrorB itmask;
93
94 using namespace skiagm; 84 using namespace skiagm;
95 85
96 struct FailRec { 86 struct FailRec {
97 SkString fName; 87 SkString fName;
98 bool fIsPixelError; 88 bool fIsPixelError;
99 89
100 FailRec() : fIsPixelError(false) {} 90 FailRec() : fIsPixelError(false) {}
101 FailRec(const SkString& name) : fName(name), fIsPixelError(false) {} 91 FailRec(const SkString& name) : fName(name), fIsPixelError(false) {}
102 }; 92 };
103 93
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 { " cross-process, shared address", SkGPipeWriter::kCrossProcess_Flag 178 { " cross-process, shared address", SkGPipeWriter::kCrossProcess_Flag
189 | SkGPipeWriter::kSharedAddressSpace_Flag } 179 | SkGPipeWriter::kSharedAddressSpace_Flag }
190 }; 180 };
191 181
192 class GMMain { 182 class GMMain {
193 public: 183 public:
194 GMMain() { 184 GMMain() {
195 // Set default values of member variables, which tool_main() 185 // Set default values of member variables, which tool_main()
196 // may override. 186 // may override.
197 fUseFileHierarchy = false; 187 fUseFileHierarchy = false;
188 fIgnorableErrorCombination.add(kMissingExpectations_ErrorType);
198 fMismatchPath = NULL; 189 fMismatchPath = NULL;
199 } 190 }
200 191
201 SkString make_name(const char shortName[], const char configName[]) { 192 SkString make_name(const char shortName[], const char configName[]) {
202 SkString name; 193 SkString name;
203 if (0 == strlen(configName)) { 194 if (0 == strlen(configName)) {
204 name.append(shortName); 195 name.append(shortName);
205 } else if (fUseFileHierarchy) { 196 } else if (fUseFileHierarchy) {
206 name.appendf("%s%c%s", configName, SkPATH_SEPARATOR, shortName); 197 name.appendf("%s%c%s", configName, SkPATH_SEPARATOR, shortName);
207 } else { 198 } else {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 static bool write_bitmap(const SkString& path, const SkBitmap& bitmap) { 232 static bool write_bitmap(const SkString& path, const SkBitmap& bitmap) {
242 // TODO(epoger): Now that we have removed force_all_opaque() 233 // TODO(epoger): Now that we have removed force_all_opaque()
243 // from this method, we should be able to get rid of the 234 // from this method, we should be able to get rid of the
244 // transformation to 8888 format also. 235 // transformation to 8888 format also.
245 SkBitmap copy; 236 SkBitmap copy;
246 bitmap.copyTo(&copy, SkBitmap::kARGB_8888_Config); 237 bitmap.copyTo(&copy, SkBitmap::kARGB_8888_Config);
247 return SkImageEncoder::EncodeFile(path.c_str(), copy, 238 return SkImageEncoder::EncodeFile(path.c_str(), copy,
248 SkImageEncoder::kPNG_Type, 100); 239 SkImageEncoder::kPNG_Type, 100);
249 } 240 }
250 241
251 // Records an error in fFailedTests, if we want to record errors 242 /**
252 // of this type. 243 * Records the errors encountered in fFailedTests, except for any error
253 void RecordError(ErrorBitfield errorType, const SkString& name, 244 * types we want to ignore.
245 */
246 void RecordError(const ErrorCombination& errorCombination, const SkString& n ame,
254 const char renderModeDescriptor []) { 247 const char renderModeDescriptor []) {
255 // The common case: no error means nothing to record. 248 // The common case: no error means nothing to record.
256 if (kEmptyErrorBitfield == errorType) { 249 if (errorCombination.isEmpty()) {
257 return; 250 return;
258 } 251 }
259 252
260 // If only certain error type(s) were reported, we know we can ignore th em. 253 // If only certain error type(s) were reported, we know we can ignore th em.
261 if (errorType == (errorType & kIgnorable_ErrorBitmask)) { 254 if (errorCombination.minus(fIgnorableErrorCombination).isEmpty()) {
262 return; 255 return;
263 } 256 }
264 257
265 FailRec& rec = fFailedTests.push_back(make_name( 258 FailRec& rec = fFailedTests.push_back(make_name(name.c_str(), renderMode Descriptor));
266 name.c_str(), renderModeDescriptor)); 259 rec.fIsPixelError = errorCombination.includes(kImageMismatch_ErrorType);
epoger 2013/03/21 20:40:17 I think this syntax is clearer and less error-pron
267 rec.fIsPixelError =
268 (kEmptyErrorBitfield != (errorType & kImageMismatch_ErrorBitmask));
269 } 260 }
270 261
271 // List contents of fFailedTests via SkDebug. 262 // List contents of fFailedTests via SkDebug.
272 void ListErrors() { 263 void ListErrors() {
273 for (int i = 0; i < fFailedTests.count(); ++i) { 264 for (int i = 0; i < fFailedTests.count(); ++i) {
274 if (fFailedTests[i].fIsPixelError) { 265 if (fFailedTests[i].fIsPixelError) {
275 gm_fprintf(stderr, "\t\t%s pixel_error\n", fFailedTests[i].fName .c_str()); 266 gm_fprintf(stderr, "\t\t%s pixel_error\n", fFailedTests[i].fName .c_str());
276 } else { 267 } else {
277 gm_fprintf(stderr, "\t\t%s\n", fFailedTests[i].fName.c_str()); 268 gm_fprintf(stderr, "\t\t%s\n", fFailedTests[i].fName.c_str());
278 } 269 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 362
372 if (!isPDF) { 363 if (!isPDF) {
373 canvas->concat(gm->getInitialTransform()); 364 canvas->concat(gm->getInitialTransform());
374 } 365 }
375 installFilter(canvas); 366 installFilter(canvas);
376 gm->setCanvasIsDeferred(isDeferred); 367 gm->setCanvasIsDeferred(isDeferred);
377 gm->draw(canvas); 368 gm->draw(canvas);
378 canvas->setDrawFilter(NULL); 369 canvas->setDrawFilter(NULL);
379 } 370 }
380 371
381 static ErrorBitfield generate_image(GM* gm, const ConfigData& gRec, 372 static ErrorCombination generate_image(GM* gm, const ConfigData& gRec,
382 GrContext* context, 373 GrContext* context,
383 GrRenderTarget* rt, 374 GrRenderTarget* rt,
384 SkBitmap* bitmap, 375 SkBitmap* bitmap,
385 bool deferred) { 376 bool deferred) {
386 SkISize size (gm->getISize()); 377 SkISize size (gm->getISize());
387 setup_bitmap(gRec, size, bitmap); 378 setup_bitmap(gRec, size, bitmap);
388 379
389 SkAutoTUnref<SkCanvas> canvas; 380 SkAutoTUnref<SkCanvas> canvas;
390 381
391 if (gRec.fBackend == kRaster_Backend) { 382 if (gRec.fBackend == kRaster_Backend) {
392 SkAutoTUnref<SkDevice> device(new SkDevice(*bitmap)); 383 SkAutoTUnref<SkDevice> device(new SkDevice(*bitmap));
393 if (deferred) { 384 if (deferred) {
394 canvas.reset(new SkDeferredCanvas(device)); 385 canvas.reset(new SkDeferredCanvas(device));
395 } else { 386 } else {
396 canvas.reset(new SkCanvas(device)); 387 canvas.reset(new SkCanvas(device));
397 } 388 }
398 invokeGM(gm, canvas, false, deferred); 389 invokeGM(gm, canvas, false, deferred);
399 canvas->flush(); 390 canvas->flush();
400 } 391 }
401 #if SK_SUPPORT_GPU 392 #if SK_SUPPORT_GPU
402 else { // GPU 393 else { // GPU
403 if (NULL == context) { 394 if (NULL == context) {
404 return kNoGpuContext_ErrorBitmask; 395 return kNoGpuContext_ErrorType;
405 } 396 }
406 SkAutoTUnref<SkDevice> device(new SkGpuDevice(context, rt)); 397 SkAutoTUnref<SkDevice> device(new SkGpuDevice(context, rt));
407 if (deferred) { 398 if (deferred) {
408 canvas.reset(new SkDeferredCanvas(device)); 399 canvas.reset(new SkDeferredCanvas(device));
409 } else { 400 } else {
410 canvas.reset(new SkCanvas(device)); 401 canvas.reset(new SkCanvas(device));
411 } 402 }
412 invokeGM(gm, canvas, false, deferred); 403 invokeGM(gm, canvas, false, deferred);
413 // the device is as large as the current rendertarget, so 404 // the device is as large as the current rendertarget, so
414 // we explicitly only readback the amount we expect (in 405 // we explicitly only readback the amount we expect (in
415 // size) overwrite our previous allocation 406 // size) overwrite our previous allocation
416 bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth, 407 bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth,
417 size.fHeight); 408 size.fHeight);
418 canvas->readPixels(bitmap, 0, 0); 409 canvas->readPixels(bitmap, 0, 0);
419 } 410 }
420 #endif 411 #endif
421 complete_bitmap(bitmap); 412 complete_bitmap(bitmap);
422 return kEmptyErrorBitfield; 413 return kEmpty_ErrorCombination;
423 } 414 }
424 415
425 static void generate_image_from_picture(GM* gm, const ConfigData& gRec, 416 static void generate_image_from_picture(GM* gm, const ConfigData& gRec,
426 SkPicture* pict, SkBitmap* bitmap, 417 SkPicture* pict, SkBitmap* bitmap,
427 SkScalar scale = SK_Scalar1) { 418 SkScalar scale = SK_Scalar1) {
428 SkISize size = gm->getISize(); 419 SkISize size = gm->getISize();
429 setup_bitmap(gRec, size, bitmap); 420 setup_bitmap(gRec, size, bitmap);
430 SkCanvas canvas(*bitmap); 421 SkCanvas canvas(*bitmap);
431 installFilter(&canvas); 422 installFilter(&canvas);
432 canvas.scale(scale, scale); 423 canvas.scale(scale, scale);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 SkCanvas c(dev); 472 SkCanvas c(dev);
482 dev->beginPortfolio(&xps); 473 dev->beginPortfolio(&xps);
483 dev->beginSheet(unitsPerMeter, pixelsPerMeter, trimSize); 474 dev->beginSheet(unitsPerMeter, pixelsPerMeter, trimSize);
484 invokeGM(gm, &c, false, false); 475 invokeGM(gm, &c, false, false);
485 dev->endSheet(); 476 dev->endSheet();
486 dev->endPortfolio(); 477 dev->endPortfolio();
487 478
488 #endif 479 #endif
489 } 480 }
490 481
491 ErrorBitfield write_reference_image( 482 ErrorCombination write_reference_image(const ConfigData& gRec, const char wr itePath [],
492 const ConfigData& gRec, const char writePath [], 483 const char renderModeDescriptor [], c onst SkString& name,
493 const char renderModeDescriptor [], const SkString& name, 484 SkBitmap& bitmap, SkDynamicMemoryWStr eam* document) {
494 SkBitmap& bitmap, SkDynamicMemoryWStream* document) {
495 SkString path; 485 SkString path;
496 bool success = false; 486 bool success = false;
497 if (gRec.fBackend == kRaster_Backend || 487 if (gRec.fBackend == kRaster_Backend ||
498 gRec.fBackend == kGPU_Backend || 488 gRec.fBackend == kGPU_Backend ||
499 (gRec.fBackend == kPDF_Backend && CAN_IMAGE_PDF)) { 489 (gRec.fBackend == kPDF_Backend && CAN_IMAGE_PDF)) {
500 490
501 path = make_filename(writePath, renderModeDescriptor, name.c_str(), 491 path = make_filename(writePath, renderModeDescriptor, name.c_str(),
502 "png"); 492 "png");
503 success = write_bitmap(path, bitmap); 493 success = write_bitmap(path, bitmap);
504 } 494 }
505 if (kPDF_Backend == gRec.fBackend) { 495 if (kPDF_Backend == gRec.fBackend) {
506 path = make_filename(writePath, renderModeDescriptor, name.c_str(), 496 path = make_filename(writePath, renderModeDescriptor, name.c_str(),
507 "pdf"); 497 "pdf");
508 success = write_document(path, *document); 498 success = write_document(path, *document);
509 } 499 }
510 if (kXPS_Backend == gRec.fBackend) { 500 if (kXPS_Backend == gRec.fBackend) {
511 path = make_filename(writePath, renderModeDescriptor, name.c_str(), 501 path = make_filename(writePath, renderModeDescriptor, name.c_str(),
512 "xps"); 502 "xps");
513 success = write_document(path, *document); 503 success = write_document(path, *document);
514 } 504 }
515 if (success) { 505 if (success) {
516 return kEmptyErrorBitfield; 506 return kEmpty_ErrorCombination;
517 } else { 507 } else {
518 gm_fprintf(stderr, "FAILED to write %s\n", path.c_str()); 508 gm_fprintf(stderr, "FAILED to write %s\n", path.c_str());
519 RecordError(kWritingReferenceImage_ErrorBitmask, name, 509 ErrorCombination errors(kWritingReferenceImage_ErrorType);
520 renderModeDescriptor); 510 RecordError(errors, name, renderModeDescriptor);
521 return kWritingReferenceImage_ErrorBitmask; 511 return errors;
522 } 512 }
523 } 513 }
524 514
525 /** 515 /**
526 * Log more detail about the mistmatch between expectedBitmap and 516 * Log more detail about the mistmatch between expectedBitmap and
527 * actualBitmap. 517 * actualBitmap.
528 */ 518 */
529 void report_bitmap_diffs(const SkBitmap& expectedBitmap, const SkBitmap& act ualBitmap, 519 void report_bitmap_diffs(const SkBitmap& expectedBitmap, const SkBitmap& act ualBitmap,
530 const char *testName) { 520 const char *testName) {
531 const int expectedWidth = expectedBitmap.width(); 521 const int expectedWidth = expectedBitmap.width();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 (int)SkGetPackedA32(actualPixel ))); 562 (int)SkGetPackedA32(actualPixel )));
573 } 563 }
574 } 564 }
575 } 565 }
576 gm_fprintf(stderr, "---- %s: %d (of %d) differing pixels," 566 gm_fprintf(stderr, "---- %s: %d (of %d) differing pixels,"
577 " max per-channel mismatch R=%d G=%d B=%d A=%d\n", 567 " max per-channel mismatch R=%d G=%d B=%d A=%d\n",
578 testName, differingPixels, width*height, errR, errG, errB, er rA); 568 testName, differingPixels, width*height, errR, errG, errB, er rA);
579 } 569 }
580 570
581 /** 571 /**
582 * Compares actual checksum to expectations. Returns 572 * Compares actual checksum to expectations, returning the set of errors
583 * kEmptyErrorBitfield if they match, or some combination of 573 * (if any) that we saw along the way.
584 * _ErrorBitmask values otherwise.
585 * 574 *
586 * If fMismatchPath has been set, and there are pixel diffs, then the 575 * If fMismatchPath has been set, and there are pixel diffs, then the
587 * actual bitmap will be written out to a file within fMismatchPath. 576 * actual bitmap will be written out to a file within fMismatchPath.
588 * 577 *
589 * @param expectations what expectations to compare actualBitmap against 578 * @param expectations what expectations to compare actualBitmap against
590 * @param actualBitmap the image we actually generated 579 * @param actualBitmap the image we actually generated
591 * @param baseNameString name of test without renderModeDescriptor added 580 * @param baseNameString name of test without renderModeDescriptor added
592 * @param renderModeDescriptor e.g., "-rtree", "-deferred" 581 * @param renderModeDescriptor e.g., "-rtree", "-deferred"
593 * @param addToJsonSummary whether to add these results (both actual and 582 * @param addToJsonSummary whether to add these results (both actual and
594 * expected) to the JSON summary 583 * expected) to the JSON summary
595 * 584 *
596 * TODO: For now, addToJsonSummary is only set to true within 585 * TODO: For now, addToJsonSummary is only set to true within
597 * compare_test_results_to_stored_expectations(), so results of our 586 * compare_test_results_to_stored_expectations(), so results of our
598 * in-memory comparisons (Rtree vs regular, etc.) are not written to the 587 * in-memory comparisons (Rtree vs regular, etc.) are not written to the
599 * JSON summary. We may wish to change that. 588 * JSON summary. We may wish to change that.
600 */ 589 */
601 ErrorBitfield compare_to_expectations(Expectations expectations, 590 ErrorCombination compare_to_expectations(Expectations expectations,
602 const SkBitmap& actualBitmap, 591 const SkBitmap& actualBitmap,
603 const SkString& baseNameString, 592 const SkString& baseNameString,
604 const char renderModeDescriptor[], 593 const char renderModeDescriptor[],
605 bool addToJsonSummary=false) { 594 bool addToJsonSummary=false) {
606 ErrorBitfield retval; 595 ErrorCombination errors;
607 Checksum actualChecksum = SkBitmapChecksummer::Compute64(actualBitmap); 596 Checksum actualChecksum = SkBitmapChecksummer::Compute64(actualBitmap);
608 SkString completeNameString = baseNameString; 597 SkString completeNameString = baseNameString;
609 completeNameString.append(renderModeDescriptor); 598 completeNameString.append(renderModeDescriptor);
610 const char* completeName = completeNameString.c_str(); 599 const char* completeName = completeNameString.c_str();
611 600
612 if (expectations.empty()) { 601 if (expectations.empty()) {
613 retval = kMissingExpectations_ErrorBitmask; 602 errors.add(kMissingExpectations_ErrorType);
614 } else if (expectations.match(actualChecksum)) { 603 } else if (!expectations.match(actualChecksum)) {
615 retval = kEmptyErrorBitfield; 604 errors.add(kImageMismatch_ErrorType);
616 } else {
617 retval = kImageMismatch_ErrorBitmask;
618 605
619 // Write out the "actuals" for any mismatches, if we have 606 // Write out the "actuals" for any mismatches, if we have
620 // been directed to do so. 607 // been directed to do so.
621 if (fMismatchPath) { 608 if (fMismatchPath) {
622 SkString path = 609 SkString path =
623 make_filename(fMismatchPath, renderModeDescriptor, 610 make_filename(fMismatchPath, renderModeDescriptor,
624 baseNameString.c_str(), "png"); 611 baseNameString.c_str(), "png");
625 write_bitmap(path, actualBitmap); 612 write_bitmap(path, actualBitmap);
626 } 613 }
627 614
628 // If we have access to a single expected bitmap, log more 615 // If we have access to a single expected bitmap, log more
629 // detail about the mismatch. 616 // detail about the mismatch.
630 const SkBitmap *expectedBitmapPtr = expectations.asBitmap(); 617 const SkBitmap *expectedBitmapPtr = expectations.asBitmap();
631 if (NULL != expectedBitmapPtr) { 618 if (NULL != expectedBitmapPtr) {
632 report_bitmap_diffs(*expectedBitmapPtr, actualBitmap, completeNa me); 619 report_bitmap_diffs(*expectedBitmapPtr, actualBitmap, completeNa me);
633 } 620 }
634 } 621 }
635 RecordError(retval, baseNameString, renderModeDescriptor); 622 RecordError(errors, baseNameString, renderModeDescriptor);
636 623
637 if (addToJsonSummary) { 624 if (addToJsonSummary) {
638 add_actual_results_to_json_summary(completeName, actualChecksum, 625 add_actual_results_to_json_summary(completeName, actualChecksum, err ors,
639 retval,
640 expectations.ignoreFailure()); 626 expectations.ignoreFailure());
641 add_expected_results_to_json_summary(completeName, expectations); 627 add_expected_results_to_json_summary(completeName, expectations);
642 } 628 }
643 629
644 return retval; 630 return errors;
645 } 631 }
646 632
647 /** 633 /**
648 * Add this result to the appropriate JSON collection of actual results, 634 * Add this result to the appropriate JSON collection of actual results,
649 * depending on status. 635 * depending on status.
650 */ 636 */
651 void add_actual_results_to_json_summary(const char testName[], 637 void add_actual_results_to_json_summary(const char testName[],
652 Checksum actualChecksum, 638 Checksum actualChecksum,
653 ErrorBitfield result, 639 ErrorCombination result,
654 bool ignoreFailure) { 640 bool ignoreFailure) {
655 Json::Value actualResults; 641 Json::Value actualResults;
656 actualResults[kJsonKey_ActualResults_AnyStatus_Checksum] = 642 actualResults[kJsonKey_ActualResults_AnyStatus_Checksum] =
657 asJsonValue(actualChecksum); 643 asJsonValue(actualChecksum);
658 if (kEmptyErrorBitfield == result) { 644 if (result.isEmpty()) {
659 this->fJsonActualResults_Succeeded[testName] = actualResults; 645 this->fJsonActualResults_Succeeded[testName] = actualResults;
660 } else { 646 } else {
661 if (ignoreFailure) { 647 if (ignoreFailure) {
662 // TODO: Once we have added the ability to compare 648 // TODO: Once we have added the ability to compare
663 // actual results against expectations in a JSON file 649 // actual results against expectations in a JSON file
664 // (where we can set ignore-failure to either true or 650 // (where we can set ignore-failure to either true or
665 // false), add test cases that exercise ignored 651 // false), add test cases that exercise ignored
666 // failures (both for kMissingExpectations_ErrorBitmask 652 // failures (both for kMissingExpectations_ErrorType
667 // and kImageMismatch_ErrorBitmask). 653 // and kImageMismatch_ErrorType).
668 this->fJsonActualResults_FailureIgnored[testName] = 654 this->fJsonActualResults_FailureIgnored[testName] =
669 actualResults; 655 actualResults;
670 } else { 656 } else {
671 if (kEmptyErrorBitfield != (result & kMissingExpectations_ErrorB itmask)) { 657 if (result.includes(kMissingExpectations_ErrorType)) {
672 // TODO: What about the case where there IS an 658 // TODO: What about the case where there IS an
673 // expected image checksum, but that gm test 659 // expected image checksum, but that gm test
674 // doesn't actually run? For now, those cases 660 // doesn't actually run? For now, those cases
675 // will always be ignored, because gm only looks 661 // will always be ignored, because gm only looks
676 // at expectations that correspond to gm tests 662 // at expectations that correspond to gm tests
677 // that were actually run. 663 // that were actually run.
678 // 664 //
679 // Once we have the ability to express 665 // Once we have the ability to express
680 // expectations as a JSON file, we should fix this 666 // expectations as a JSON file, we should fix this
681 // (and add a test case for which an expectation 667 // (and add a test case for which an expectation
682 // is given but the test is never run). 668 // is given but the test is never run).
683 this->fJsonActualResults_NoComparison[testName] = 669 this->fJsonActualResults_NoComparison[testName] =
684 actualResults; 670 actualResults;
685 } 671 }
686 if (kEmptyErrorBitfield != (result & kImageMismatch_ErrorBitmask )) { 672 if (result.includes(kImageMismatch_ErrorType)) {
687 this->fJsonActualResults_Failed[testName] = actualResults; 673 this->fJsonActualResults_Failed[testName] = actualResults;
688 } 674 }
689 } 675 }
690 } 676 }
691 } 677 }
692 678
693 /** 679 /**
694 * Add this test to the JSON collection of expected results. 680 * Add this test to the JSON collection of expected results.
695 */ 681 */
696 void add_expected_results_to_json_summary(const char testName[], 682 void add_expected_results_to_json_summary(const char testName[],
(...skipping 12 matching lines...) Expand all
709 /** 695 /**
710 * Compare actualBitmap to expectations stored in this->fExpectationsSource. 696 * Compare actualBitmap to expectations stored in this->fExpectationsSource.
711 * 697 *
712 * @param gm which test generated the actualBitmap 698 * @param gm which test generated the actualBitmap
713 * @param gRec 699 * @param gRec
714 * @param writePath unless this is NULL, write out actual images into this 700 * @param writePath unless this is NULL, write out actual images into this
715 * directory 701 * directory
716 * @param actualBitmap bitmap generated by this run 702 * @param actualBitmap bitmap generated by this run
717 * @param pdf 703 * @param pdf
718 */ 704 */
719 ErrorBitfield compare_test_results_to_stored_expectations( 705 ErrorCombination compare_test_results_to_stored_expectations(
720 GM* gm, const ConfigData& gRec, const char writePath[], 706 GM* gm, const ConfigData& gRec, const char writePath[],
721 SkBitmap& actualBitmap, SkDynamicMemoryWStream* pdf) { 707 SkBitmap& actualBitmap, SkDynamicMemoryWStream* pdf) {
722 708
723 SkString name = make_name(gm->shortName(), gRec.fName); 709 SkString name = make_name(gm->shortName(), gRec.fName);
724 ErrorBitfield retval = kEmptyErrorBitfield; 710 ErrorCombination errors;
725 711
726 ExpectationsSource *expectationsSource = 712 ExpectationsSource *expectationsSource = this->fExpectationsSource.get() ;
727 this->fExpectationsSource.get();
728 if (expectationsSource && (gRec.fFlags & kRead_ConfigFlag)) { 713 if (expectationsSource && (gRec.fFlags & kRead_ConfigFlag)) {
729 /* 714 /*
730 * Get the expected results for this test, as one or more allowed 715 * Get the expected results for this test, as one or more allowed
731 * checksums. The current implementation of expectationsSource 716 * checksums. The current implementation of expectationsSource
732 * get this by computing the checksum of a single PNG file on disk. 717 * get this by computing the checksum of a single PNG file on disk.
733 * 718 *
734 * TODO(epoger): This relies on the fact that 719 * TODO(epoger): This relies on the fact that
735 * force_all_opaque() was called on the bitmap before it 720 * force_all_opaque() was called on the bitmap before it
736 * was written to disk as a PNG in the first place. If 721 * was written to disk as a PNG in the first place. If
737 * not, the checksum returned here may not match the 722 * not, the checksum returned here may not match the
738 * checksum of actualBitmap, which *has* been run through 723 * checksum of actualBitmap, which *has* been run through
739 * force_all_opaque(). 724 * force_all_opaque().
740 * See comments above complete_bitmap() for more detail. 725 * See comments above complete_bitmap() for more detail.
741 */ 726 */
742 Expectations expectations = expectationsSource->get(name.c_str()); 727 Expectations expectations = expectationsSource->get(name.c_str());
743 retval |= compare_to_expectations(expectations, actualBitmap, 728 errors.add(compare_to_expectations(expectations, actualBitmap,
744 name, "", true); 729 name, "", true));
745 } else { 730 } else {
746 // If we are running without expectations, we still want to 731 // If we are running without expectations, we still want to
747 // record the actual results. 732 // record the actual results.
748 Checksum actualChecksum = 733 Checksum actualChecksum =
749 SkBitmapChecksummer::Compute64(actualBitmap); 734 SkBitmapChecksummer::Compute64(actualBitmap);
750 add_actual_results_to_json_summary(name.c_str(), actualChecksum, 735 add_actual_results_to_json_summary(name.c_str(), actualChecksum,
751 kMissingExpectations_ErrorBitmask , 736 kMissingExpectations_ErrorType,
752 false); 737 false);
753 } 738 }
754 739
755 // TODO: Consider moving this into compare_to_expectations(), 740 // TODO: Consider moving this into compare_to_expectations(),
756 // similar to fMismatchPath... for now, we don't do that, because 741 // similar to fMismatchPath... for now, we don't do that, because
757 // we don't want to write out the actual bitmaps for all 742 // we don't want to write out the actual bitmaps for all
758 // renderModes of all tests! That would be a lot of files. 743 // renderModes of all tests! That would be a lot of files.
759 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) { 744 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) {
760 retval |= write_reference_image(gRec, writePath, "", 745 errors.add(write_reference_image(gRec, writePath, "",
761 name, actualBitmap, pdf); 746 name, actualBitmap, pdf));
762 } 747 }
763 748
764 return retval; 749 return errors;
765 } 750 }
766 751
767 /** 752 /**
768 * Compare actualBitmap to referenceBitmap. 753 * Compare actualBitmap to referenceBitmap.
769 * 754 *
770 * @param gm which test generated the bitmap 755 * @param gm which test generated the bitmap
771 * @param gRec 756 * @param gRec
772 * @param renderModeDescriptor 757 * @param renderModeDescriptor
773 * @param actualBitmap actual bitmap generated by this run 758 * @param actualBitmap actual bitmap generated by this run
774 * @param referenceBitmap bitmap we expected to be generated 759 * @param referenceBitmap bitmap we expected to be generated
775 */ 760 */
776 ErrorBitfield compare_test_results_to_reference_bitmap( 761 ErrorCombination compare_test_results_to_reference_bitmap(
777 GM* gm, const ConfigData& gRec, const char renderModeDescriptor [], 762 GM* gm, const ConfigData& gRec, const char renderModeDescriptor [],
778 SkBitmap& actualBitmap, const SkBitmap* referenceBitmap) { 763 SkBitmap& actualBitmap, const SkBitmap* referenceBitmap) {
779 764
780 SkASSERT(referenceBitmap); 765 SkASSERT(referenceBitmap);
781 SkString name = make_name(gm->shortName(), gRec.fName); 766 SkString name = make_name(gm->shortName(), gRec.fName);
782 Expectations expectations(*referenceBitmap); 767 Expectations expectations(*referenceBitmap);
783 return compare_to_expectations(expectations, actualBitmap, 768 return compare_to_expectations(expectations, actualBitmap,
784 name, renderModeDescriptor); 769 name, renderModeDescriptor);
785 } 770 }
786 771
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 //char* dst = new char [streamSize]; 813 //char* dst = new char [streamSize];
829 //@todo thudson 22 April 2011 when can we safely delete [] dst? 814 //@todo thudson 22 April 2011 when can we safely delete [] dst?
830 storage.copyTo(dst); 815 storage.copyTo(dst);
831 SkMemoryStream pictReadback(dst, streamSize); 816 SkMemoryStream pictReadback(dst, streamSize);
832 SkPicture* retval = new SkPicture (&pictReadback); 817 SkPicture* retval = new SkPicture (&pictReadback);
833 return retval; 818 return retval;
834 } 819 }
835 820
836 // Test: draw into a bitmap or pdf. 821 // Test: draw into a bitmap or pdf.
837 // Depending on flags, possibly compare to an expected image. 822 // Depending on flags, possibly compare to an expected image.
838 ErrorBitfield test_drawing(GM* gm, 823 ErrorCombination test_drawing(GM* gm,
839 const ConfigData& gRec, 824 const ConfigData& gRec,
840 const char writePath [], 825 const char writePath [],
841 GrContext* context, 826 GrContext* context,
842 GrRenderTarget* rt, 827 GrRenderTarget* rt,
843 SkBitmap* bitmap) { 828 SkBitmap* bitmap) {
844 SkDynamicMemoryWStream document; 829 SkDynamicMemoryWStream document;
845 830
846 if (gRec.fBackend == kRaster_Backend || 831 if (gRec.fBackend == kRaster_Backend ||
847 gRec.fBackend == kGPU_Backend) { 832 gRec.fBackend == kGPU_Backend) {
848 // Early exit if we can't generate the image. 833 // Early exit if we can't generate the image.
849 ErrorBitfield errors = generate_image(gm, gRec, context, rt, bitmap, 834 ErrorCombination errors = generate_image(gm, gRec, context, rt, bitm ap, false);
850 false); 835 if (!errors.isEmpty()) {
851 if (kEmptyErrorBitfield != errors) {
852 // TODO: Add a test to exercise what the stdout and 836 // TODO: Add a test to exercise what the stdout and
853 // JSON look like if we get an "early error" while 837 // JSON look like if we get an "early error" while
854 // trying to generate the image. 838 // trying to generate the image.
855 return errors; 839 return errors;
856 } 840 }
857 } else if (gRec.fBackend == kPDF_Backend) { 841 } else if (gRec.fBackend == kPDF_Backend) {
858 generate_pdf(gm, document); 842 generate_pdf(gm, document);
859 #if CAN_IMAGE_PDF 843 #if CAN_IMAGE_PDF
860 SkAutoDataUnref data(document.copyToData()); 844 SkAutoDataUnref data(document.copyToData());
861 SkMemoryStream stream(data->data(), data->size()); 845 SkMemoryStream stream(data->data(), data->size());
862 SkPDFDocumentToBitmap(&stream, bitmap); 846 SkPDFDocumentToBitmap(&stream, bitmap);
863 #endif 847 #endif
864 } else if (gRec.fBackend == kXPS_Backend) { 848 } else if (gRec.fBackend == kXPS_Backend) {
865 generate_xps(gm, document); 849 generate_xps(gm, document);
866 } 850 }
867 return compare_test_results_to_stored_expectations( 851 return compare_test_results_to_stored_expectations(
868 gm, gRec, writePath, *bitmap, &document); 852 gm, gRec, writePath, *bitmap, &document);
869 } 853 }
870 854
871 ErrorBitfield test_deferred_drawing(GM* gm, 855 ErrorCombination test_deferred_drawing(GM* gm,
872 const ConfigData& gRec, 856 const ConfigData& gRec,
873 const SkBitmap& referenceBitmap, 857 const SkBitmap& referenceBitmap,
874 GrContext* context, 858 GrContext* context,
875 GrRenderTarget* rt) { 859 GrRenderTarget* rt) {
876 SkDynamicMemoryWStream document; 860 SkDynamicMemoryWStream document;
877 861
878 if (gRec.fBackend == kRaster_Backend || 862 if (gRec.fBackend == kRaster_Backend ||
879 gRec.fBackend == kGPU_Backend) { 863 gRec.fBackend == kGPU_Backend) {
880 SkBitmap bitmap; 864 SkBitmap bitmap;
881 // Early exit if we can't generate the image, but this is 865 // Early exit if we can't generate the image, but this is
882 // expected in some cases, so don't report a test failure. 866 // expected in some cases, so don't report a test failure.
883 if (!generate_image(gm, gRec, context, rt, &bitmap, true)) { 867 ErrorCombination errors = generate_image(gm, gRec, context, rt, &bit map, true);
884 return kEmptyErrorBitfield; 868 if (!errors.isEmpty()) {
869 return kEmpty_ErrorCombination;
885 } 870 }
886 return compare_test_results_to_reference_bitmap( 871 return compare_test_results_to_reference_bitmap(
887 gm, gRec, "-deferred", bitmap, &referenceBitmap); 872 gm, gRec, "-deferred", bitmap, &referenceBitmap);
888 } 873 }
889 return kEmptyErrorBitfield; 874 return kEmpty_ErrorCombination;
890 } 875 }
891 876
892 ErrorBitfield test_pipe_playback(GM* gm, 877 ErrorCombination test_pipe_playback(GM* gm,
893 const ConfigData& gRec, 878 const ConfigData& gRec,
894 const SkBitmap& referenceBitmap) { 879 const SkBitmap& referenceBitmap) {
895 ErrorBitfield errors = kEmptyErrorBitfield; 880 ErrorCombination errors;
896 for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) { 881 for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) {
897 SkBitmap bitmap; 882 SkBitmap bitmap;
898 SkISize size = gm->getISize(); 883 SkISize size = gm->getISize();
899 setup_bitmap(gRec, size, &bitmap); 884 setup_bitmap(gRec, size, &bitmap);
900 SkCanvas canvas(bitmap); 885 SkCanvas canvas(bitmap);
901 installFilter(&canvas); 886 installFilter(&canvas);
902 PipeController pipeController(&canvas); 887 PipeController pipeController(&canvas);
903 SkGPipeWriter writer; 888 SkGPipeWriter writer;
904 SkCanvas* pipeCanvas = writer.startRecording( 889 SkCanvas* pipeCanvas = writer.startRecording(
905 &pipeController, gPipeWritingFlagCombos[i].flags); 890 &pipeController, gPipeWritingFlagCombos[i].flags);
906 invokeGM(gm, pipeCanvas, false, false); 891 invokeGM(gm, pipeCanvas, false, false);
907 complete_bitmap(&bitmap); 892 complete_bitmap(&bitmap);
908 writer.endRecording(); 893 writer.endRecording();
909 SkString string("-pipe"); 894 SkString string("-pipe");
910 string.append(gPipeWritingFlagCombos[i].name); 895 string.append(gPipeWritingFlagCombos[i].name);
911 errors |= compare_test_results_to_reference_bitmap( 896 errors.add(compare_test_results_to_reference_bitmap(
912 gm, gRec, string.c_str(), bitmap, &referenceBitmap); 897 gm, gRec, string.c_str(), bitmap, &referenceBitmap));
913 if (errors != kEmptyErrorBitfield) { 898 if (!errors.isEmpty()) {
914 break; 899 break;
915 } 900 }
916 } 901 }
917 return errors; 902 return errors;
918 } 903 }
919 904
920 ErrorBitfield test_tiled_pipe_playback( 905 ErrorCombination test_tiled_pipe_playback(GM* gm, const ConfigData& gRec,
921 GM* gm, const ConfigData& gRec, const SkBitmap& referenceBitmap) { 906 const SkBitmap& referenceBitmap) {
922 ErrorBitfield errors = kEmptyErrorBitfield; 907 ErrorCombination errors;
923 for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) { 908 for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) {
924 SkBitmap bitmap; 909 SkBitmap bitmap;
925 SkISize size = gm->getISize(); 910 SkISize size = gm->getISize();
926 setup_bitmap(gRec, size, &bitmap); 911 setup_bitmap(gRec, size, &bitmap);
927 SkCanvas canvas(bitmap); 912 SkCanvas canvas(bitmap);
928 installFilter(&canvas); 913 installFilter(&canvas);
929 TiledPipeController pipeController(bitmap); 914 TiledPipeController pipeController(bitmap);
930 SkGPipeWriter writer; 915 SkGPipeWriter writer;
931 SkCanvas* pipeCanvas = writer.startRecording( 916 SkCanvas* pipeCanvas = writer.startRecording(
932 &pipeController, gPipeWritingFlagCombos[i].flags); 917 &pipeController, gPipeWritingFlagCombos[i].flags);
933 invokeGM(gm, pipeCanvas, false, false); 918 invokeGM(gm, pipeCanvas, false, false);
934 complete_bitmap(&bitmap); 919 complete_bitmap(&bitmap);
935 writer.endRecording(); 920 writer.endRecording();
936 SkString string("-tiled pipe"); 921 SkString string("-tiled pipe");
937 string.append(gPipeWritingFlagCombos[i].name); 922 string.append(gPipeWritingFlagCombos[i].name);
938 errors |= compare_test_results_to_reference_bitmap( 923 errors.add(compare_test_results_to_reference_bitmap(
939 gm, gRec, string.c_str(), bitmap, &referenceBitmap); 924 gm, gRec, string.c_str(), bitmap, &referenceBitmap));
940 if (errors != kEmptyErrorBitfield) { 925 if (!errors.isEmpty()) {
941 break; 926 break;
942 } 927 }
943 } 928 }
944 return errors; 929 return errors;
945 } 930 }
946 931
947 // 932 //
948 // member variables. 933 // member variables.
949 // They are public for now, to allow easier setting by tool_main(). 934 // They are public for now, to allow easier setting by tool_main().
950 // 935 //
951 936
952 bool fUseFileHierarchy; 937 bool fUseFileHierarchy;
938 ErrorCombination fIgnorableErrorCombination;
953 939
954 const char* fMismatchPath; 940 const char* fMismatchPath;
955 941
956 // information about all failed tests we have encountered so far 942 // information about all failed tests we have encountered so far
957 SkTArray<FailRec> fFailedTests; 943 SkTArray<FailRec> fFailedTests;
958 944
959 // Where to read expectations (expected image checksums, etc.) from. 945 // Where to read expectations (expected image checksums, etc.) from.
960 // If unset, we don't do comparisons. 946 // If unset, we don't do comparisons.
961 SkAutoTUnref<ExpectationsSource> fExpectationsSource; 947 SkAutoTUnref<ExpectationsSource> fExpectationsSource;
962 948
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 } 1128 }
1143 } 1129 }
1144 1130
1145 /** 1131 /**
1146 * Run this test in a number of different configs (8888, 565, PDF, 1132 * Run this test in a number of different configs (8888, 565, PDF,
1147 * etc.), confirming that the resulting bitmaps match expectations 1133 * etc.), confirming that the resulting bitmaps match expectations
1148 * (which may be different for each config). 1134 * (which may be different for each config).
1149 * 1135 *
1150 * Returns all errors encountered while doing so. 1136 * Returns all errors encountered while doing so.
1151 */ 1137 */
1152 ErrorBitfield run_multiple_configs(GMMain &gmmain, GM *gm, const SkTDArray<size_ t> &configs, 1138 ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm, const SkTDArray<si ze_t> &configs,
1153 GrContextFactory *grFactory); 1139 GrContextFactory *grFactory, int gpuCacheS izeBytes,
1154 ErrorBitfield run_multiple_configs(GMMain &gmmain, GM *gm, const SkTDArray<size_ t> &configs, 1140 int gpuCacheSizeCount);
1155 GrContextFactory *grFactory) { 1141 ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm, const SkTDArray<si ze_t> &configs,
1156 ErrorBitfield errorsForAllConfigs = kEmptyErrorBitfield; 1142 GrContextFactory *grFactory, int gpuCacheS izeBytes,
1143 int gpuCacheSizeCount) {
1144 ErrorCombination errorsForAllConfigs;
1157 uint32_t gmFlags = gm->getFlags(); 1145 uint32_t gmFlags = gm->getFlags();
1158 1146
1159 #if SK_SUPPORT_GPU
1160 struct {
1161 int fBytes;
1162 int fCount;
1163 } gpuCacheSize = { -1, -1 }; // -1s mean use the default
1164
1165 if (FLAGS_gpuCacheSize.count() > 0) {
1166 if (FLAGS_gpuCacheSize.count() != 2) {
1167 gm_fprintf(stderr, "--gpuCacheSize requires two arguments\n");
1168 return -1;
1169 }
1170 gpuCacheSize.fBytes = atoi(FLAGS_gpuCacheSize[0]);
1171 gpuCacheSize.fCount = atoi(FLAGS_gpuCacheSize[1]);
1172 }
1173 #endif
1174
1175 for (int i = 0; i < configs.count(); i++) { 1147 for (int i = 0; i < configs.count(); i++) {
1176 ConfigData config = gRec[configs[i]]; 1148 ConfigData config = gRec[configs[i]];
1177 1149
1178 // Skip any tests that we don't even need to try. 1150 // Skip any tests that we don't even need to try.
1179 if ((kPDF_Backend == config.fBackend) && 1151 if ((kPDF_Backend == config.fBackend) &&
1180 (!FLAGS_pdf|| (gmFlags & GM::kSkipPDF_Flag))) { 1152 (!FLAGS_pdf|| (gmFlags & GM::kSkipPDF_Flag))) {
1181 continue; 1153 continue;
1182 } 1154 }
1183 if ((gmFlags & GM::kSkip565_Flag) && 1155 if ((gmFlags & GM::kSkip565_Flag) &&
1184 (kRaster_Backend == config.fBackend) && 1156 (kRaster_Backend == config.fBackend) &&
1185 (SkBitmap::kRGB_565_Config == config.fConfig)) { 1157 (SkBitmap::kRGB_565_Config == config.fConfig)) {
1186 continue; 1158 continue;
1187 } 1159 }
1188 if ((gmFlags & GM::kSkipGPU_Flag) && 1160 if ((gmFlags & GM::kSkipGPU_Flag) &&
1189 kGPU_Backend == config.fBackend) { 1161 kGPU_Backend == config.fBackend) {
1190 continue; 1162 continue;
1191 } 1163 }
1192 1164
1193 // Now we know that we want to run this test and record its 1165 // Now we know that we want to run this test and record its
1194 // success or failure. 1166 // success or failure.
1195 ErrorBitfield errorsForThisConfig = kEmptyErrorBitfield; 1167 ErrorCombination errorsForThisConfig;
1196 GrRenderTarget* renderTarget = NULL; 1168 GrRenderTarget* renderTarget = NULL;
1197 #if SK_SUPPORT_GPU 1169 #if SK_SUPPORT_GPU
1198 SkAutoTUnref<GrRenderTarget> rt; 1170 SkAutoTUnref<GrRenderTarget> rt;
1199 AutoResetGr autogr; 1171 AutoResetGr autogr;
1200 if ((kEmptyErrorBitfield == errorsForThisConfig) && (kGPU_Backend == con fig.fBackend)) { 1172 if ((errorsForThisConfig.isEmpty()) && (kGPU_Backend == config.fBackend) ) {
1201 GrContext* gr = grFactory->get(config.fGLContextType); 1173 GrContext* gr = grFactory->get(config.fGLContextType);
1202 bool grSuccess = false; 1174 bool grSuccess = false;
1203 if (gr) { 1175 if (gr) {
1204 // create a render target to back the device 1176 // create a render target to back the device
1205 GrTextureDesc desc; 1177 GrTextureDesc desc;
1206 desc.fConfig = kSkia8888_GrPixelConfig; 1178 desc.fConfig = kSkia8888_GrPixelConfig;
1207 desc.fFlags = kRenderTarget_GrTextureFlagBit; 1179 desc.fFlags = kRenderTarget_GrTextureFlagBit;
1208 desc.fWidth = gm->getISize().width(); 1180 desc.fWidth = gm->getISize().width();
1209 desc.fHeight = gm->getISize().height(); 1181 desc.fHeight = gm->getISize().height();
1210 desc.fSampleCnt = config.fSampleCnt; 1182 desc.fSampleCnt = config.fSampleCnt;
1211 GrTexture* tex = gr->createUncachedTexture(desc, NULL, 0); 1183 GrTexture* tex = gr->createUncachedTexture(desc, NULL, 0);
1212 if (tex) { 1184 if (tex) {
1213 rt.reset(tex->asRenderTarget()); 1185 rt.reset(tex->asRenderTarget());
1214 rt.get()->ref(); 1186 rt.get()->ref();
1215 tex->unref(); 1187 tex->unref();
1216 autogr.set(gr); 1188 autogr.set(gr);
1217 renderTarget = rt.get(); 1189 renderTarget = rt.get();
1218 grSuccess = NULL != renderTarget; 1190 grSuccess = NULL != renderTarget;
1219 } 1191 }
1220 // Set the user specified cache limits if non-default. 1192 // Set the user specified cache limits if non-default.
1221 size_t bytes; 1193 size_t bytes;
1222 int count; 1194 int count;
1223 gr->getTextureCacheLimits(&count, &bytes); 1195 gr->getTextureCacheLimits(&count, &bytes);
1224 if (-1 != gpuCacheSize.fBytes) { 1196 if (-1 != gpuCacheSizeBytes) {
1225 bytes = static_cast<size_t>(gpuCacheSize.fBytes); 1197 bytes = static_cast<size_t>(gpuCacheSizeBytes);
1226 } 1198 }
1227 if (-1 != gpuCacheSize.fCount) { 1199 if (-1 != gpuCacheSizeCount) {
1228 count = gpuCacheSize.fCount; 1200 count = gpuCacheSizeCount;
1229 } 1201 }
1230 gr->setTextureCacheLimits(count, bytes); 1202 gr->setTextureCacheLimits(count, bytes);
1231 } 1203 }
1232 if (!grSuccess) { 1204 if (!grSuccess) {
1233 errorsForThisConfig |= kNoGpuContext_ErrorBitmask; 1205 errorsForThisConfig.add(kNoGpuContext_ErrorType);
1234 } 1206 }
1235 } 1207 }
1236 #endif 1208 #endif
1237 1209
1238 SkBitmap comparisonBitmap; 1210 SkBitmap comparisonBitmap;
1239 1211
1240 const char* writePath; 1212 const char* writePath;
1241 if (FLAGS_writePath.count() == 1) { 1213 if (FLAGS_writePath.count() == 1) {
1242 writePath = FLAGS_writePath[0]; 1214 writePath = FLAGS_writePath[0];
1243 } else { 1215 } else {
1244 writePath = NULL; 1216 writePath = NULL;
1245 } 1217 }
1246 if (kEmptyErrorBitfield == errorsForThisConfig) { 1218 if (errorsForThisConfig.isEmpty()) {
1247 errorsForThisConfig |= gmmain.test_drawing(gm, config, writePath, Ge tGr(), 1219 errorsForThisConfig.add(gmmain.test_drawing(gm, config, writePath, G etGr(),
1248 renderTarget, &comparison Bitmap); 1220 renderTarget, &compariso nBitmap));
1249 } 1221 }
1250 1222
1251 if (FLAGS_deferred && !errorsForThisConfig && 1223 if (FLAGS_deferred && errorsForThisConfig.isEmpty() &&
1252 (kGPU_Backend == config.fBackend || 1224 (kGPU_Backend == config.fBackend || kRaster_Backend == config.fBacke nd)) {
1253 kRaster_Backend == config.fBackend)) { 1225 errorsForThisConfig.add(gmmain.test_deferred_drawing(gm, config, com parisonBitmap,
1254 errorsForThisConfig |= gmmain.test_deferred_drawing(gm, config, comp arisonBitmap, 1226 GetGr(), render Target));
1255 GetGr(), renderT arget);
1256 } 1227 }
1257 1228
1258 errorsForAllConfigs |= errorsForThisConfig; 1229 errorsForAllConfigs.add(errorsForThisConfig);
1259 } 1230 }
1260 return errorsForAllConfigs; 1231 return errorsForAllConfigs;
1261 } 1232 }
1262 1233
1263 /** 1234 /**
1264 * Run this test in a number of different drawing modes (pipe, 1235 * Run this test in a number of different drawing modes (pipe,
1265 * deferred, tiled, etc.), confirming that the resulting bitmaps all 1236 * deferred, tiled, etc.), confirming that the resulting bitmaps all
1266 * *exactly* match comparisonBitmap. 1237 * *exactly* match comparisonBitmap.
1267 * 1238 *
1268 * Returns all errors encountered while doing so. 1239 * Returns all errors encountered while doing so.
1269 */ 1240 */
1270 ErrorBitfield run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &compa reConfig, 1241 ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &co mpareConfig,
1271 const SkBitmap &comparisonBitmap); 1242 const SkBitmap &comparisonBitmap,
1272 ErrorBitfield run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &compa reConfig, 1243 const SkTDArray<SkScalar> &tileGridReplaySca les);
1273 const SkBitmap &comparisonBitmap) { 1244 ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &co mpareConfig,
1274 SkTDArray<SkScalar> tileGridReplayScales; 1245 const SkBitmap &comparisonBitmap,
1275 *tileGridReplayScales.append() = SK_Scalar1; // By default only test at scal e 1.0 1246 const SkTDArray<SkScalar> &tileGridReplaySca les) {
1276 if (FLAGS_tileGridReplayScales.count() > 0) { 1247 ErrorCombination errorsForAllModes;
1277 tileGridReplayScales.reset();
1278 for (int i = 0; i < FLAGS_tileGridReplayScales.count(); i++) {
1279 double val = atof(FLAGS_tileGridReplayScales[i]);
1280 if (0 < val) {
1281 *tileGridReplayScales.append() = SkDoubleToScalar(val);
1282 }
1283 }
1284 if (0 == tileGridReplayScales.count()) {
1285 // Should have at least one scale
1286 gm_fprintf(stderr, "--tileGridReplayScales requires at least one sca le.\n");
1287 return -1;
1288 }
1289 }
1290
1291 ErrorBitfield errorsForAllModes = kEmptyErrorBitfield;
1292 uint32_t gmFlags = gm->getFlags(); 1248 uint32_t gmFlags = gm->getFlags();
1293 1249
1294 // run the picture centric GM steps 1250 // run the picture centric GM steps
1295 if (!(gmFlags & GM::kSkipPicture_Flag)) { 1251 if (!(gmFlags & GM::kSkipPicture_Flag)) {
1296 1252
1297 ErrorBitfield pictErrors = kEmptyErrorBitfield; 1253 ErrorCombination pictErrors;
1298 1254
1299 //SkAutoTUnref<SkPicture> pict(generate_new_picture(gm)); 1255 //SkAutoTUnref<SkPicture> pict(generate_new_picture(gm));
1300 SkPicture* pict = gmmain.generate_new_picture(gm, kNone_BbhType, 0); 1256 SkPicture* pict = gmmain.generate_new_picture(gm, kNone_BbhType, 0);
1301 SkAutoUnref aur(pict); 1257 SkAutoUnref aur(pict);
1302 1258
1303 if (FLAGS_replay) { 1259 if (FLAGS_replay) {
1304 SkBitmap bitmap; 1260 SkBitmap bitmap;
1305 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap) ; 1261 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap) ;
1306 pictErrors |= gmmain.compare_test_results_to_reference_bitmap( 1262 pictErrors.add(gmmain.compare_test_results_to_reference_bitmap(
1307 gm, compareConfig, "-replay", bitmap, &comparisonBitmap); 1263 gm, compareConfig, "-replay", bitmap, &comparisonBitmap));
1308 } 1264 }
1309 1265
1310 if ((kEmptyErrorBitfield == pictErrors) && FLAGS_serialize) { 1266 if ((pictErrors.isEmpty()) && FLAGS_serialize) {
1311 SkPicture* repict = gmmain.stream_to_new_picture(*pict); 1267 SkPicture* repict = gmmain.stream_to_new_picture(*pict);
1312 SkAutoUnref aurr(repict); 1268 SkAutoUnref aurr(repict);
1313 1269
1314 SkBitmap bitmap; 1270 SkBitmap bitmap;
1315 gmmain.generate_image_from_picture(gm, compareConfig, repict, &bitma p); 1271 gmmain.generate_image_from_picture(gm, compareConfig, repict, &bitma p);
1316 pictErrors |= gmmain.compare_test_results_to_reference_bitmap( 1272 pictErrors.add(gmmain.compare_test_results_to_reference_bitmap(
1317 gm, compareConfig, "-serialize", bitmap, &comparisonBitmap); 1273 gm, compareConfig, "-serialize", bitmap, &comparisonBitmap));
1318 } 1274 }
1319 1275
1320 if (FLAGS_writePicturePath.count() == 1) { 1276 if (FLAGS_writePicturePath.count() == 1) {
1321 const char* pictureSuffix = "skp"; 1277 const char* pictureSuffix = "skp";
1322 SkString path = make_filename(FLAGS_writePicturePath[0], "", 1278 SkString path = make_filename(FLAGS_writePicturePath[0], "",
1323 gm->shortName(), pictureSuffix); 1279 gm->shortName(), pictureSuffix);
1324 SkFILEWStream stream(path.c_str()); 1280 SkFILEWStream stream(path.c_str());
1325 pict->serialize(&stream); 1281 pict->serialize(&stream);
1326 } 1282 }
1327 1283
1328 errorsForAllModes |= pictErrors; 1284 errorsForAllModes.add(pictErrors);
1329 } 1285 }
1330 1286
1331 // TODO: add a test in which the RTree rendering results in a 1287 // TODO: add a test in which the RTree rendering results in a
1332 // different bitmap than the standard rendering. It should 1288 // different bitmap than the standard rendering. It should
1333 // show up as failed in the JSON summary, and should be listed 1289 // show up as failed in the JSON summary, and should be listed
1334 // in the stdout also. 1290 // in the stdout also.
1335 if (!(gmFlags & GM::kSkipPicture_Flag) && FLAGS_rtree) { 1291 if (!(gmFlags & GM::kSkipPicture_Flag) && FLAGS_rtree) {
1336 SkPicture* pict = gmmain.generate_new_picture( 1292 SkPicture* pict = gmmain.generate_new_picture(
1337 gm, kRTree_BbhType, SkPicture::kUsePathBoundsForClip_RecordingFlag); 1293 gm, kRTree_BbhType, SkPicture::kUsePathBoundsForClip_RecordingFlag);
1338 SkAutoUnref aur(pict); 1294 SkAutoUnref aur(pict);
1339 SkBitmap bitmap; 1295 SkBitmap bitmap;
1340 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap); 1296 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap);
1341 errorsForAllModes |= gmmain.compare_test_results_to_reference_bitmap( 1297 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitmap(
1342 gm, compareConfig, "-rtree", bitmap, &comparisonBitmap); 1298 gm, compareConfig, "-rtree", bitmap, &comparisonBitmap));
1343 } 1299 }
1344 1300
1345 if (!(gmFlags & GM::kSkipPicture_Flag) && FLAGS_tileGrid) { 1301 if (!(gmFlags & GM::kSkipPicture_Flag) && FLAGS_tileGrid) {
1346 for(int scaleIndex = 0; scaleIndex < tileGridReplayScales.count(); ++sca leIndex) { 1302 for(int scaleIndex = 0; scaleIndex < tileGridReplayScales.count(); ++sca leIndex) {
1347 SkScalar replayScale = tileGridReplayScales[scaleIndex]; 1303 SkScalar replayScale = tileGridReplayScales[scaleIndex];
1348 if ((gmFlags & GM::kSkipScaledReplay_Flag) && replayScale != 1) { 1304 if ((gmFlags & GM::kSkipScaledReplay_Flag) && replayScale != 1) {
1349 continue; 1305 continue;
1350 } 1306 }
1351 // We record with the reciprocal scale to obtain a replay 1307 // We record with the reciprocal scale to obtain a replay
1352 // result that can be validated against comparisonBitmap. 1308 // result that can be validated against comparisonBitmap.
1353 SkScalar recordScale = SkScalarInvert(replayScale); 1309 SkScalar recordScale = SkScalarInvert(replayScale);
1354 SkPicture* pict = gmmain.generate_new_picture( 1310 SkPicture* pict = gmmain.generate_new_picture(
1355 gm, kTileGrid_BbhType, SkPicture::kUsePathBoundsForClip_Recordin gFlag, recordScale); 1311 gm, kTileGrid_BbhType, SkPicture::kUsePathBoundsForClip_Recordin gFlag, recordScale);
1356 SkAutoUnref aur(pict); 1312 SkAutoUnref aur(pict);
1357 SkBitmap bitmap; 1313 SkBitmap bitmap;
1358 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap, replayScale); 1314 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap, replayScale);
1359 SkString suffix("-tilegrid"); 1315 SkString suffix("-tilegrid");
1360 if (SK_Scalar1 != replayScale) { 1316 if (SK_Scalar1 != replayScale) {
1361 suffix += "-scale-"; 1317 suffix += "-scale-";
1362 suffix.appendScalar(replayScale); 1318 suffix.appendScalar(replayScale);
1363 } 1319 }
1364 errorsForAllModes |= gmmain.compare_test_results_to_reference_bitmap ( 1320 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitma p(
1365 gm, compareConfig, suffix.c_str(), bitmap, &comparisonBitmap); 1321 gm, compareConfig, suffix.c_str(), bitmap, &comparisonBitmap));
1366 } 1322 }
1367 } 1323 }
1368 1324
1369 // run the pipe centric GM steps 1325 // run the pipe centric GM steps
1370 if (!(gmFlags & GM::kSkipPipe_Flag)) { 1326 if (!(gmFlags & GM::kSkipPipe_Flag)) {
1371 1327
1372 ErrorBitfield pipeErrors = kEmptyErrorBitfield; 1328 ErrorCombination pipeErrors;
1373 1329
1374 if (FLAGS_pipe) { 1330 if (FLAGS_pipe) {
1375 pipeErrors |= gmmain.test_pipe_playback(gm, compareConfig, compariso nBitmap); 1331 pipeErrors.add(gmmain.test_pipe_playback(gm, compareConfig, comparis onBitmap));
1376 } 1332 }
1377 1333
1378 if ((kEmptyErrorBitfield == pipeErrors) && 1334 if ((pipeErrors.isEmpty()) &&
1379 FLAGS_tiledPipe && !(gmFlags & GM::kSkipTiled_Flag)) { 1335 FLAGS_tiledPipe && !(gmFlags & GM::kSkipTiled_Flag)) {
1380 pipeErrors |= gmmain.test_tiled_pipe_playback(gm, compareConfig, com parisonBitmap); 1336 pipeErrors.add(gmmain.test_tiled_pipe_playback(gm, compareConfig, co mparisonBitmap));
1381 } 1337 }
1382 1338
1383 errorsForAllModes |= pipeErrors; 1339 errorsForAllModes.add(pipeErrors);
1384 } 1340 }
1385 return errorsForAllModes; 1341 return errorsForAllModes;
1386 } 1342 }
1387 1343
1388 int tool_main(int argc, char** argv); 1344 int tool_main(int argc, char** argv);
1389 int tool_main(int argc, char** argv) { 1345 int tool_main(int argc, char** argv) {
1390 1346
1391 #if SK_ENABLE_INST_COUNT 1347 #if SK_ENABLE_INST_COUNT
1392 gPrintInstCount = true; 1348 gPrintInstCount = true;
1393 #endif 1349 #endif
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 1395
1440 if (FLAGS_modulo.count() == 2) { 1396 if (FLAGS_modulo.count() == 2) {
1441 moduloRemainder = atoi(FLAGS_modulo[0]); 1397 moduloRemainder = atoi(FLAGS_modulo[0]);
1442 moduloDivisor = atoi(FLAGS_modulo[1]); 1398 moduloDivisor = atoi(FLAGS_modulo[1]);
1443 if (moduloRemainder < 0 || moduloDivisor <= 0 || moduloRemainder >= modu loDivisor) { 1399 if (moduloRemainder < 0 || moduloDivisor <= 0 || moduloRemainder >= modu loDivisor) {
1444 gm_fprintf(stderr, "invalid modulo values."); 1400 gm_fprintf(stderr, "invalid modulo values.");
1445 return -1; 1401 return -1;
1446 } 1402 }
1447 } 1403 }
1448 1404
1405 int gpuCacheSizeBytes = -1; // -1 means use the default
1406 int gpuCacheSizeCount = -1; // -1 means use the default
1407 #if SK_SUPPORT_GPU
1408 if (FLAGS_gpuCacheSize.count() > 0) {
epoger 2013/03/21 20:40:17 I had to move this flag parsing code out of the fu
1409 if (FLAGS_gpuCacheSize.count() != 2) {
1410 gm_fprintf(stderr, "--gpuCacheSize requires two arguments\n");
1411 return -1;
1412 }
1413 gpuCacheSizeBytes = atoi(FLAGS_gpuCacheSize[0]);
1414 gpuCacheSizeCount = atoi(FLAGS_gpuCacheSize[1]);
1415 }
1416 #endif
1417
1418 SkTDArray<SkScalar> tileGridReplayScales;
1419 *tileGridReplayScales.append() = SK_Scalar1; // By default only test at scal e 1.0
1420 if (FLAGS_tileGridReplayScales.count() > 0) {
1421 tileGridReplayScales.reset();
1422 for (int i = 0; i < FLAGS_tileGridReplayScales.count(); i++) {
1423 double val = atof(FLAGS_tileGridReplayScales[i]);
1424 if (0 < val) {
1425 *tileGridReplayScales.append() = SkDoubleToScalar(val);
1426 }
1427 }
1428 if (0 == tileGridReplayScales.count()) {
1429 // Should have at least one scale
1430 gm_fprintf(stderr, "--tileGridReplayScales requires at least one sca le.\n");
1431 return -1;
1432 }
1433 }
1434
1449 if (!userConfig) { 1435 if (!userConfig) {
1450 // if no config is specified by user, add the defaults 1436 // if no config is specified by user, add the defaults
1451 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { 1437 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
1452 if (gRec[i].fRunByDefault) { 1438 if (gRec[i].fRunByDefault) {
1453 *configs.append() = i; 1439 *configs.append() = i;
1454 } 1440 }
1455 } 1441 }
1456 } 1442 }
1457 // now remove any explicitly excluded configs 1443 // now remove any explicitly excluded configs
1458 for (int i = 0; i < excludeConfigs.count(); ++i) { 1444 for (int i = 0; i < excludeConfigs.count(); ++i) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 const char* shortName = gm->shortName(); 1563 const char* shortName = gm->shortName();
1578 if (skip_name(FLAGS_match, shortName)) { 1564 if (skip_name(FLAGS_match, shortName)) {
1579 SkDELETE(gm); 1565 SkDELETE(gm);
1580 continue; 1566 continue;
1581 } 1567 }
1582 1568
1583 SkISize size = gm->getISize(); 1569 SkISize size = gm->getISize();
1584 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short Name, 1570 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short Name,
1585 size.width(), size.height()); 1571 size.width(), size.height());
1586 1572
1587 ErrorBitfield testErrors = kEmptyErrorBitfield; 1573 ErrorCombination testErrors;
1588 testErrors |= run_multiple_configs(gmmain, gm, configs, grFactory); 1574 testErrors.add(run_multiple_configs(gmmain, gm, configs, grFactory,
1575 gpuCacheSizeBytes, gpuCacheSizeCount ));
1589 1576
1590 SkBitmap comparisonBitmap; 1577 SkBitmap comparisonBitmap;
1591 const ConfigData compareConfig = 1578 const ConfigData compareConfig =
1592 { SkBitmap::kARGB_8888_Config, kRaster_Backend, kDontCare_GLContextT ype, 0, kRW_ConfigFlag, "comparison", false }; 1579 { SkBitmap::kARGB_8888_Config, kRaster_Backend, kDontCare_GLContextT ype, 0, kRW_ConfigFlag, "comparison", false };
1593 testErrors |= gmmain.generate_image(gm, compareConfig, NULL, NULL, &comp arisonBitmap, false); 1580 testErrors.add(gmmain.generate_image(
1581 gm, compareConfig, NULL, NULL, &comparisonBitmap, false));
1594 1582
1595 // TODO(epoger): only run this if gmmain.generate_image() succeeded? 1583 // TODO(epoger): only run this if gmmain.generate_image() succeeded?
1596 // Otherwise, what are we comparing against? 1584 // Otherwise, what are we comparing against?
1597 testErrors |= run_multiple_modes(gmmain, gm, compareConfig, comparisonBi tmap); 1585 testErrors.add(run_multiple_modes(gmmain, gm, compareConfig, comparisonB itmap,
1586 tileGridReplayScales));
1598 1587
1599 // Update overall results. 1588 // Update overall results.
1600 // We only tabulate the particular error types that we currently 1589 // We only tabulate the particular error types that we currently
1601 // care about (e.g., missing reference images). Later on, if we 1590 // care about (e.g., missing reference images). Later on, if we
1602 // want to also tabulate other error types, we can do so. 1591 // want to also tabulate other error types, we can do so.
1603 testsRun++; 1592 testsRun++;
1604 if (!gmmain.fExpectationsSource.get() || 1593 if (!gmmain.fExpectationsSource.get() ||
1605 (kEmptyErrorBitfield != (kMissingExpectations_ErrorBitmask & testErr ors))) { 1594 (testErrors.includes(kMissingExpectations_ErrorType))) {
1606 testsMissingReferenceImages++; 1595 testsMissingReferenceImages++;
1607 } 1596 }
1608 if (testErrors == (testErrors & kIgnorable_ErrorBitmask)) { 1597 if (testErrors.minus(gmmain.fIgnorableErrorCombination).isEmpty()) {
1609 testsPassed++; 1598 testsPassed++;
1610 } else { 1599 } else {
1611 testsFailed++; 1600 testsFailed++;
1612 } 1601 }
1613 1602
1614 SkDELETE(gm); 1603 SkDELETE(gm);
1615 } 1604 }
1616 gm_fprintf(stdout, "Ran %d tests: %d passed, %d failed, %d missing reference images\n", 1605 gm_fprintf(stdout, "Ran %d tests: %d passed, %d failed, %d missing reference images\n",
1617 testsRun, testsPassed, testsFailed, testsMissingReferenceImages); 1606 testsRun, testsPassed, testsFailed, testsMissingReferenceImages);
1618 gmmain.ListErrors(); 1607 gmmain.ListErrors();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 if (FLAGS_forceBWtext) { 1650 if (FLAGS_forceBWtext) {
1662 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 1651 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
1663 } 1652 }
1664 } 1653 }
1665 1654
1666 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 1655 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
1667 int main(int argc, char * const argv[]) { 1656 int main(int argc, char * const argv[]) {
1668 return tool_main(argc, (char**) argv); 1657 return tool_main(argc, (char**) argv);
1669 } 1658 }
1670 #endif 1659 #endif
OLDNEW
« gm/gm_error.h ('K') | « gm/gm_error.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698