| Index: include/core/SkScalar.h
|
| diff --git a/include/core/SkScalar.h b/include/core/SkScalar.h
|
| index 4efa8417afd4a9edc903c19412a68ac3b997d7af..26352d1194191b4c7aace5faea9ef36d6731a01d 100644
|
| --- a/include/core/SkScalar.h
|
| +++ b/include/core/SkScalar.h
|
| @@ -168,6 +168,18 @@ static inline int SkDScalarRoundToInt(SkScalar x) {
|
| return (int)floor(xx);
|
| }
|
|
|
| +/**
|
| + * Variant of SkScalarRoundToInt, identical to SkDScalarRoundToInt except when the input fraction
|
| + * is 0.5. In this case only, round the value down. This is used to round the top and left
|
| + * of a rectangle, and corresponds to the way the scan converter treats the top and left edges.
|
| + */
|
| +static inline int SkDScalarRoundDownToInt(SkScalar x) {
|
| + double xx = x;
|
| + xx += 0.5;
|
| + double floorXX = floor(xx);
|
| + return (int)floorXX - (xx == floorXX);
|
| +}
|
| +
|
| static inline SkScalar SkScalarClampMax(SkScalar x, SkScalar max) {
|
| x = SkTMin(x, max);
|
| x = SkTMax<SkScalar>(x, 0);
|
|
|