diff options
author | Herb Derby <herb@google.com> | 2018-07-09 13:24:13 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-09 18:15:27 +0000 |
commit | d48897b576e9ee7df445606243d14bcb1d0b95df (patch) | |
tree | e23aa166e472f66dc350c26fce75888645f00ac7 | |
parent | d6fbc1bba6f11459daa16df28ac08f58f2b604bd (diff) |
Update SkSpan to match the standard more closely
Change-Id: Iba5a9c24a34d5a08618b9182b476121bf6ce5ef9
Reviewed-on: https://skia-review.googlesource.com/139863
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
-rw-r--r-- | src/core/SkGlyphRun.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/SkGlyphRun.h b/src/core/SkGlyphRun.h index 739ad0bc38..fe9922b381 100644 --- a/src/core/SkGlyphRun.h +++ b/src/core/SkGlyphRun.h @@ -24,8 +24,9 @@ template <typename T> class SkSpan { public: SkSpan() : fPtr{nullptr}, fSize{0} {} - SkSpan(T* ptr, size_t size) : fPtr{ptr}, fSize{size} {} - explicit SkSpan(std::vector<T>& v) : fPtr{v.data()}, fSize{v.size()} {} + SkSpan(T* ptr, ptrdiff_t size) : fPtr{ptr}, fSize{size} { SkASSERT(size >= 0); } + explicit SkSpan(std::vector<T>& v) : fPtr{v.data()}, fSize{SkTo<ptrdiff_t>(v.size())} {} + SkSpan(const SkSpan<T>& o) = default; SkSpan& operator=( const SkSpan& other ) = default; T& operator [] (ptrdiff_t i) const { return fPtr[i]; } T* begin() const { return fPtr; } @@ -38,7 +39,7 @@ public: private: T* fPtr; - size_t fSize; + ptrdiff_t fSize; }; struct SkIndexedRunInfo { |