| Index: experimental/skpdiff/SkPMetric.cpp
|
| diff --git a/experimental/skpdiff/SkPMetric.cpp b/experimental/skpdiff/SkPMetric.cpp
|
| index 7fbdec87aa4a5e8957f828ed41cba2399176776b..3aca0ab4fdcc3520a2646d8da1b8c47c982dcdcd 100644
|
| --- a/experimental/skpdiff/SkPMetric.cpp
|
| +++ b/experimental/skpdiff/SkPMetric.cpp
|
| @@ -229,7 +229,7 @@ static void convolve(const ImageL* imageL,
|
| }
|
| }
|
|
|
| -float pmetric(const ImageLAB* baselineLAB, const ImageLAB* testLAB) {
|
| +float pmetric(const ImageLAB* baselineLAB, const ImageLAB* testLAB, SkTDArray<SkIPoint>* poi) {
|
| int width = baselineLAB->width;
|
| int height = baselineLAB->height;
|
| int maxLevels = (int)log2(width < height ? width : height);
|
| @@ -367,6 +367,7 @@ float pmetric(const ImageLAB* baselineLAB, const ImageLAB* testLAB) {
|
|
|
| if (isFailure) {
|
| failures++;
|
| + poi->push()->set(x, y);
|
| }
|
| }
|
| }
|
| @@ -384,13 +385,13 @@ const char* SkPMetric::getName() {
|
| int SkPMetric::queueDiff(SkBitmap* baseline, SkBitmap* test) {
|
| int diffID = fQueuedDiffs.count();
|
| double startTime = get_seconds();
|
| - QueuedDiff* diff = fQueuedDiffs.push();
|
| + QueuedDiff& diff = fQueuedDiffs.push_back();
|
| + diff.result = 0.0;
|
|
|
| // Ensure the images are comparable
|
| if (baseline->width() != test->width() || baseline->height() != test->height() ||
|
| baseline->width() <= 0 || baseline->height() <= 0) {
|
| - diff->finished = true;
|
| - diff->result = 0.0;
|
| + diff.finished = true;
|
| return diffID;
|
| }
|
|
|
| @@ -400,7 +401,7 @@ int SkPMetric::queueDiff(SkBitmap* baseline, SkBitmap* test) {
|
| bitmap_to_cielab(baseline, &baselineLAB);
|
| bitmap_to_cielab(test, &testLAB);
|
|
|
| - diff->result = pmetric(&baselineLAB, &testLAB);
|
| + diff.result = pmetric(&baselineLAB, &testLAB, &diff.poi);
|
|
|
| SkDebugf("Time: %f\n", (get_seconds() - startTime));
|
|
|
| @@ -408,6 +409,10 @@ int SkPMetric::queueDiff(SkBitmap* baseline, SkBitmap* test) {
|
| }
|
|
|
|
|
| +void SkPMetric::deleteDiff(int id) {
|
| + fQueuedDiffs[id].poi.reset();
|
| +}
|
| +
|
| bool SkPMetric::isFinished(int id) {
|
| return fQueuedDiffs[id].finished;
|
| }
|
| @@ -415,3 +420,11 @@ bool SkPMetric::isFinished(int id) {
|
| double SkPMetric::getResult(int id) {
|
| return fQueuedDiffs[id].result;
|
| }
|
| +
|
| +int SkPMetric::getPointsOfInterestCount(int id) {
|
| + return fQueuedDiffs[id].poi.count();
|
| +}
|
| +
|
| +SkIPoint* SkPMetric::getPointsOfInterest(int id) {
|
| + return fQueuedDiffs[id].poi.begin();
|
| +}
|
|
|