Index: src/core/SkDraw.cpp |
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp |
index e205ee45c07dec544b10020ec41a6b80c658d7f5..62e2fbe15eadaa7abe53e68038e931fefee0be08 100644 |
--- a/src/core/SkDraw.cpp |
+++ b/src/core/SkDraw.cpp |
@@ -1761,14 +1761,8 @@ bool SkTriColorShader::TriColorShaderContext::setup(const SkPoint pts[], const S |
#include "SkComposeShader.h" |
static int ScalarTo256(SkScalar v) { |
- int scale = SkScalarToFixed(v) >> 8; |
- if (scale < 0) { |
- scale = 0; |
- } |
- if (scale > 255) { |
- scale = 255; |
- } |
- return SkAlpha255To256(scale); |
+ return SkScalarTruncToInt(SkScalarMul(SkScalarPin(v, 0, SK_Scalar1), |
mtklein
2016/02/12 17:19:57
Let's write (int)(SkScalarPin(v,0,1) * 256) ?
The
dogben
2016/02/12 18:32:29
Done.
|
+ SkIntToScalar(256))); |
} |