Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: src/core/SkFont.cpp

Issue 2163633002: Make SkFont a bit more useable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bug Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkFont.cpp
diff --git a/src/core/SkFont.cpp b/src/core/SkFont.cpp
index 1300011ec450f29326c2f47d7ea0a1dc64a572be..aa7fe366c8dd892c7210a3f36bff4fa8deab2416 100644
--- a/src/core/SkFont.cpp
+++ b/src/core/SkFont.cpp
@@ -48,6 +48,10 @@ sk_sp<SkFont> SkFont::makeWithSize(SkScalar newSize) const {
this->getSkewX(), this->getMaskType(), this->getFlags());
}
+sk_sp<SkFont> SkFont::makeWithFlags(uint32_t newFlags) const {
+ return SkFont::Make(sk_ref_sp(this->getTypeface()), this->getSize(), this->getScaleX(),
+ this->getSkewX(), this->getMaskType(), newFlags);
+}
///////////////////////////////////////////////////////////////////////////////////////////////////
int SkFont::textToGlyphs(const void* text, size_t byteLength, SkTextEncoding encoding,
@@ -74,21 +78,21 @@ int SkFont::textToGlyphs(const void* text, size_t byteLength, SkTextEncoding enc
count = SkToInt(byteLength >> 1);
break;
}
- if (nullptr == glyphs) {
+ if (!glyphs) {
return count;
}
// TODO: unify/eliminate SkTypeface::Encoding with SkTextEncoding
- SkTypeface::Encoding typeface_encoding;
+ SkTypeface::Encoding typefaceEncoding;
switch (encoding) {
case kUTF8_SkTextEncoding:
- typeface_encoding = SkTypeface::kUTF8_Encoding;
+ typefaceEncoding = SkTypeface::kUTF8_Encoding;
break;
case kUTF16_SkTextEncoding:
- typeface_encoding = SkTypeface::kUTF16_Encoding;
+ typefaceEncoding = SkTypeface::kUTF16_Encoding;
break;
case kUTF32_SkTextEncoding:
- typeface_encoding = SkTypeface::kUTF32_Encoding;
+ typefaceEncoding = SkTypeface::kUTF32_Encoding;
break;
default:
SkASSERT(kGlyphID_SkTextEncoding == encoding);
@@ -97,7 +101,7 @@ int SkFont::textToGlyphs(const void* text, size_t byteLength, SkTextEncoding enc
return count;
}
- (void)fTypeface->charsToGlyphs(text, typeface_encoding, glyphs, count);
+ (void)fTypeface->charsToGlyphs(text, typefaceEncoding, glyphs, count);
return count;
}
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698