aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/fontmgr.cpp
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2016-05-12 06:22:30 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-12 06:22:30 -0700
commit9a9a7b29e5e5916a7b6453cd124ca437f14b9da4 (patch)
treead5b560f6ed5da12040e5665282fd2227c305ff8 /gm/fontmgr.cpp
parenta1b283345b27fef91908b104a30cb89e6fbdaade (diff)
Revert of Move SkTypeface to sk_sp. (patchset #5 id:80001 of https://codereview.chromium.org/1933393002/ )
Reason for revert: fontmgr_iterAndroid failing to draw emoji. E.g. 6296da736fbf40aae881650c239420f64e576c3f&unt=true&head=true&query=source_type%3Dgm">https://gold.skia.org/search2?blame=6296da736fbf40aae881650c239420f64e576c3f&unt=true&head=true&query=source_type%3Dgm Original issue's description: > Move SkTypeface to sk_sp. > > Committed: https://skia.googlesource.com/skia/+/6296da736fbf40aae881650c239420f64e576c3f TBR=reed@google.com,fmalita@chromium.org,tomhudson@google.com,bungeman@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/1974783002
Diffstat (limited to 'gm/fontmgr.cpp')
-rw-r--r--gm/fontmgr.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/gm/fontmgr.cpp b/gm/fontmgr.cpp
index a4dc2631ec..1975f998cd 100644
--- a/gm/fontmgr.cpp
+++ b/gm/fontmgr.cpp
@@ -31,9 +31,9 @@ static SkScalar drawCharacter(SkCanvas* canvas, uint32_t character, SkScalar x,
// find typeface containing the requested character and draw it
SkString ch;
ch.appendUnichar(character);
- sk_sp<SkTypeface> typeface(fm->matchFamilyStyleCharacter(fontName, fontStyle,
- bcp47, bcp47Count, character));
- paint.setTypeface(typeface);
+ SkTypeface* typeface = fm->matchFamilyStyleCharacter(fontName, fontStyle,
+ bcp47, bcp47Count, character);
+ SkSafeUnref(paint.setTypeface(typeface));
x = drawString(canvas, ch, x, y, paint) + 20;
if (nullptr == typeface) {
@@ -45,8 +45,8 @@ static SkScalar drawCharacter(SkCanvas* canvas, uint32_t character, SkScalar x,
// it expects to get the same glyph when following this pattern.
SkString familyName;
typeface->getFamilyName(&familyName);
- paint.setTypeface(sk_sp<SkTypeface>(fm->legacyCreateTypeface(familyName.c_str(),
- typeface->fontStyle())));
+ SkTypeface* typefaceCopy = fm->legacyCreateTypeface(familyName.c_str(), typeface->fontStyle());
+ SkSafeUnref(paint.setTypeface(typefaceCopy));
return drawString(canvas, ch, x, y, paint) + 20;
}
@@ -104,7 +104,7 @@ protected:
set->getStyle(j, &fs, &sname);
sname.appendf(" [%d %d %d]", fs.weight(), fs.width(), fs.slant());
- paint.setTypeface(sk_sp<SkTypeface>(set->createTypeface(j)));
+ SkSafeUnref(paint.setTypeface(set->createTypeface(j)));
x = drawString(canvas, sname, x, y, paint) + 20;
// check to see that we get different glyphs in japanese and chinese
@@ -155,7 +155,7 @@ protected:
sname.appendf(" [%d %d]", fs.weight(), fs.width());
- p.setTypeface(sk_sp<SkTypeface>(fset->createTypeface(j)));
+ SkSafeUnref(p.setTypeface(fset->createTypeface(j)));
(void)drawString(canvas, sname, 0, y, p);
y += 24;
}
@@ -169,11 +169,11 @@ protected:
for (int weight = 100; weight <= 900; weight += 200) {
for (int width = 1; width <= 9; width += 2) {
SkFontStyle fs(weight, width, SkFontStyle::kUpright_Slant);
- sk_sp<SkTypeface> face(fset->matchStyle(fs));
+ SkTypeface* face = fset->matchStyle(fs);
if (face) {
SkString str;
str.printf("request [%d %d]", fs.weight(), fs.width());
- p.setTypeface(std::move(face));
+ p.setTypeface(face)->unref();
(void)drawString(canvas, str, 0, y, p);
y += 24;
}
@@ -274,7 +274,7 @@ protected:
for (int i = 0; i < count; ++i) {
SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i));
for (int j = 0; j < set->count(); ++j) {
- paint.setTypeface(sk_sp<SkTypeface>(set->createTypeface(j)));
+ SkSafeUnref(paint.setTypeface(set->createTypeface(j)));
if (paint.getTypeface()) {
show_bounds(canvas, paint, x, y, boundsColors[index & 1]);
index += 1;