From f107a2fd014cd39c489060f2cd1b99cd49c7d0be Mon Sep 17 00:00:00 2001 From: Hal Canary Date: Wed, 25 Jul 2018 16:52:48 -0400 Subject: 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 Commit-Queue: Hal Canary --- fuzz/FuzzCanvas.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fuzz/FuzzCanvas.cpp') diff --git a/fuzz/FuzzCanvas.cpp b/fuzz/FuzzCanvas.cpp index aac68481d4..80d3e816a1 100644 --- a/fuzz/FuzzCanvas.cpp +++ b/fuzz/FuzzCanvas.cpp @@ -1020,21 +1020,21 @@ static SkTDArray make_fuzz_text(Fuzz* fuzz, const SkPaint& paint) { case SkPaint::kUTF8_TextEncoding: { size_t utf8len = 0; for (int j = 0; j < length; ++j) { - utf8len += SkUTF8_FromUnichar(buffer[j], nullptr); + utf8len += SkUTF::ToUTF8(buffer[j], nullptr); } char* ptr = (char*)array.append(utf8len); for (int j = 0; j < length; ++j) { - ptr += SkUTF8_FromUnichar(buffer[j], ptr); + ptr += SkUTF::ToUTF8(buffer[j], ptr); } } break; case SkPaint::kUTF16_TextEncoding: { size_t utf16len = 0; for (int j = 0; j < length; ++j) { - utf16len += SkUTF16_FromUnichar(buffer[j]); + utf16len += SkUTF::ToUTF16(buffer[j]); } uint16_t* ptr = (uint16_t*)array.append(utf16len * sizeof(uint16_t)); for (int j = 0; j < length; ++j) { - ptr += SkUTF16_FromUnichar(buffer[j], ptr); + ptr += SkUTF::ToUTF16(buffer[j], ptr); } } break; case SkPaint::kUTF32_TextEncoding: -- cgit v1.2.3