diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-08 16:07:54 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-08 16:07:54 +0000 |
commit | c7d0ea3cd328566958bfcb86b4488dcbb94dd5ec (patch) | |
tree | 1841590bd86b2f5055e82b900edb88963386916e /include | |
parent | a22407283650ae570d8f93db0f4f6df266812716 (diff) |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkPoint.h | 5 | ||||
-rw-r--r-- | include/core/SkRect.h | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/include/core/SkPoint.h b/include/core/SkPoint.h index a6a8e730c2..5eca72f6b6 100644 --- a/include/core/SkPoint.h +++ b/include/core/SkPoint.h @@ -504,6 +504,11 @@ struct SK_API SkPoint { 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 e6efed56d5..ae0ac4f9e8 100644 --- a/include/core/SkRect.h +++ b/include/core/SkRect.h @@ -769,6 +769,11 @@ struct SK_API SkRect { * 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 |