Skip to content

Commit

Permalink
Revert "update to new MakeFromStream signature"
Browse files Browse the repository at this point in the history
This reverts commit edc6ea7.

Reason for revert: need to update Flutter, Google3.

Original change's description:
> 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>

TBR=djsollen@google.com,bungeman@google.com,reed@google.com

Change-Id: I22daf2cdb86f9e5ca3b78db45f8e15efe4b21005
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/152120
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
  • Loading branch information
Mike Klein authored and Skia Commit-Bot committed Sep 6, 2018
1 parent 7da1a3d commit 71f8475
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions include/core/SkTypeface.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ 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.
Expand Down Expand Up @@ -129,6 +131,11 @@ class SK_API SkTypeface : public SkWeakRefCnt {
*/
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.
*/
Expand Down
5 changes: 1 addition & 4 deletions include/ports/SkFontConfigInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include "SkFontStyle.h"
#include "SkRefCnt.h"
#include "SkStream.h"
#include "SkTypeface.h"

class SkFontMgr;
Expand Down Expand Up @@ -98,9 +97,7 @@ class SK_API SkFontConfigInterface : public SkRefCnt {
* openStream(), but derived classes may implement more complex caching schemes.
*/
virtual sk_sp<SkTypeface> makeTypeface(const FontIdentity& identity) {
return SkTypeface::MakeFromStream(std::unique_ptr<SkStreamAsset>(this->openStream(identity)),
identity.fTTCIndex);

return SkTypeface::MakeFromStream(this->openStream(identity), identity.fTTCIndex);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/core/SkTypeface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ 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;
Expand Down

0 comments on commit 71f8475

Please sign in to comment.