diff options
author | 2017-07-18 09:39:00 -0400 | |
---|---|---|
committer | 2017-07-18 14:06:56 +0000 | |
commit | 9b9510a71182ab88cd82effd6728aaa0584b8dcc (patch) | |
tree | 4f036a89646692536703df24a445f6dae6c10619 /src/pdf/SkPDFCanon.h | |
parent | cda20154b611c33b8fc8abf1f01d888166e19dcb (diff) |
Revert "Revert "SkPDF: Non-outline glyphs as images""
This reverts commit 63b6f8b93209e593f60b235577f5b3d660396d5f.
SkPDF: Non-outline glyphs as images
- Cache images in PDF Canon for de-duping
- For now, rasterize at text scale. In the future, look at CTM and
fRasterScale.
Original CL: https://skia-review.googlesource.com/24080
BUG=chromium:705480
BUG=skia:3489
Reviewed-by: Ben Wagner <bungeman@google.com>
Change-Id: I99783df72c945cfb4b24b6d4db99418aa34e0897
Reviewed-on: https://skia-review.googlesource.com/24322
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/pdf/SkPDFCanon.h')
-rw-r--r-- | src/pdf/SkPDFCanon.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/pdf/SkPDFCanon.h b/src/pdf/SkPDFCanon.h index 03671bf921..8edd06e391 100644 --- a/src/pdf/SkPDFCanon.h +++ b/src/pdf/SkPDFCanon.h @@ -7,13 +7,14 @@ #ifndef SkPDFCanon_DEFINED #define SkPDFCanon_DEFINED +#include "SkBitmapKey.h" +#include "SkPDFGradientShader.h" #include "SkPDFGraphicState.h" #include "SkPDFShader.h" -#include "SkPDFGradientShader.h" #include "SkPixelSerializer.h" #include "SkTDArray.h" #include "SkTHash.h" -#include "SkBitmapKey.h" +#include "SkTypeface.h" class SkPDFFont; struct SkAdvancedTypefaceMetrics; @@ -46,5 +47,25 @@ public: sk_sp<SkPDFStream> fInvertFunction; sk_sp<SkPDFDict> fNoSmaskGraphicState; sk_sp<SkPDFArray> fRangeObject; + + SK_BEGIN_REQUIRE_DENSE + struct BitmapGlyphKey { + SkFontID fFontID; // uint32_t + SkScalar fTextSize; // float32 + SkScalar fTextScaleX; // float32 + SkScalar fTextSkewX; // float32 + SkGlyphID fGlyphID; // uint16_t + uint16_t fPadding; + }; + SK_END_REQUIRE_DENSE + struct BitmapGlyph { + sk_sp<SkImage> fImage; + SkIPoint fOffset; + }; + SkTHashMap<BitmapGlyphKey, BitmapGlyph> fBitmapGlyphImages; }; + +inline bool operator==(const SkPDFCanon::BitmapGlyphKey& u, const SkPDFCanon::BitmapGlyphKey& v) { + return memcmp(&u, &u, sizeof(SkPDFCanon::BitmapGlyphKey)) == 0; +} #endif // SkPDFCanon_DEFINED |