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

Unified Diff: src/core/SkPMFloat.h

Issue 973603002: Make SkPMFloats store floats in [0,255] instead of [0,1]. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: restore comment 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 | « no previous file | src/opts/SkPMFloat_SSE2.h » ('j') | src/opts/SkPMFloat_SSE2.h » ('J')
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 936487e842dfc9dd11e88f1a49a31943dc6441f5..b0cb3146c7e17192aecfc3363f96c61769cdd43e 100644
--- a/src/core/SkPMFloat.h
+++ b/src/core/SkPMFloat.h
@@ -5,7 +5,7 @@
#include "SkColor.h"
#include "Sk4x.h"
-// A pre-multiplied color storing each component as a float.
+// A pre-multiplied color storing each component as a float in the range [0, 255].
class SK_STRUCT_ALIGN(16) SkPMFloat {
public:
// Normal POD copies and do-nothing initialization.
@@ -30,10 +30,10 @@ public:
void set(SkPMColor);
SkPMColor get() const; // May SkASSERT(this->isValid()). Some implementations may clamp.
- SkPMColor clamped() const; // Will clamp all values to [0,1], then SkASSERT(this->isValid()).
+ SkPMColor clamped() const; // Will clamp all values to [0, 255]. Then may assert isValid().
bool isValid() const {
- return this->a() >= 0 && this->a() <= 1
+ return this->a() >= 0 && this->a() <= 255
&& this->r() >= 0 && this->r() <= this->a()
&& this->g() >= 0 && this->g() <= this->a()
&& this->b() >= 0 && this->b() <= this->a();
« no previous file with comments | « no previous file | src/opts/SkPMFloat_SSE2.h » ('j') | src/opts/SkPMFloat_SSE2.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698