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

Side by Side Diff: experimental/skpdiff/SkPMetric.cpp

Issue 18132007: add diff viewer website (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: test -> actual Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | experimental/skpdiff/diff_viewer.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include <cmath> 1 #include <cmath>
2 2
3 #include "SkBitmap.h" 3 #include "SkBitmap.h"
4 #include "skpdiff_util.h" 4 #include "skpdiff_util.h"
5 #include "SkPMetric.h" 5 #include "SkPMetric.h"
6 6
7 struct RGB { 7 struct RGB {
8 float r, g, b; 8 float r, g, b;
9 }; 9 };
10 10
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if (isFailure) { 372 if (isFailure) {
373 failures++; 373 failures++;
374 poi->push()->set(x, y); 374 poi->push()->set(x, y);
375 } 375 }
376 } 376 }
377 } 377 }
378 378
379 SkDELETE_ARRAY(cyclesPerDegree); 379 SkDELETE_ARRAY(cyclesPerDegree);
380 SkDELETE_ARRAY(contrast); 380 SkDELETE_ARRAY(contrast);
381 SkDELETE_ARRAY(thresholdFactorFrequency); 381 SkDELETE_ARRAY(thresholdFactorFrequency);
382 return (double)failures; 382 return 1.0 - (double)failures / (width * height);
383 } 383 }
384 384
385 const char* SkPMetric::getName() { 385 const char* SkPMetric::getName() {
386 return "perceptual"; 386 return "perceptual";
387 } 387 }
388 388
389 int SkPMetric::queueDiff(SkBitmap* baseline, SkBitmap* test) { 389 int SkPMetric::queueDiff(SkBitmap* baseline, SkBitmap* test) {
390 int diffID = fQueuedDiffs.count(); 390 int diffID = fQueuedDiffs.count();
391 double startTime = get_seconds(); 391 double startTime = get_seconds();
392 QueuedDiff& diff = fQueuedDiffs.push_back(); 392 QueuedDiff& diff = fQueuedDiffs.push_back();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 return fQueuedDiffs[id].result; 425 return fQueuedDiffs[id].result;
426 } 426 }
427 427
428 int SkPMetric::getPointsOfInterestCount(int id) { 428 int SkPMetric::getPointsOfInterestCount(int id) {
429 return fQueuedDiffs[id].poi.count(); 429 return fQueuedDiffs[id].poi.count();
430 } 430 }
431 431
432 SkIPoint* SkPMetric::getPointsOfInterest(int id) { 432 SkIPoint* SkPMetric::getPointsOfInterest(int id) {
433 return fQueuedDiffs[id].poi.begin(); 433 return fQueuedDiffs[id].poi.begin();
434 } 434 }
OLDNEW
« no previous file with comments | « no previous file | experimental/skpdiff/diff_viewer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698