Chromium Code Reviews| Index: tools/skpdiff/SkDifferentPixelsMetric_cpu.cpp |
| diff --git a/tools/skpdiff/SkDifferentPixelsMetric_cpu.cpp b/tools/skpdiff/SkDifferentPixelsMetric_cpu.cpp |
| index 4e5e93969c3f743ecc6024bbba9576a06a3791ef..d09394f9b0491fb9641dec63f9252c8e6a2d1089 100644 |
| --- a/tools/skpdiff/SkDifferentPixelsMetric_cpu.cpp |
| +++ b/tools/skpdiff/SkDifferentPixelsMetric_cpu.cpp |
| @@ -16,6 +16,7 @@ struct SkDifferentPixelsMetric::QueuedDiff { |
| bool finished; |
| double result; |
| SkTDArray<SkIPoint>* poi; |
| + SkBitmap poiAlphaMask; |
| }; |
| const char* SkDifferentPixelsMetric::getName() { |
| @@ -44,6 +45,14 @@ int SkDifferentPixelsMetric::queueDiff(SkBitmap* baseline, SkBitmap* test) { |
| int height = baseline->height(); |
| int differentPixelsCount = 0; |
| + // Prepare the POI alpha mask if needed |
| + if (fPOIAlphaMask) { |
|
epoger
2013/10/21 15:02:53
Where is fPOIAlphaMask declared? I don't see it i
|
| + diff->poiAlphaMask.setConfig(SkBitmap::kA8_Config, width, height); |
| + diff->poiAlphaMask.allocPixels(); |
| + diff->poiAlphaMask.lockPixels(); |
| + diff->poiAlphaMask.eraseARGB(SK_AlphaOPAQUE, 0, 0, 0); |
| + } |
| + |
| // Prepare the pixels for comparison |
| baseline->lockPixels(); |
| test->lockPixels(); |
| @@ -56,6 +65,9 @@ int SkDifferentPixelsMetric::queueDiff(SkBitmap* baseline, SkBitmap* test) { |
| if (std::memcmp(&baselineRow[x * 4], &testRow[x * 4], 4) != 0) { |
| poi->push()->set(x, y); |
| differentPixelsCount++; |
| + if (fPOIAlphaMask) { |
| + *diff->poiAlphaMask.getAddr8(x,y) = SK_AlphaTRANSPARENT; |
| + } |
| } |
| } |
| } |
| @@ -93,3 +105,10 @@ int SkDifferentPixelsMetric::getPointsOfInterestCount(int id) { |
| SkIPoint* SkDifferentPixelsMetric::getPointsOfInterest(int id) { |
| return fQueuedDiffs[id].poi->begin(); |
| } |
| + |
| +SkBitmap* SkDifferentPixelsMetric::getPointsOfInterestAlphaMask(int id) { |
| + if (fQueuedDiffs[id].poiAlphaMask.empty()) { |
| + return NULL; |
| + } |
| + return &fQueuedDiffs[id].poiAlphaMask; |
| +} |