diff options
author | 2017-11-06 20:02:02 -0500 | |
---|---|---|
committer | 2017-11-07 13:10:38 +0000 | |
commit | 74f623d1617e0ccf3eddf37aeecabd0ac72369fd (patch) | |
tree | 60e29c63d4f695073d538b1ce1c590c6e6df059f /src/core | |
parent | b49d7b0118789dbd8c54b95d40f6163e0a134ef3 (diff) |
make point array methods private
Moved method are not used by chromium, google3,
or android.
SkPoint::setRectIFan isn't used or tested at all.
SkPoint::setRectFan and SkPoint::setRectTriStrip
are only used internally.
These routines pretend that a SkPoint is part
of an array of points. Since that's kind of an
odd contract to make public, and because they
aren't used outside of Skia, relegate them to
a priv file.
R=bsalomon@google.com,reed@google.com
Bug: skia: 6898
Change-Id: I5ec2eb47799f6fd4b2994da962b1fa69ce659931
Reviewed-on: https://skia-review.googlesource.com/68121
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkMatrixPriv.h | 5 | ||||
-rw-r--r-- | src/core/SkPoint.cpp | 13 | ||||
-rw-r--r-- | src/core/SkPointPriv.h | 38 |
3 files changed, 41 insertions, 15 deletions
diff --git a/src/core/SkMatrixPriv.h b/src/core/SkMatrixPriv.h index ed1a5f117e..8b437c636f 100644 --- a/src/core/SkMatrixPriv.h +++ b/src/core/SkMatrixPriv.h @@ -10,6 +10,7 @@ #include "SkMatrix.h" #include "SkNx.h" +#include "SkPointPriv.h" class SkMatrixPriv { public: @@ -113,9 +114,9 @@ public: r = sx * r + tx; b = sy * b + ty; } - quad[0].setRectTriStrip(l, t, r, b, sizeof(SkPoint)); + SkPointPriv::SetRectTriStrip(quad, l, t, r, b, sizeof(SkPoint)); } else { - quad[0].setRectTriStrip(l, t, r, b, sizeof(SkPoint)); + SkPointPriv::SetRectTriStrip(quad, l, t, r, b, sizeof(SkPoint)); mx.mapPoints(quad, quad, 4); } } diff --git a/src/core/SkPoint.cpp b/src/core/SkPoint.cpp index a131e2ff65..4c66b44bac 100644 --- a/src/core/SkPoint.cpp +++ b/src/core/SkPoint.cpp @@ -29,19 +29,6 @@ void SkIPoint::rotateCCW(SkIPoint* dst) const { /////////////////////////////////////////////////////////////////////////////// -void SkPoint::setIRectFan(int l, int t, int r, int b, size_t stride) { - SkASSERT(stride >= sizeof(SkPoint)); - - ((SkPoint*)((intptr_t)this + 0 * stride))->set(SkIntToScalar(l), - SkIntToScalar(t)); - ((SkPoint*)((intptr_t)this + 1 * stride))->set(SkIntToScalar(l), - SkIntToScalar(b)); - ((SkPoint*)((intptr_t)this + 2 * stride))->set(SkIntToScalar(r), - SkIntToScalar(b)); - ((SkPoint*)((intptr_t)this + 3 * stride))->set(SkIntToScalar(r), - SkIntToScalar(t)); -} - void SkPoint::rotateCW(SkPoint* dst) const { SkASSERT(dst); diff --git a/src/core/SkPointPriv.h b/src/core/SkPointPriv.h new file mode 100644 index 0000000000..6685b15176 --- /dev/null +++ b/src/core/SkPointPriv.h @@ -0,0 +1,38 @@ +/* + * Copyright 2006 The Android Open Source Project + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkPointPriv_DEFINED +#define SkPointPriv_DEFINED + +#include "SkPoint.h" + +class SkPointPriv { +public: + // counter-clockwise fan + static void SetRectFan(SkPoint v[], SkScalar l, SkScalar t, SkScalar r, SkScalar b, + size_t stride) { + SkASSERT(stride >= sizeof(SkPoint)); + + ((SkPoint*)((intptr_t)v + 0 * stride))->set(l, t); + ((SkPoint*)((intptr_t)v + 1 * stride))->set(l, b); + ((SkPoint*)((intptr_t)v + 2 * stride))->set(r, b); + ((SkPoint*)((intptr_t)v + 3 * stride))->set(r, t); + } + + // tri strip with two counter-clockwise triangles + static void SetRectTriStrip(SkPoint v[], SkScalar l, SkScalar t, SkScalar r, SkScalar b, + size_t stride) { + SkASSERT(stride >= sizeof(SkPoint)); + + ((SkPoint*)((intptr_t)v + 0 * stride))->set(l, t); + ((SkPoint*)((intptr_t)v + 1 * stride))->set(l, b); + ((SkPoint*)((intptr_t)v + 2 * stride))->set(r, t); + ((SkPoint*)((intptr_t)v + 3 * stride))->set(r, b); + } +}; + +#endif |