| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkColor_DEFINED | 8 #ifndef SkColor_DEFINED |
| 9 #define SkColor_DEFINED | 9 #define SkColor_DEFINED |
| 10 | 10 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 typedef SkPMColor (*SkXfermodeProc)(SkPMColor src, SkPMColor dst); | 159 typedef SkPMColor (*SkXfermodeProc)(SkPMColor src, SkPMColor dst); |
| 160 | 160 |
| 161 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 161 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 162 | 162 |
| 163 struct SkPM4f; | 163 struct SkPM4f; |
| 164 | 164 |
| 165 /* | 165 /* |
| 166 * The float values are 0...1 unpremultiplied | 166 * The float values are 0...1 unpremultiplied |
| 167 */ | 167 */ |
| 168 struct SkColor4f { | 168 struct SkColor4f { |
| 169 float fA; | |
| 170 float fR; | 169 float fR; |
| 171 float fG; | 170 float fG; |
| 172 float fB; | 171 float fB; |
| 172 float fA; |
| 173 | 173 |
| 174 bool operator==(const SkColor4f& other) const { | 174 bool operator==(const SkColor4f& other) const { |
| 175 return fA == other.fA && fR == other.fR && fG == other.fG && fB == other
.fB; | 175 return fA == other.fA && fR == other.fR && fG == other.fG && fB == other
.fB; |
| 176 } | 176 } |
| 177 bool operator!=(const SkColor4f& other) const { | 177 bool operator!=(const SkColor4f& other) const { |
| 178 return !(*this == other); | 178 return !(*this == other); |
| 179 } | 179 } |
| 180 | 180 |
| 181 const float* vec() const { return &fA; } | 181 const float* vec() const { return &fR; } |
| 182 float* vec() { return &fA; } | 182 float* vec() { return &fR; } |
| 183 | 183 |
| 184 static SkColor4f Pin(float a, float r, float g, float b); | 184 static SkColor4f Pin(float r, float g, float b, float a); |
| 185 static SkColor4f FromColor(SkColor); | 185 static SkColor4f FromColor(SkColor); |
| 186 | 186 |
| 187 SkColor toSkColor() const; |
| 188 |
| 187 SkColor4f pin() const { | 189 SkColor4f pin() const { |
| 188 return Pin(fA, fR, fG, fB); | 190 return Pin(fR, fG, fB, fA); |
| 189 } | 191 } |
| 190 | 192 |
| 191 SkPM4f premul() const; | 193 SkPM4f premul() const; |
| 192 }; | 194 }; |
| 193 | 195 |
| 194 #endif | 196 #endif |
| OLD | NEW |