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

Unified Diff: include/gpu/GrColor.h

Issue 700943005: Send coverage VA as floats instead of bytes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use floats instead of scalars Created 6 years, 1 month 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/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698