| Index: include/core/SkRect.h
|
| diff --git a/include/core/SkRect.h b/include/core/SkRect.h
|
| index 397e4a03eea35775e1b0662e0efabd3d942bfe7a..fd8cb16020fd2359ca7435a71be8376ebe850f9c 100644
|
| --- a/include/core/SkRect.h
|
| +++ b/include/core/SkRect.h
|
| @@ -732,6 +732,24 @@ struct SK_API SkRect {
|
| }
|
|
|
| /**
|
| + * Variant of round() that explicitly performs the rounding step (i.e. floor(x + 0.5)) using
|
| + * double instead of SkScalar (float). It does this by calling SkDScalarRoundToInt(), which
|
| + * may be slower than calling SkScalarRountToInt(), but gives slightly more accurate results.
|
| + *
|
| + * e.g.
|
| + * SkScalar x = 0.49999997f;
|
| + * int ix = SkScalarRoundToInt(x);
|
| + * SkASSERT(0 == ix); // <--- fails
|
| + * ix = SkDScalarRoundToInt(x);
|
| + * SkASSERT(0 == ix); // <--- succeeds
|
| + */
|
| + void dround(SkIRect* dst) const {
|
| + SkASSERT(dst);
|
| + dst->set(SkDScalarRoundToInt(fLeft), SkDScalarRoundToInt(fTop),
|
| + SkDScalarRoundToInt(fRight), SkDScalarRoundToInt(fBottom));
|
| + }
|
| +
|
| + /**
|
| * Set the dst rectangle by rounding "out" this rectangle, choosing the
|
| * SkScalarFloor of top and left, and the SkScalarCeil of right and bottom.
|
| */
|
|
|