diff options
author | Hal Canary <halcanary@google.com> | 2017-05-04 18:20:35 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-04 18:20:45 +0000 |
commit | 59ad782b2b05b07aa6eb961aa4d62e934093cbd1 (patch) | |
tree | cc6445f595afe8117786aa94f0d9a25e0be31c99 /src/pdf | |
parent | a4677b5db51fca9f2d1077a4d09dd8f7c80df3d1 (diff) |
Revert "SkTypeface::getAdvancedMetrics(): cleanup"
This reverts commit cef018896e5cad8eb46a536b60cdf79ebe2b0191.
Reason for revert: broke chromium roll (windows).
Original change's description:
> SkTypeface::getAdvancedMetrics(): cleanup
>
> - SkAdvancedTypefaceMetrics is a struct not a class
> - SkTypeface::PerGlyphInfo is gone
> - s/getAdvancedTypefaceMetrics/getAdvancedMetrics/g
> - s/onGetAdvancedTypefaceMetrics/onGetAdvancedMetrics/g
> - [on]getAdvancedMetrics now return unique_ptr rather than bare ptr.
> - [on]getAdvancedMetrics no longer has parameters. (Only caller always
> used same arguments.)
> - SkAdvancedTypefaceMetrics uses C++11 in-class member initializers.
> - SkAdvancedTypefaceMetrics no longer inherits from SkRefCnt
>
> Change-Id: I37571ebcc383ba9eb21bc20c60c734e3ca317582
> Reviewed-on: https://skia-review.googlesource.com/15311
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Hal Canary <halcanary@google.com>
>
TBR=halcanary@google.com,bungeman@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I84c7d53df566aaf83427e3368edaa02b7b5a9cb8
Reviewed-on: https://skia-review.googlesource.com/15319
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/pdf')
-rw-r--r-- | src/pdf/SkPDFCanon.h | 4 | ||||
-rw-r--r-- | src/pdf/SkPDFFont.cpp | 14 | ||||
-rw-r--r-- | src/pdf/SkPDFFont.h | 3 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/pdf/SkPDFCanon.h b/src/pdf/SkPDFCanon.h index 0aac2b5789..248e17833f 100644 --- a/src/pdf/SkPDFCanon.h +++ b/src/pdf/SkPDFCanon.h @@ -14,8 +14,8 @@ #include "SkTHash.h" #include "SkBitmapKey.h" +class SkAdvancedTypefaceMetrics; class SkPDFFont; -struct SkAdvancedTypefaceMetrics; /** * The SkPDFCanon canonicalizes objects across PDF pages @@ -52,7 +52,7 @@ public: SkTHashMap<SkBitmapKey, sk_sp<SkPDFObject>> fPDFBitmapMap; - SkTHashMap<uint32_t, std::unique_ptr<SkAdvancedTypefaceMetrics>> fTypefaceMetrics; + SkTHashMap<uint32_t, sk_sp<SkAdvancedTypefaceMetrics>> fTypefaceMetrics; SkTHashMap<uint32_t, sk_sp<SkPDFDict>> fFontDescriptors; SkTHashMap<uint64_t, sk_sp<SkPDFFont>> fFontMap; diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp index f94dba7080..b373514808 100644 --- a/src/pdf/SkPDFFont.cpp +++ b/src/pdf/SkPDFFont.cpp @@ -7,15 +7,14 @@ #include "SkData.h" #include "SkGlyphCache.h" -#include "SkMakeUnique.h" +#include "SkPaint.h" #include "SkPDFCanon.h" #include "SkPDFConvertType1FontStream.h" #include "SkPDFDevice.h" -#include "SkPDFFont.h" #include "SkPDFMakeCIDGlyphWidthsArray.h" #include "SkPDFMakeToUnicodeCmap.h" +#include "SkPDFFont.h" #include "SkPDFUtils.h" -#include "SkPaint.h" #include "SkRefCnt.h" #include "SkScalar.h" #include "SkStream.h" @@ -143,7 +142,7 @@ const SkAdvancedTypefaceMetrics* SkPDFFont::GetMetrics(SkTypeface* typeface, SkPDFCanon* canon) { SkASSERT(typeface); SkFontID id = typeface->uniqueID(); - if (std::unique_ptr<SkAdvancedTypefaceMetrics>* ptr = canon->fTypefaceMetrics.find(id)) { + if (sk_sp<SkAdvancedTypefaceMetrics>* ptr = canon->fTypefaceMetrics.find(id)) { return ptr->get(); // canon retains ownership. } int count = typeface->countGlyphs(); @@ -152,9 +151,12 @@ const SkAdvancedTypefaceMetrics* SkPDFFont::GetMetrics(SkTypeface* typeface, canon->fTypefaceMetrics.set(id, nullptr); return nullptr; } - std::unique_ptr<SkAdvancedTypefaceMetrics> metrics = typeface->getAdvancedMetrics(); + sk_sp<SkAdvancedTypefaceMetrics> metrics( + typeface->getAdvancedTypefaceMetrics( + SkTypeface::kGlyphNames_PerGlyphInfo | SkTypeface::kToUnicode_PerGlyphInfo, + nullptr, 0)); if (!metrics) { - metrics = skstd::make_unique<SkAdvancedTypefaceMetrics>(); + metrics = sk_make_sp<SkAdvancedTypefaceMetrics>(); } return canon->fTypefaceMetrics.set(id, std::move(metrics))->get(); } diff --git a/src/pdf/SkPDFFont.h b/src/pdf/SkPDFFont.h index 5639d87b67..6151279248 100644 --- a/src/pdf/SkPDFFont.h +++ b/src/pdf/SkPDFFont.h @@ -87,7 +87,8 @@ public: SkTypeface* typeface, SkGlyphID glyphID); - /** Gets SkAdvancedTypefaceMetrics, and caches the result. + /** Uses (kGlyphNames_PerGlyphInfo | kToUnicode_PerGlyphInfo) to get + * SkAdvancedTypefaceMetrics, and caches the result. * @param typeface can not be nullptr. * @return nullptr only when typeface is bad. */ |