diff options
author | scroggo <scroggo@google.com> | 2016-05-12 06:22:30 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-12 06:22:30 -0700 |
commit | 9a9a7b29e5e5916a7b6453cd124ca437f14b9da4 (patch) | |
tree | ad5b560f6ed5da12040e5665282fd2227c305ff8 /gm/verttext2.cpp | |
parent | a1b283345b27fef91908b104a30cb89e6fbdaade (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/verttext2.cpp')
-rw-r--r-- | gm/verttext2.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/gm/verttext2.cpp b/gm/verttext2.cpp index 79cbdbcc8b..12576c2699 100644 --- a/gm/verttext2.cpp +++ b/gm/verttext2.cpp @@ -17,15 +17,23 @@ namespace skiagm { class VertText2GM : public GM { public: - VertText2GM() {} + VertText2GM() + : fProp(nullptr) + , fMono(nullptr) { + } + + virtual ~VertText2GM() { + SkSafeUnref(fProp); + SkSafeUnref(fMono); + } protected: void onOnceBeforeDraw() override { const int pointSize = 24; textHeight = SkIntToScalar(pointSize); - fProp = SkTypeface::MakeFromName(sk_tool_utils::platform_font_name("sans-serif"), + fProp = SkTypeface::CreateFromName(sk_tool_utils::platform_font_name("sans-serif"), SkTypeface::kNormal); - fMono = SkTypeface::MakeFromName(sk_tool_utils::platform_font_name("monospace"), + fMono = SkTypeface::CreateFromName(sk_tool_utils::platform_font_name("monospace"), SkTypeface::kNormal); } @@ -66,13 +74,13 @@ protected: } void drawText(SkCanvas* canvas, const SkString& string, - sk_sp<SkTypeface> family, SkPaint::Align alignment) { + SkTypeface* family, SkPaint::Align alignment) { SkPaint paint; paint.setColor(SK_ColorBLACK); paint.setAntiAlias(true); paint.setVerticalText(true); paint.setTextAlign(alignment); - paint.setTypeface(std::move(family)); + paint.setTypeface(family); paint.setTextSize(textHeight); canvas->drawText(string.c_str(), string.size(), y, @@ -84,8 +92,8 @@ protected: private: typedef GM INHERITED; SkScalar y, textHeight; - sk_sp<SkTypeface> fProp; - sk_sp<SkTypeface> fMono; + SkTypeface* fProp; + SkTypeface* fMono; }; /////////////////////////////////////////////////////////////////////////////// |