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

Unified Diff: include/core/SkRect.h

Issue 1003813003: some utils for rect and matrix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 | « include/core/SkMatrix.h ('k') | include/gpu/GrCoordTransform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkRect.h
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 8d68c97febb730ec29bf694964bc4254a4b565c4..5c806a963b8bb39e7896ea3885b82611a63faf9a 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -162,17 +162,24 @@ struct SK_API SkIRect {
/**
* Return a new IRect, built as an offset of this rect.
*/
- SkIRect makeOffset(int dx, int dy) const {
+ SkIRect makeOffset(int32_t dx, int32_t 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 {
+ SkIRect makeInset(int32_t dx, int32_t dy) const {
return MakeLTRB(fLeft + dx, fTop + dy, fRight - dx, fBottom - dy);
}
+ /**
+ * Return a new Rect, built as an outset of this rect.
+ */
+ SkIRect makeOutset(int32_t dx, int32_t 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.
*/
@@ -608,7 +615,7 @@ struct SK_API SkRect {
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.
*/
@@ -616,6 +623,13 @@ struct SK_API SkRect {
return MakeLTRB(fLeft + dx, fTop + dy, fRight - dx, fBottom - dy);
}
+ /**
+ * Return a new Rect, built as an outset of this rect.
+ */
+ SkRect makeOutset(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.
*/
« no previous file with comments | « include/core/SkMatrix.h ('k') | include/gpu/GrCoordTransform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698