update to new MakeFromStream signature

Bug: skia:
Change-Id: Ic18a45628905b90a2477043989ad4cb9fa11ab52
Reviewed-on: https://skia-review.googlesource.com/151880
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
This commit is contained in:
Mike Reed 2018-09-05 17:04:30 -04:00 committed by Skia Commit-Bot
parent ffbcc3fadf
commit edc6ea7a9e
3 changed files with 4 additions and 15 deletions

View File

@ -33,8 +33,6 @@ typedef uint32_t SkFontID;
/** Machine endian. */
typedef uint32_t SkFontTableTag;
#define SK_SUPPORT_LEGACY_TYPEFACE_MAKEFROMSTREAM
/** \class SkTypeface
The SkTypeface class specifies the typeface and intrinsic style of a font.
@ -131,11 +129,6 @@ public:
*/
static sk_sp<SkTypeface> MakeFromStream(std::unique_ptr<SkStreamAsset> stream, int index = 0);
#ifdef SK_SUPPORT_LEGACY_TYPEFACE_MAKEFROMSTREAM
// DEPRECATED -- call the version that takes unique_ptr
static sk_sp<SkTypeface> MakeFromStream(SkStreamAsset* stream, int index = 0);
#endif
/** Return a new typeface given a SkData. If the data is null, or is not a valid font file,
* returns nullptr.
*/

View File

@ -10,6 +10,7 @@
#include "SkFontStyle.h"
#include "SkRefCnt.h"
#include "SkStream.h"
#include "SkTypeface.h"
class SkFontMgr;
@ -97,7 +98,9 @@ public:
* openStream(), but derived classes may implement more complex caching schemes.
*/
virtual sk_sp<SkTypeface> makeTypeface(const FontIdentity& identity) {
return SkTypeface::MakeFromStream(this->openStream(identity), identity.fTTCIndex);
return SkTypeface::MakeFromStream(std::unique_ptr<SkStreamAsset>(this->openStream(identity)),
identity.fTTCIndex);
}
/**

View File

@ -145,13 +145,6 @@ sk_sp<SkTypeface> SkTypeface::MakeFromName(const char name[],
return SkFontMgr::RefDefault()->legacyMakeTypeface(name, fontStyle);
}
#ifdef SK_SUPPORT_LEGACY_TYPEFACE_MAKEFROMSTREAM
// DEPRECATED
sk_sp<SkTypeface> SkTypeface::MakeFromStream(SkStreamAsset* stream, int index) {
return MakeFromStream(std::unique_ptr<SkStreamAsset>(stream), index);
}
#endif
sk_sp<SkTypeface> SkTypeface::MakeFromStream(std::unique_ptr<SkStreamAsset> stream, int index) {
if (!stream) {
return nullptr;