OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |