| Index: src/core/SkPMFloat.h
|
| diff --git a/src/core/SkPMFloat.h b/src/core/SkPMFloat.h
|
| index 4a5621f5b3cc62cf6ae11b5173d8f449fcce10ef..46288323071b5032e05c805cfba45aafb07e2145 100644
|
| --- a/src/core/SkPMFloat.h
|
| +++ b/src/core/SkPMFloat.h
|
| @@ -21,8 +21,11 @@
|
| namespace {
|
|
|
| // A pre-multiplied color storing each component in the same order as SkPMColor,
|
| -// but as a float in the range [0, 1].
|
| +// but as a float in the range [0, kBias],
|
| +// where kBias is either 1 (easier to work with) or 255 (sometimes a little faster).
|
| +template <int kBias>
|
| class SkPMFloat : public Sk4f {
|
| + static_assert(kBias == 1 || kBias == 255, "");
|
| public:
|
| static SkPMFloat FromPMColor(SkPMColor c) { return SkPMFloat(c); }
|
| static SkPMFloat FromARGB(float a, float r, float g, float b) { return SkPMFloat(a,r,g,b); }
|
| @@ -47,10 +50,10 @@ public:
|
| float g() const { return this->kth<SK_G32_SHIFT / 8>(); }
|
| float b() const { return this->kth<SK_B32_SHIFT / 8>(); }
|
|
|
| - SkPMColor round() const; // Rounds from [0.0f, 1.0f] to [0, 255], clamping if out of range.
|
| + SkPMColor round() const; // Rounds from [0, kBias] to [0, 255], clamping if out of range.
|
|
|
| bool isValid() const {
|
| - return this->a() >= 0 && this->a() <= 1
|
| + return this->a() >= 0 && this->a() <= kBias
|
| && this->r() >= 0 && this->r() <= this->a()
|
| && this->g() >= 0 && this->g() <= this->a()
|
| && this->b() >= 0 && this->b() <= this->a();
|
|
|