diff options
author | halcanary <halcanary@google.com> | 2016-08-25 09:07:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-25 09:07:02 -0700 |
commit | 650e20d705a39eaa861cfbc821e9e1f81cef5316 (patch) | |
tree | e5001038056a7c10010c3dead4ddd8d16205ff2f /src/pdf | |
parent | 464a7d6f95c9acef829606b7e29ed8d1bef8842c (diff) |
SkPDF: Stop `#include PREPROCESSOR_DEFINE` pattern
No more:
#include SK_SFNTLY_SUBSETTER
#include ZLIB_INCLUDE
Also, rename SK_SFNTLY_SUBSETTER to SK_PDF_USE_SFNTLY
to follow my pattern of prefixing SkPDF-specific defines
with 'SK_PDF_'.
The ZLIB_INCLUDE define is no longer is used by anyone.
TODO: rename Sfntly to something pronounceable.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2273343002
Review-Url: https://codereview.chromium.org/2273343002
Diffstat (limited to 'src/pdf')
-rw-r--r-- | src/pdf/SkDeflate.cpp | 6 | ||||
-rw-r--r-- | src/pdf/SkPDFFont.cpp | 24 |
2 files changed, 13 insertions, 17 deletions
diff --git a/src/pdf/SkDeflate.cpp b/src/pdf/SkDeflate.cpp index d4a842969c..2c5a3caffe 100644 --- a/src/pdf/SkDeflate.cpp +++ b/src/pdf/SkDeflate.cpp @@ -9,11 +9,7 @@ #include "SkData.h" #include "SkDeflate.h" -#ifdef ZLIB_INCLUDE - #include ZLIB_INCLUDE -#else - #include "zlib.h" -#endif +#include "zlib.h" namespace { diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp index 2619724cbb..389df62fd5 100644 --- a/src/pdf/SkPDFFont.cpp +++ b/src/pdf/SkPDFFont.cpp @@ -22,13 +22,13 @@ #include "SkTypes.h" #include "SkUtils.h" -#if defined (SK_SFNTLY_SUBSETTER) - #if defined (GOOGLE3) - // #including #defines doesn't work with this build system. - #include "sample/chromium/font_subsetter.h" - #else - #include SK_SFNTLY_SUBSETTER - #endif +// TODO(halcanary): Switch Chrome from SK_SFNTLY_SUBSETTER to SK_PDF_USE_SFNTLY. +#if defined(SK_SFNTLY_SUBSETTER) && !defined(SK_PDF_USE_SFNTLY) + #define SK_PDF_USE_SFNTLY +#endif + +#ifdef SK_PDF_USE_SFNTLY + #include "sample/chromium/font_subsetter.h" #endif namespace { @@ -142,7 +142,7 @@ static bool can_embed(const SkAdvancedTypefaceMetrics& metrics) { return !SkToBool(metrics.fFlags & SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag); } -#ifdef SK_SFNTLY_SUBSETTER +#ifdef SK_PDF_USE_SFNTLY static bool can_subset(const SkAdvancedTypefaceMetrics& metrics) { return !SkToBool(metrics.fFlags & SkAdvancedTypefaceMetrics::kNotSubsettable_FontFlag); } @@ -336,7 +336,7 @@ void SkPDFType0Font::emitObject(SkWStream* stream, } #endif -#ifdef SK_SFNTLY_SUBSETTER +#ifdef SK_PDF_USE_SFNTLY // if possible, make no copy. static sk_sp<SkData> stream_to_data(std::unique_ptr<SkStreamAsset> stream) { SkASSERT(stream); @@ -387,7 +387,7 @@ static sk_sp<SkPDFObject> get_subset_font_stream( subsetStream->dict()->insertInt("Length1", subsetFontSize); return subsetStream; } -#endif // SK_SFNTLY_SUBSETTER +#endif // SK_PDF_USE_SFNTLY void SkPDFType0Font::getFontSubset(SkPDFCanon* canon) { const SkAdvancedTypefaceMetrics* metricsPtr = @@ -417,7 +417,7 @@ void SkPDFType0Font::getFontSubset(SkPDFCanon* canon) { return; } - #ifdef SK_SFNTLY_SUBSETTER + #ifdef SK_PDF_USE_SFNTLY if (can_subset(metrics)) { // Generate glyph id array. in format needed by sfntly SkTDArray<uint32_t> glyphIDs; @@ -434,7 +434,7 @@ void SkPDFType0Font::getFontSubset(SkPDFCanon* canon) { // If subsetting fails, fall back to original font data. fontAsset.reset(face->openStream(&ttcIndex)); } - #endif // SK_SFNTLY_SUBSETTER + #endif // SK_PDF_USE_SFNTLY auto fontStream = sk_make_sp<SkPDFSharedStream>(std::move(fontAsset)); fontStream->dict()->insertInt("Length1", fontSize); descriptor->insertObjRef("FontFile2", std::move(fontStream)); |