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

Unified Diff: tests/PMFloatTest.cpp

Issue 978213003: 4-at-a-time SkPMColor -> SkPMFloat API. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 4 Created 5 years, 10 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 | « src/core/SkPMFloat.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PMFloatTest.cpp
diff --git a/tests/PMFloatTest.cpp b/tests/PMFloatTest.cpp
index 3f5e1c0b75492671cfc83a25b070acaa0575c56c..13c0a120b861b6ca3fa49ecdd0f6abb31c11eefa 100644
--- a/tests/PMFloatTest.cpp
+++ b/tests/PMFloatTest.cpp
@@ -29,4 +29,20 @@ DEF_TEST(SkPMFloat, r) {
REPORTER_ASSERT(r, SkScalarNearlyEqual(38.25f, scaled.r()));
REPORTER_ASSERT(r, SkScalarNearlyEqual( 0.25f, scaled.g()));
REPORTER_ASSERT(r, SkScalarNearlyEqual( 0.00f, scaled.b()));
+
+ // Test 4-at-a-time conversions.
+ SkPMColor colors[4] = { 0xFF000000, 0xFFFF0000, 0xFF00FF00, 0xFF0000FF };
+ SkPMFloat floats[4];
+ SkPMFloat::From4PMColors(floats, colors);
+
+ SkPMColor back[4];
+ SkPMFloat::To4PMColors(back, floats);
+ for (int i = 0; i < 4; i++) {
+ REPORTER_ASSERT(r, back[i] == colors[i]);
+ }
+
+ SkPMFloat::ClampTo4PMColors(back, floats);
+ for (int i = 0; i < 4; i++) {
+ REPORTER_ASSERT(r, back[i] == colors[i]);
+ }
}
« no previous file with comments | « src/core/SkPMFloat.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698