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

Unified Diff: experimental/skpdiff/SkPMetric.cpp

Issue 18176005: add point of interest API (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: constant zero buffer Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « experimental/skpdiff/SkPMetric.h ('k') | experimental/skpdiff/diff_pixels.cl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+}
« no previous file with comments | « experimental/skpdiff/SkPMetric.h ('k') | experimental/skpdiff/diff_pixels.cl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698