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

Unified Diff: tests/PMFloatTest.cpp

Issue 977773002: Update SkPMFloat API a bit. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 32 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/opts/SkPMFloat_none.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 fbd8626cc813bff944449373d12d31d76fee1e24..3f5e1c0b75492671cfc83a25b070acaa0575c56c 100644
--- a/tests/PMFloatTest.cpp
+++ b/tests/PMFloatTest.cpp
@@ -4,9 +4,7 @@
DEF_TEST(SkPMFloat, r) {
// Test SkPMColor <-> SkPMFloat
SkPMColor c = SkPreMultiplyColor(0xFFCC9933);
-
- SkPMFloat pmf;
- pmf.set(c);
+ SkPMFloat pmf(c);
REPORTER_ASSERT(r, SkScalarNearlyEqual(255.0f, pmf.a()));
REPORTER_ASSERT(r, SkScalarNearlyEqual(204.0f, pmf.r()));
REPORTER_ASSERT(r, SkScalarNearlyEqual(153.0f, pmf.g()));
@@ -14,22 +12,11 @@ DEF_TEST(SkPMFloat, r) {
REPORTER_ASSERT(r, c == pmf.get());
// Test rounding. (Don't bother testing .5... we don't care which way it goes.)
- pmf.setA(254.6f);
- pmf.setR(204.3f);
- pmf.setG(153.1f);
- pmf.setB( 50.8f);
+ pmf = SkPMFloat(254.6f, 204.3f, 153.1f, 50.8f);
REPORTER_ASSERT(r, c == pmf.get());
// Test clamping.
- SkPMFloat unclamped;
- unclamped.setA(+510.0f);
- unclamped.setR(+153.0f);
- unclamped.setG( +1.0f);
- unclamped.setB( -0.2f);
-
- SkPMFloat clamped;
- clamped.set(unclamped.clamped());
-
+ SkPMFloat clamped(SkPMFloat(510.0f, 153.0f, 1.0f, -0.2f).clamped());
REPORTER_ASSERT(r, SkScalarNearlyEqual(255.0f, clamped.a()));
REPORTER_ASSERT(r, SkScalarNearlyEqual(153.0f, clamped.r()));
REPORTER_ASSERT(r, SkScalarNearlyEqual( 1.0f, clamped.g()));
@@ -38,7 +25,6 @@ DEF_TEST(SkPMFloat, r) {
// Test SkPMFloat <-> Sk4f conversion.
Sk4f fs = clamped;
SkPMFloat scaled = fs.multiply(0.25f);
-
REPORTER_ASSERT(r, SkScalarNearlyEqual(63.75f, scaled.a()));
REPORTER_ASSERT(r, SkScalarNearlyEqual(38.25f, scaled.r()));
REPORTER_ASSERT(r, SkScalarNearlyEqual( 0.25f, scaled.g()));
« no previous file with comments | « src/opts/SkPMFloat_none.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698