Index: include/gpu/GrColor.h |
diff --git a/include/gpu/GrColor.h b/include/gpu/GrColor.h |
index 4ab709b4f1c8763ddcbe62a69d0e9ce9f70ac63c..3470c88fe6eff8dc91057f54733a4f805dda6d51 100644 |
--- a/include/gpu/GrColor.h |
+++ b/include/gpu/GrColor.h |
@@ -88,6 +88,12 @@ static inline void GrColorToRGBAFloat(GrColor color, float rgba[4]) { |
rgba[3] = GrColorUnpackA(color) * ONE_OVER_255; |
} |
+/** Normalizes and coverts an uint8_t to a float. [0, 255] -> [0.0, 1.0] */ |
+static inline float GrNormalizeByteToFloat(uint8_t value) { |
+ static const float ONE_OVER_255 = 1.f / 255.f; |
+ return value * ONE_OVER_255; |
+} |
+ |
/** Determines whether the color is opaque or not. */ |
static inline bool GrColorIsOpaque(GrColor color) { |
return (color & (0xFFU << GrColor_SHIFT_A)) == (0xFFU << GrColor_SHIFT_A); |