diff options
author | Hal Canary <halcanary@google.com> | 2018-07-25 16:52:48 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-31 20:11:19 +0000 |
commit | f107a2fd014cd39c489060f2cd1b99cd49c7d0be (patch) | |
tree | 5c324821344901869203bbe055be8d3f69f696cb /src/core/SkPaintPriv.cpp | |
parent | 1935aa3d27cd4ed4aef2dc04360f247a541d4b00 (diff) |
SkUTF
Create new header and namespace, `SkUTF` where we are putting all of our
robust, well documented UTF-8, UTF-16, and UTF-32 functions:
`SkUTF::{Count,Next,To}UTF{8,16,32}()`.
SkUTF.h and SkUTF.cpp do not depend on the rest of Skia and are suitable
for re-use in other modules.
Some of the old UTF-{8,16} functions still live in SkUtils.h; their use
will be phased out in future CLs.
Also added more unit testing and cleaned up old tests.
Removed functions that were unused outside of tests or used only once.
Change-Id: Iaa59b8705abccf9c4ba082f855da368a0bad8380
Reviewed-on: https://skia-review.googlesource.com/143306
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/core/SkPaintPriv.cpp')
-rw-r--r-- | src/core/SkPaintPriv.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/SkPaintPriv.cpp b/src/core/SkPaintPriv.cpp index 3be1ebeafa..309d244951 100644 --- a/src/core/SkPaintPriv.cpp +++ b/src/core/SkPaintPriv.cpp @@ -92,9 +92,9 @@ bool SkPaintPriv::ShouldDither(const SkPaint& p, SkColorType dstCT) { int SkPaintPriv::ValidCountText(const void* text, size_t length, SkPaint::TextEncoding encoding) { switch (encoding) { - case SkPaint::kUTF8_TextEncoding: return SkUTF8_CountUnichars(text, length); - case SkPaint::kUTF16_TextEncoding: return SkUTF16_CountUnichars(text, length); - case SkPaint::kUTF32_TextEncoding: return SkUTF32_CountUnichars(text, length); + case SkPaint::kUTF8_TextEncoding: return SkUTF::CountUTF8((const char*)text, length); + case SkPaint::kUTF16_TextEncoding: return SkUTF::CountUTF16((const uint16_t*)text, length); + case SkPaint::kUTF32_TextEncoding: return SkUTF::CountUTF32((const int32_t*)text, length); case SkPaint::kGlyphID_TextEncoding: if (!SkIsAlign2(intptr_t(text)) || !SkIsAlign2(length)) { return -1; |