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

Unified Diff: src/core/SkSRGB.h

Issue 2161223002: Update rounding/clamping comments on sk_linear_to_srgb(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months 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 | tests/SRGBTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkSRGB.h
diff --git a/src/core/SkSRGB.h b/src/core/SkSRGB.h
index de80596de433644cccdb3d1393ebbd17fd18e375..d567a962d84a598ab24fd60994085761bfb6f5a9 100644
--- a/src/core/SkSRGB.h
+++ b/src/core/SkSRGB.h
@@ -14,14 +14,14 @@
*
* Current best practices:
* - for sRGB -> linear, lookup R,G,B in sk_linear_from_srgb;
- * - for linear -> sRGB, call sk_linear_to_srgb() for R,G,B, clamp to 255, and round;
+ * - for linear -> sRGB, call sk_linear_to_srgb() for R,G,B, and round;
* - the alpha channel is linear in both formats, needing at most *(1/255.0f) or *255.0f.
*
* sk_linear_to_srgb()'s output requires rounding; it does not round for you.
*
* Given inputs in [0,1], sk_linear_to_srgb() will not underflow 0 but may overflow 255.
- * The overflow is small enough that you can safely either clamp then round or round then clamp.
- * (If you don't trust the inputs are in [0,1], you'd better clamp both sides immediately.)
+ * The overflow is small enough to be handled by rounding.
+ * (But if you don't trust the inputs are in [0,1], you'd better clamp both sides immediately.)
*
* sk_linear_to_srgb() will run a little faster than usual when compiled with SSE4.1+.
*/
« no previous file with comments | « no previous file | tests/SRGBTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698