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

Side by Side Diff: tools/skpdiff/SkPMetric.cpp

Issue 234833003: Revert of Rename kPMColor_SkColorType to kN32_SkColorType. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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 unified diff | Download patch
« no previous file with comments | « tools/skpdiff/SkDiffContext.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "SkPMetricUtil_generated.h" 6 #include "SkPMetricUtil_generated.h"
7 7
8 struct RGB { 8 struct RGB {
9 float r, g, b; 9 float r, g, b;
10 }; 10 };
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 } 119 }
120 lab->l = 116.0f * f[1] - 16.0f; 120 lab->l = 116.0f * f[1] - 16.0f;
121 lab->a = 500.0f * (f[0] - f[1]); 121 lab->a = 500.0f * (f[0] - f[1]);
122 lab->b = 200.0f * (f[1] - f[2]); 122 lab->b = 200.0f * (f[1] - f[2]);
123 } 123 }
124 124
125 /// Converts a 8888 bitmap to LAB color space and puts it into the output 125 /// Converts a 8888 bitmap to LAB color space and puts it into the output
126 static bool bitmap_to_cielab(const SkBitmap* bitmap, ImageLAB* outImageLAB) { 126 static bool bitmap_to_cielab(const SkBitmap* bitmap, ImageLAB* outImageLAB) {
127 SkBitmap bm8888; 127 SkBitmap bm8888;
128 if (bitmap->colorType() != kN32_SkColorType) { 128 if (bitmap->colorType() != kPMColor_SkColorType) {
129 if (!bitmap->copyTo(&bm8888, kN32_SkColorType)) { 129 if (!bitmap->copyTo(&bm8888, kPMColor_SkColorType)) {
130 return false; 130 return false;
131 } 131 }
132 bitmap = &bm8888; 132 bitmap = &bm8888;
133 } 133 }
134 134
135 int width = bitmap->width(); 135 int width = bitmap->width();
136 int height = bitmap->height(); 136 int height = bitmap->height();
137 SkASSERT(outImageLAB->width == width); 137 SkASSERT(outImageLAB->width == width);
138 SkASSERT(outImageLAB->height == height); 138 SkASSERT(outImageLAB->height == height);
139 139
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 if (!bitmap_to_cielab(baseline, &baselineLAB) || !bitmap_to_cielab(test, &te stLAB)) { 454 if (!bitmap_to_cielab(baseline, &baselineLAB) || !bitmap_to_cielab(test, &te stLAB)) {
455 return true; 455 return true;
456 } 456 }
457 457
458 result->poiCount = 0; 458 result->poiCount = 0;
459 result->result = pmetric(&baselineLAB, &testLAB, &result->poiCount); 459 result->result = pmetric(&baselineLAB, &testLAB, &result->poiCount);
460 result->timeElapsed = get_seconds() - startTime; 460 result->timeElapsed = get_seconds() - startTime;
461 461
462 return true; 462 return true;
463 } 463 }
OLDNEW
« no previous file with comments | « tools/skpdiff/SkDiffContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698