aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFCanon.h
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-07-17 14:15:53 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-17 20:52:08 +0000
commit3cf6b79e50f148cae7ed8c6ec0cd79f1ede71c95 (patch)
treedef111a6394186d623c5f04616d105d65fcae00b /src/pdf/SkPDFCanon.h
parentdf80e39eab6eeebdb7362c22df7591a28d788e02 (diff)
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. - add a test that works on MacOS BUG=chromium:705480 BUG=skia:3489 Change-Id: I4fbc42f218e5b81ea15ea6cdccc61c91e532f6d0 Reviewed-on: https://skia-review.googlesource.com/24080 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/pdf/SkPDFCanon.h')
-rw-r--r--src/pdf/SkPDFCanon.h25
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