aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkClipStack.h5
-rw-r--r--include/core/SkMatrix.h2
-rw-r--r--include/core/SkRandom.h2
-rw-r--r--include/core/SkRect.h9
4 files changed, 17 insertions, 1 deletions
diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h
index a67e0a5dd9..79fd2c9dd4 100644
--- a/include/core/SkClipStack.h
+++ b/include/core/SkClipStack.h
@@ -134,6 +134,11 @@ public:
fDoAA(false) {}
friend bool operator==(const Clip& a, const Clip& b);
friend bool operator!=(const Clip& a, const Clip& b);
+ /**
+ * Gets the bounds of the clip element, either the rect or path bounds.
+ */
+ const SkRect& getBounds() const;
+
const SkRect* fRect; // if non-null, this is a rect clip
const SkPath* fPath; // if non-null, this is a path clip
SkRegion::Op fOp;
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index 980bcaa27a..2d3786cf31 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -173,6 +173,8 @@ public:
/** Set the matrix to translate by (dx, dy).
*/
void setTranslate(SkScalar dx, SkScalar dy);
+ void setTranslate(const SkVector& v) { this->setTranslate(v.fX, v.fY); }
+
/** Set the matrix to scale by sx and sy, with a pivot point at (px, py).
The pivot point is the coordinate that should remain unchanged by the
specified transformation.
diff --git a/include/core/SkRandom.h b/include/core/SkRandom.h
index 0f9b9aa003..4731bbed4b 100644
--- a/include/core/SkRandom.h
+++ b/include/core/SkRandom.h
@@ -84,7 +84,7 @@ public:
in the range [min..max).
*/
SkScalar nextRangeScalar(SkScalar min, SkScalar max) {
- return SkScalarMul(this->nextSScalar1(), (max - min)) + min;
+ return SkScalarMul(this->nextUScalar1(), (max - min)) + min;
}
/** Return the next pseudo random number expressed as a SkScalar
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 7210bf9cd6..f5e8c3cc3a 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -366,6 +366,15 @@ struct SK_API SkRect {
return r;
}
+ static SkRect SK_WARN_UNUSED_RESULT MakeFromIRect(const SkIRect& irect) {
+ SkRect r;
+ r.set(SkIntToScalar(irect.fLeft),
+ SkIntToScalar(irect.fTop),
+ SkIntToScalar(irect.fRight),
+ SkIntToScalar(irect.fBottom));
+ return r;
+ }
+
/**
* Return true if the rectangle's width or height are <= 0
*/