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

Unified Diff: src/opts/SkPMFloat_none.h

Issue 974643002: Test and fix SkPMFloat rounding. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: f 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_neon.h ('k') | tests/PMFloatTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/SkPMFloat_none.h
diff --git a/src/opts/SkPMFloat_none.h b/src/opts/SkPMFloat_none.h
index 448b509d408e8545c4a25a01d9e30a9db0fae946..b67c8d74204af282a07b5c6519503365acad8958 100644
--- a/src/opts/SkPMFloat_none.h
+++ b/src/opts/SkPMFloat_none.h
@@ -10,7 +10,7 @@ inline void SkPMFloat::set(SkPMColor c) {
inline SkPMColor SkPMFloat::get() const {
SkASSERT(this->isValid());
- return SkPackARGB32(this->a(), this->r(), this->g(), this->b());
+ return SkPackARGB32(this->a()+0.5f, this->r()+0.5f, this->g()+0.5f, this->b()+0.5f);
}
inline SkPMColor SkPMFloat::clamped() const {
@@ -22,5 +22,5 @@ inline SkPMColor SkPMFloat::clamped() const {
r = r < 0 ? 0 : (r > 255 ? 255 : r);
g = g < 0 ? 0 : (g > 255 ? 255 : g);
b = b < 0 ? 0 : (b > 255 ? 255 : b);
- return SkPackARGB32(a, r, g, b);
+ return SkPackARGB32(a+0.5f, r+0.5f, g+0.5f, b+0.5f);
}
« no previous file with comments | « src/opts/SkPMFloat_neon.h ('k') | tests/PMFloatTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698