Add subspan() to SkSpan
Change-Id: I1ac2ec8cf22a96c50261ca3863edeb0ed3c24dd6 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287579 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
96d31defe3
commit
d16e322f02
@ -50,6 +50,12 @@ public:
|
|||||||
if (postfixLen == 0) { return SkSpan{}; }
|
if (postfixLen == 0) { return SkSpan{}; }
|
||||||
return SkSpan{fPtr + (this->size() - postfixLen), postfixLen};
|
return SkSpan{fPtr + (this->size() - postfixLen), postfixLen};
|
||||||
}
|
}
|
||||||
|
constexpr SkSpan<T> subspan(size_t offset, size_t count) const {
|
||||||
|
SkASSERT(offset <= this->size());
|
||||||
|
SkASSERT(count <= this->size - offset);
|
||||||
|
if (count == 0) { return SkSpan{}; }
|
||||||
|
return SkSpan{fPtr + offset, count};
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T* fPtr;
|
T* fPtr;
|
||||||
|
Loading…
Reference in New Issue
Block a user