aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGlyphRun.h
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-07-11 20:03:13 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-11 20:03:19 +0000
commitba383208043a69666ada6c22757e656927fd6bfc (patch)
tree8bd47a9fc8ac1d120477941e82575cb448ade186 /src/core/SkGlyphRun.h
parent143cf8e5994c54aa8c1b721f7af1d3fc9fd83602 (diff)
Revert "Use simple buffers instead of vectors"
This reverts commit b188da121c1575caa6b0b9755e3f80a6b5e44611. Reason for revert: Patch on a rollback Original change's description: > Use simple buffers instead of vectors > > Start using simple buffers, these will be used for > multiple runs latter on. > > Change-Id: I8dadbed036b7a60d708c49b84bb5e3bb3710f704 > Reviewed-on: https://skia-review.googlesource.com/140578 > Reviewed-by: Mike Klein <mtklein@google.com> > Commit-Queue: Herb Derby <herb@google.com> TBR=mtklein@google.com,herb@google.com Change-Id: I51d9ad9bc0fd7efb93e5db4dc504d8dc31e7cfb4 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/140802 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src/core/SkGlyphRun.h')
-rw-r--r--src/core/SkGlyphRun.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/core/SkGlyphRun.h b/src/core/SkGlyphRun.h
index affc044f76..7c3a74860c 100644
--- a/src/core/SkGlyphRun.h
+++ b/src/core/SkGlyphRun.h
@@ -24,23 +24,23 @@ template <typename T>
class SkSpan {
public:
SkSpan() : fPtr{nullptr}, fSize{0} {}
- SkSpan(T* ptr, size_t size) : fPtr{ptr}, fSize{size} { }
+ SkSpan(T* ptr, ptrdiff_t size) : fPtr{ptr}, fSize{size} { SkASSERT(size >= 0); }
template <typename U>
- explicit SkSpan(std::vector<U>& v) : fPtr{v.data()}, fSize{v.size()} {}
+ explicit SkSpan(std::vector<U>& v) : fPtr{v.data()}, fSize{SkTo<ptrdiff_t>(v.size())} {}
SkSpan(const SkSpan<T>& o) = default;
SkSpan& operator=( const SkSpan& other ) = default;
- T& operator [] (size_t i) const { return fPtr[i]; }
+ T& operator [] (ptrdiff_t i) const { return fPtr[i]; }
T* begin() const { return fPtr; }
T* end() const { return fPtr + fSize; }
const T* cbegin() const { return fPtr; }
const T* cend() const { return fPtr + fSize; }
T* data() const { return fPtr; }
- size_t size() const { return fSize; }
+ ptrdiff_t size() const { return fSize; }
bool empty() const { return fSize == 0; }
private:
T* fPtr;
- size_t fSize;
+ ptrdiff_t fSize;
};
class SkGlyphRun {
@@ -120,8 +120,6 @@ private:
const SkPaint& runPaint,
SkSpan<const SkGlyphID> glyphIDs,
SkSpan<const SkPoint> positions,
- SkSpan<const uint16_t> uniqueGlyphIDIndices,
- SkSpan<const SkGlyphID> uniqueGlyphIDs,
SkSpan<const char> text,
SkSpan<const uint32_t> clusters);
@@ -138,10 +136,9 @@ private:
uint64_t fUniqueID{0};
- size_t fMaxTotalRunSize{0};
- SkAutoTMalloc<uint16_t> fUniqueGlyphIDIndices;
- SkAutoTMalloc<SkPoint> fPositions;
- SkAutoTMalloc<SkGlyphID> fUniqueGlyphIDs;
+ std::vector<uint16_t> fDenseIndex;
+ std::vector<SkPoint> fPositions;
+ std::vector<SkGlyphID> fUniqueGlyphIDs;
// Used as a temporary for preparing using utfN text. This implies that only one run of
// glyph ids will ever be needed because blobs are already glyph based.