add asScalars() to document when we want to treat SkPoint or SkRect as an array
of SkScalars.
Review URL: https://codereview.chromium.org/12530010
git-svn-id: http://skia.googlecode.com/svn/trunk@8041 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkPoint.h b/include/core/SkPoint.h
index a6a8e73..5eca72f 100644
--- a/include/core/SkPoint.h
+++ b/include/core/SkPoint.h
@@ -504,6 +504,11 @@
fY = -tmp;
}
}
+
+ /**
+ * cast-safe way to treat the point as an array of (2) SkScalars.
+ */
+ const SkScalar* asScalars() const { return &fX; }
};
typedef SkPoint SkVector;
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index e6efed5..ae0ac4f 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -769,6 +769,11 @@
* other. When this returns, left <= right && top <= bottom
*/
void sort();
+
+ /**
+ * cast-safe way to treat the rect as an array of (4) SkScalars.
+ */
+ const SkScalar* asScalars() const { return &fLeft; }
};
#endif