| OLD | NEW |
| 1 #include <cmath> | 1 #include <cmath> |
| 2 #include <math.h> | 2 #include <math.h> |
| 3 | 3 |
| 4 #include "SkBitmap.h" | 4 #include "SkBitmap.h" |
| 5 #include "skpdiff_util.h" | 5 #include "skpdiff_util.h" |
| 6 #include "SkPMetric.h" | 6 #include "SkPMetric.h" |
| 7 #include "SkPMetricUtil_generated.h" | 7 #include "SkPMetricUtil_generated.h" |
| 8 | 8 |
| 9 struct RGB { | 9 struct RGB { |
| 10 float r, g, b; | 10 float r, g, b; |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 } | 435 } |
| 436 } | 436 } |
| 437 | 437 |
| 438 SkDELETE_ARRAY(cyclesPerDegree); | 438 SkDELETE_ARRAY(cyclesPerDegree); |
| 439 SkDELETE_ARRAY(contrast); | 439 SkDELETE_ARRAY(contrast); |
| 440 SkDELETE_ARRAY(thresholdFactorFrequency); | 440 SkDELETE_ARRAY(thresholdFactorFrequency); |
| 441 SkDELETE_ARRAY(contrastSensitivityTable); | 441 SkDELETE_ARRAY(contrastSensitivityTable); |
| 442 return 1.0 - (double)(*poiCount) / (width * height); | 442 return 1.0 - (double)(*poiCount) / (width * height); |
| 443 } | 443 } |
| 444 | 444 |
| 445 bool SkPMetric::diff(SkBitmap* baseline, SkBitmap* test, bool computeMask, Resul
t* result) const { | 445 bool SkPMetric::diff(SkBitmap* baseline, SkBitmap* test, const BitmapsToCreate&
bitmapsToCreate, |
| 446 Result* result) const { |
| 446 double startTime = get_seconds(); | 447 double startTime = get_seconds(); |
| 447 | 448 |
| 448 // Ensure the images are comparable | 449 // Ensure the images are comparable |
| 449 if (baseline->width() != test->width() || baseline->height() != test->height
() || | 450 if (baseline->width() != test->width() || baseline->height() != test->height
() || |
| 450 baseline->width() <= 0 || baseline->height() <= 0) { | 451 baseline->width() <= 0 || baseline->height() <= 0) { |
| 451 return false; | 452 return false; |
| 452 } | 453 } |
| 453 | 454 |
| 454 ImageLAB baselineLAB(baseline->width(), baseline->height()); | 455 ImageLAB baselineLAB(baseline->width(), baseline->height()); |
| 455 ImageLAB testLAB(baseline->width(), baseline->height()); | 456 ImageLAB testLAB(baseline->width(), baseline->height()); |
| 456 | 457 |
| 457 if (!bitmap_to_cielab(baseline, &baselineLAB) || !bitmap_to_cielab(test, &te
stLAB)) { | 458 if (!bitmap_to_cielab(baseline, &baselineLAB) || !bitmap_to_cielab(test, &te
stLAB)) { |
| 458 return true; | 459 return true; |
| 459 } | 460 } |
| 460 | 461 |
| 461 result->poiCount = 0; | 462 result->poiCount = 0; |
| 462 result->result = pmetric(&baselineLAB, &testLAB, &result->poiCount); | 463 result->result = pmetric(&baselineLAB, &testLAB, &result->poiCount); |
| 463 result->timeElapsed = get_seconds() - startTime; | 464 result->timeElapsed = get_seconds() - startTime; |
| 464 | 465 |
| 465 return true; | 466 return true; |
| 466 } | 467 } |
| OLD | NEW |