diff options
author | halcanary <halcanary@google.com> | 2015-01-21 09:59:14 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-21 09:59:14 -0800 |
commit | fb62b3d423fa34c672df42f47017dbef087d19e9 (patch) | |
tree | 014428ea2ca480f62b55d3d63db5115df577bff6 /src/pdf/SkPDFFont.h | |
parent | 1c60dfe7ca0db010fa3118a1a2c7ff4c09136ab0 (diff) |
SkPDFCanon
SkPDFCanon's fields and methods will eventually become part of
SkPDFDocument/SkDocument_PDF. For now, it exists as a singleton to
preflight that transition. This replaces three global arrays in
SkPDFFont, SkPDFShader, and SkPDFGraphicsContext. This code is still
thread-unsafe (http://skbug.com/2683), but moving this functionality
into SkPDFDocument will fix that.
This CL does not change pdf output from either GMs or SKPs.
This change also simplifies some code around the SkPDFCanon methods.
BUG=skia:2683
Review URL: https://codereview.chromium.org/842253003
Diffstat (limited to 'src/pdf/SkPDFFont.h')
-rw-r--r-- | src/pdf/SkPDFFont.h | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/pdf/SkPDFFont.h b/src/pdf/SkPDFFont.h index 27f1b5bfe3..cf2daa0fdf 100644 --- a/src/pdf/SkPDFFont.h +++ b/src/pdf/SkPDFFont.h @@ -139,6 +139,17 @@ public: */ virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage); + enum Match { + kExact_Match, + kRelated_Match, + kNot_Match, + }; + static Match IsMatch(SkPDFFont* existingFont, + uint32_t existingFontID, + uint16_t existingGlyphID, + uint32_t searchFontID, + uint16_t searchGlyphID); + protected: // Common constructor to handle common members. SkPDFFont(const SkAdvancedTypefaceMetrics* fontInfo, SkTypeface* typeface, @@ -178,17 +189,6 @@ protected: static bool Find(uint32_t fontID, uint16_t glyphID, int* index); private: - class FontRec { - public: - SkPDFFont* fFont; - uint32_t fFontID; - uint16_t fGlyphID; - - // A fGlyphID of 0 with no fFont always matches. - bool operator==(const FontRec& b) const; - FontRec(SkPDFFont* font, uint32_t fontID, uint16_t fGlyphID); - }; - SkAutoTUnref<SkTypeface> fTypeface; // The glyph IDs accessible with this font. For Type1 (non CID) fonts, @@ -201,9 +201,6 @@ private: SkAdvancedTypefaceMetrics::FontType fFontType; - // This should be made a hash table if performance is a problem. - static SkTDArray<FontRec>& CanonicalFonts(); - static SkBaseMutex& CanonicalFontsMutex(); typedef SkPDFDict INHERITED; }; |