Index: include/core/SkRect.h |
diff --git a/include/core/SkRect.h b/include/core/SkRect.h |
index fd8cb16020fd2359ca7435a71be8376ebe850f9c..2c155c477ab46bdc1479f40e215730c61f8e0625 100644 |
--- a/include/core/SkRect.h |
+++ b/include/core/SkRect.h |
@@ -157,6 +157,20 @@ struct SK_API SkIRect { |
fRight = fBottom = SK_MinS32; |
} |
+ /** |
+ * Return a new IRect, built as an offset of this rect. |
+ */ |
+ SkIRect makeOffset(int dx, int dy) const { |
+ return MakeLTRB(fLeft + dx, fTop + dy, fRight + dx, fBottom + dy); |
+ } |
+ |
+ /** |
+ * Return a new IRect, built as an inset of this rect. |
+ */ |
+ SkIRect makeInset(int dx, int dy) const { |
+ return MakeLTRB(fLeft + dx, fTop + dy, fRight - dx, fBottom - dy); |
+ } |
+ |
/** Offset set the rectangle by adding dx to its left and right, |
and adding dy to its top and bottom. |
*/ |
@@ -577,6 +591,20 @@ struct SK_API SkRect { |
fRight = fBottom = SK_ScalarMin; |
} |
+ /** |
+ * Return a new Rect, built as an offset of this rect. |
+ */ |
+ SkRect makeOffset(SkScalar dx, SkScalar dy) const { |
+ return MakeLTRB(fLeft + dx, fTop + dy, fRight + dx, fBottom + dy); |
+ } |
+ |
+ /** |
+ * Return a new Rect, built as an inset of this rect. |
+ */ |
+ SkRect makeInset(SkScalar dx, SkScalar dy) const { |
+ return MakeLTRB(fLeft + dx, fTop + dy, fRight - dx, fBottom - dy); |
+ } |
+ |
/** Offset set the rectangle by adding dx to its left and right, |
and adding dy to its top and bottom. |
*/ |