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

Unified Diff: src/core/SkPMFloat.h

Issue 1032243002: SkPMFloat::trunc() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove isValid assert in _none trunc() Created 5 years, 9 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 | « bench/PMFloatBench.cpp ('k') | src/opts/SkPMFloat_SSE2.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPMFloat.h
diff --git a/src/core/SkPMFloat.h b/src/core/SkPMFloat.h
index 1d034f049ba389f7702aceeeb0dca16ed804f643..66262a8916ae772ef59d78db76d4aae0c840d095 100644
--- a/src/core/SkPMFloat.h
+++ b/src/core/SkPMFloat.h
@@ -57,6 +57,10 @@ public:
SkPMColor get() const; // May SkASSERT(this->isValid()). Some implementations may clamp.
SkPMColor clamped() const; // Will clamp all values to [0, 255]. Then may assert isValid().
+ // Like get(), but truncates instead of rounding.
+ // The domain of this function is (-1.0f, 256.0f). Values in (-1.0f, 0.0f] trunc to a zero.
+ SkPMColor trunc() const;
+
// 4-at-a-time versions of get() and clamped(). Like From4PMColors(), no alignment assumed.
static void To4PMColors(
const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, SkPMColor[4]);
« no previous file with comments | « bench/PMFloatBench.cpp ('k') | src/opts/SkPMFloat_SSE2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698