| Index: include/gpu/GrColor.h
|
| diff --git a/include/gpu/GrColor.h b/include/gpu/GrColor.h
|
| index bd949cebe8473b297a4ce747dcbdc3ca6b6e2c15..f862ecc1d069c3bffaecc17528c5a207b15eebd8 100644
|
| --- a/include/gpu/GrColor.h
|
| +++ b/include/gpu/GrColor.h
|
| @@ -12,6 +12,9 @@
|
| #define GrColor_DEFINED
|
|
|
| #include "GrTypes.h"
|
| +#include "SkColor.h"
|
| +#include "SkColorPriv.h"
|
| +#include "SkUnPreMultiply.h"
|
|
|
| /**
|
| * GrColor is 4 bytes for R, G, B, A, in a specific order defined below. The components are stored
|
| @@ -99,6 +102,23 @@ static inline bool GrColorIsOpaque(GrColor color) {
|
| return (color & (0xFFU << GrColor_SHIFT_A)) == (0xFFU << GrColor_SHIFT_A);
|
| }
|
|
|
| +/** Returns an unpremuled version of the GrColor. */
|
| +static inline GrColor GrUnPreMulColor(GrColor color) {
|
| + unsigned r = GrColorUnpackR(color);
|
| + unsigned g = GrColorUnpackG(color);
|
| + unsigned b = GrColorUnpackB(color);
|
| + unsigned a = GrColorUnpackA(color);
|
| + SkPMColor colorPM = SkPackARGB32(a, r, g, b);
|
| + SkColor colorUPM = SkUnPreMultiply::PMColorToColor(colorPM);
|
| +
|
| + r = SkGetPackedR32(colorUPM);
|
| + g = SkGetPackedG32(colorUPM);
|
| + b = SkGetPackedB32(colorUPM);
|
| + a = SkGetPackedA32(colorUPM);
|
| +
|
| + return GrColorPackRGBA(r, g, b, a);
|
| +}
|
| +
|
| /**
|
| * Flags used for bitfields of color components. They are defined so that the bit order reflects the
|
| * GrColor shift order.
|
|
|