halcanary | fb62b3d | 2015-01-21 09:59:14 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | #ifndef SkPDFCanon_DEFINED |
| 8 | #define SkPDFCanon_DEFINED |
| 9 | |
Hal Canary | 5bdc4d5 | 2018-04-10 11:13:24 -0400 | [diff] [blame] | 10 | #include <vector> |
| 11 | |
Hal Canary | 9b9510a | 2017-07-18 09:39:00 -0400 | [diff] [blame] | 12 | #include "SkBitmapKey.h" |
Hal Canary | 50dbc09 | 2018-06-12 14:50:37 -0400 | [diff] [blame] | 13 | #include "SkMacros.h" |
Hal Canary | 9b9510a | 2017-07-18 09:39:00 -0400 | [diff] [blame] | 14 | #include "SkPDFGradientShader.h" |
halcanary | be27a11 | 2015-04-01 13:31:19 -0700 | [diff] [blame] | 15 | #include "SkPDFGraphicState.h" |
halcanary | fb62b3d | 2015-01-21 09:59:14 -0800 | [diff] [blame] | 16 | #include "SkPDFShader.h" |
Hal Canary | 50dbc09 | 2018-06-12 14:50:37 -0400 | [diff] [blame] | 17 | #include "SkString.h" |
halcanary | be27a11 | 2015-04-01 13:31:19 -0700 | [diff] [blame] | 18 | #include "SkTHash.h" |
Hal Canary | 9b9510a | 2017-07-18 09:39:00 -0400 | [diff] [blame] | 19 | #include "SkTypeface.h" |
halcanary | fb62b3d | 2015-01-21 09:59:14 -0800 | [diff] [blame] | 20 | |
halcanary | fb62b3d | 2015-01-21 09:59:14 -0800 | [diff] [blame] | 21 | class SkPDFFont; |
Hal Canary | 209e4b1 | 2017-05-04 14:23:55 -0400 | [diff] [blame] | 22 | struct SkAdvancedTypefaceMetrics; |
halcanary | 7a14b31 | 2015-10-01 07:28:13 -0700 | [diff] [blame] | 23 | |
halcanary | 792c80f | 2015-02-20 07:21:05 -0800 | [diff] [blame] | 24 | /** |
halcanary | a50151d | 2016-03-25 11:57:49 -0700 | [diff] [blame] | 25 | * The SkPDFCanon canonicalizes objects across PDF pages |
| 26 | * (SkPDFDevices) and across draw calls. |
halcanary | 792c80f | 2015-02-20 07:21:05 -0800 | [diff] [blame] | 27 | */ |
Hal Canary | 94fd66c | 2017-07-05 11:25:42 -0400 | [diff] [blame] | 28 | class SkPDFCanon { |
halcanary | fb62b3d | 2015-01-21 09:59:14 -0800 | [diff] [blame] | 29 | public: |
halcanary | cee1342 | 2016-08-18 09:52:48 -0700 | [diff] [blame] | 30 | ~SkPDFCanon(); |
Hal Canary | 94fd66c | 2017-07-05 11:25:42 -0400 | [diff] [blame] | 31 | SkPDFCanon(); |
Hal Canary | 6736236 | 2018-04-24 13:58:37 -0400 | [diff] [blame] | 32 | SkPDFCanon(SkPDFCanon&&); |
Hal Canary | 94fd66c | 2017-07-05 11:25:42 -0400 | [diff] [blame] | 33 | SkPDFCanon(const SkPDFCanon&) = delete; |
Hal Canary | 6736236 | 2018-04-24 13:58:37 -0400 | [diff] [blame] | 34 | SkPDFCanon& operator=(SkPDFCanon&&); |
Hal Canary | 94fd66c | 2017-07-05 11:25:42 -0400 | [diff] [blame] | 35 | SkPDFCanon& operator=(const SkPDFCanon&) = delete; |
halcanary | 2e3f9d8 | 2015-02-27 12:41:03 -0800 | [diff] [blame] | 36 | |
Hal Canary | ec25768 | 2017-07-06 08:37:02 -0400 | [diff] [blame] | 37 | SkTHashMap<SkPDFImageShaderKey, sk_sp<SkPDFObject>> fImageShaderMap; |
halcanary | 530ea8e | 2015-01-23 06:17:35 -0800 | [diff] [blame] | 38 | |
Hal Canary | 2d17139 | 2017-07-05 14:41:22 -0400 | [diff] [blame] | 39 | SkPDFGradientShader::HashMap fGradientPatternMap; |
halcanary | fb62b3d | 2015-01-21 09:59:14 -0800 | [diff] [blame] | 40 | |
Hal Canary | 5c1b360 | 2017-04-17 16:30:06 -0400 | [diff] [blame] | 41 | SkTHashMap<SkBitmapKey, sk_sp<SkPDFObject>> fPDFBitmapMap; |
halcanary | a1f1ee9 | 2015-02-20 06:17:26 -0800 | [diff] [blame] | 42 | |
Hal Canary | 209e4b1 | 2017-05-04 14:23:55 -0400 | [diff] [blame] | 43 | SkTHashMap<uint32_t, std::unique_ptr<SkAdvancedTypefaceMetrics>> fTypefaceMetrics; |
Hal Canary | 5bdc4d5 | 2018-04-10 11:13:24 -0400 | [diff] [blame] | 44 | SkTHashMap<uint32_t, std::vector<SkString>> fType1GlyphNames; |
Hal Canary | 46cc3da | 2018-05-09 11:50:34 -0400 | [diff] [blame] | 45 | SkTHashMap<uint32_t, std::vector<SkUnichar>> fToUnicodeMap; |
Hal Canary | 5c1b360 | 2017-04-17 16:30:06 -0400 | [diff] [blame] | 46 | SkTHashMap<uint32_t, sk_sp<SkPDFDict>> fFontDescriptors; |
| 47 | SkTHashMap<uint64_t, sk_sp<SkPDFFont>> fFontMap; |
halcanary | 66a82f3 | 2015-10-12 13:05:04 -0700 | [diff] [blame] | 48 | |
Hal Canary | 80fa7ce | 2017-06-28 16:04:20 -0400 | [diff] [blame] | 49 | SkTHashMap<SkPDFStrokeGraphicState, sk_sp<SkPDFDict>> fStrokeGSMap; |
| 50 | SkTHashMap<SkPDFFillGraphicState, sk_sp<SkPDFDict>> fFillGSMap; |
| 51 | |
Hal Canary | 5c1b360 | 2017-04-17 16:30:06 -0400 | [diff] [blame] | 52 | sk_sp<SkPDFStream> fInvertFunction; |
| 53 | sk_sp<SkPDFDict> fNoSmaskGraphicState; |
| 54 | sk_sp<SkPDFArray> fRangeObject; |
halcanary | fb62b3d | 2015-01-21 09:59:14 -0800 | [diff] [blame] | 55 | }; |
Hal Canary | 9b9510a | 2017-07-18 09:39:00 -0400 | [diff] [blame] | 56 | |
halcanary | fb62b3d | 2015-01-21 09:59:14 -0800 | [diff] [blame] | 57 | #endif // SkPDFCanon_DEFINED |