aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkOverdrawCanvas.cpp
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2018-07-25 16:52:48 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-31 20:11:19 +0000
commitf107a2fd014cd39c489060f2cd1b99cd49c7d0be (patch)
tree5c324821344901869203bbe055be8d3f69f696cb /src/core/SkOverdrawCanvas.cpp
parent1935aa3d27cd4ed4aef2dc04360f247a541d4b00 (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/SkOverdrawCanvas.cpp')
-rw-r--r--src/core/SkOverdrawCanvas.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/SkOverdrawCanvas.cpp b/src/core/SkOverdrawCanvas.cpp
index 249723e494..0e20878793 100644
--- a/src/core/SkOverdrawCanvas.cpp
+++ b/src/core/SkOverdrawCanvas.cpp
@@ -98,13 +98,15 @@ void SkOverdrawCanvas::onDrawTextOnPath(const void* text, size_t byteLength, con
typedef int (*CountTextProc)(const char* text, const char* stop);
static int count_utf16(const char* text, const char* stop) {
const uint16_t* prev = (const uint16_t*)text;
- (void)SkUTF16_NextUnichar(&prev, (const uint16_t*)stop);
+ (void)SkUTF::NextUTF16(&prev, (const uint16_t*)stop);
return SkToInt((const char*)prev - text);
}
static int return_4(const char* text, const char* stop) { return 4; }
static int return_2(const char* text, const char* stop) { return 2; }
static int count_utf8(const char* text, const char* stop) {
- return SkUTF8_LeadByteToCount(*(const uint8_t*)text);
+ const char* ptr = text;
+ (void)SkUTF::NextUTF8(&ptr, stop);
+ return SkToInt(ptr - text);
}
void SkOverdrawCanvas::onDrawTextRSXform(const void* text, size_t byteLength,