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

Side by Side Diff: tools/skdiff_main.cpp

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 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
« no previous file with comments | « tools/get_images_from_skps.cpp ('k') | tools/skdiff_utils.h » ('j') | 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 #include "skdiff.h" 7 #include "skdiff.h"
8 #include "skdiff_html.h" 8 #include "skdiff_html.h"
9 #include "skdiff_utils.h" 9 #include "skdiff_utils.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 338 }
339 339
340 private: 340 private:
341 DiffRecord* fDrp; 341 DiffRecord* fDrp;
342 }; 342 };
343 343
344 static void get_bounds(DiffResource& resource, const char* name) { 344 static void get_bounds(DiffResource& resource, const char* name) {
345 if (resource.fBitmap.empty() && !DiffResource::isStatusFailed(resource.fStat us)) { 345 if (resource.fBitmap.empty() && !DiffResource::isStatusFailed(resource.fStat us)) {
346 sk_sp<SkData> fileBits(read_file(resource.fFullPath.c_str())); 346 sk_sp<SkData> fileBits(read_file(resource.fFullPath.c_str()));
347 if (fileBits) { 347 if (fileBits) {
348 get_bitmap(fileBits.get(), resource, true); 348 get_bitmap(fileBits, resource, true);
349 } else { 349 } else {
350 SkDebugf("WARNING: couldn't read %s file <%s>\n", name, resource.fFu llPath.c_str()); 350 SkDebugf("WARNING: couldn't read %s file <%s>\n", name, resource.fFu llPath.c_str());
351 resource.fStatus = DiffResource::kCouldNotRead_Status; 351 resource.fStatus = DiffResource::kCouldNotRead_Status;
352 } 352 }
353 } 353 }
354 } 354 }
355 355
356 static void get_bounds(DiffRecord& drp) { 356 static void get_bounds(DiffRecord& drp) {
357 get_bounds(drp.fBase, "base"); 357 get_bounds(drp.fBase, "base");
358 get_bounds(drp.fComparison, "comparison"); 358 get_bounds(drp.fComparison, "comparison");
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 drp->fComparison.fStatus = DiffResource::kCouldNotRead_Statu s; 489 drp->fComparison.fStatus = DiffResource::kCouldNotRead_Statu s;
490 VERBOSE_STATUS("READ FAIL", ANSI_COLOR_RED, comparisonFiles[ j]); 490 VERBOSE_STATUS("READ FAIL", ANSI_COLOR_RED, comparisonFiles[ j]);
491 } 491 }
492 drp->fResult = DiffRecord::kCouldNotCompare_Result; 492 drp->fResult = DiffRecord::kCouldNotCompare_Result;
493 493
494 } else if (are_buffers_equal(baseFileBits.get(), comparisonFileBits. get())) { 494 } else if (are_buffers_equal(baseFileBits.get(), comparisonFileBits. get())) {
495 drp->fResult = DiffRecord::kEqualBits_Result; 495 drp->fResult = DiffRecord::kEqualBits_Result;
496 VERBOSE_STATUS("MATCH", ANSI_COLOR_GREEN, baseFiles[i]); 496 VERBOSE_STATUS("MATCH", ANSI_COLOR_GREEN, baseFiles[i]);
497 } else { 497 } else {
498 AutoReleasePixels arp(drp); 498 AutoReleasePixels arp(drp);
499 get_bitmap(baseFileBits.get(), drp->fBase, false); 499 get_bitmap(baseFileBits, drp->fBase, false);
500 get_bitmap(comparisonFileBits.get(), drp->fComparison, false); 500 get_bitmap(comparisonFileBits, drp->fComparison, false);
501 VERBOSE_STATUS("DIFFERENT", ANSI_COLOR_RED, baseFiles[i]); 501 VERBOSE_STATUS("DIFFERENT", ANSI_COLOR_RED, baseFiles[i]);
502 if (DiffResource::kDecoded_Status == drp->fBase.fStatus && 502 if (DiffResource::kDecoded_Status == drp->fBase.fStatus &&
503 DiffResource::kDecoded_Status == drp->fComparison.fStatus) { 503 DiffResource::kDecoded_Status == drp->fComparison.fStatus) {
504 create_and_write_diff_image(drp, dmp, colorThreshold, 504 create_and_write_diff_image(drp, dmp, colorThreshold,
505 outputDir, drp->fBase.fFilename) ; 505 outputDir, drp->fBase.fFilename) ;
506 } else { 506 } else {
507 drp->fResult = DiffRecord::kCouldNotCompare_Result; 507 drp->fResult = DiffRecord::kCouldNotCompare_Result;
508 } 508 }
509 } 509 }
510 510
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 // range [0...255] are wrapped (mod 256). Do the conversion ourselves, to 853 // range [0...255] are wrapped (mod 256). Do the conversion ourselves, to
854 // make sure that we only return 0 when there were no failures. 854 // make sure that we only return 0 when there were no failures.
855 return (num_failing_results > 255) ? 255 : num_failing_results; 855 return (num_failing_results > 255) ? 255 : num_failing_results;
856 } 856 }
857 857
858 #if !defined SK_BUILD_FOR_IOS 858 #if !defined SK_BUILD_FOR_IOS
859 int main(int argc, char * const argv[]) { 859 int main(int argc, char * const argv[]) {
860 return tool_main(argc, (char**) argv); 860 return tool_main(argc, (char**) argv);
861 } 861 }
862 #endif 862 #endif
OLDNEW
« no previous file with comments | « tools/get_images_from_skps.cpp ('k') | tools/skdiff_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698