blob: 12ba051cf7ce61f139c94cb45e04a705f8d0e663 [file] [log] [blame]
halcanaryfb62b3d2015-01-21 09:59:14 -08001/*
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 Canary5bdc4d52018-04-10 11:13:24 -040010#include <vector>
11
Hal Canary9b9510a2017-07-18 09:39:00 -040012#include "SkBitmapKey.h"
Hal Canary50dbc092018-06-12 14:50:37 -040013#include "SkMacros.h"
Hal Canary9b9510a2017-07-18 09:39:00 -040014#include "SkPDFGradientShader.h"
halcanarybe27a112015-04-01 13:31:19 -070015#include "SkPDFGraphicState.h"
halcanaryfb62b3d2015-01-21 09:59:14 -080016#include "SkPDFShader.h"
Hal Canary50dbc092018-06-12 14:50:37 -040017#include "SkString.h"
halcanarybe27a112015-04-01 13:31:19 -070018#include "SkTHash.h"
Hal Canary9b9510a2017-07-18 09:39:00 -040019#include "SkTypeface.h"
halcanaryfb62b3d2015-01-21 09:59:14 -080020
halcanaryfb62b3d2015-01-21 09:59:14 -080021class SkPDFFont;
Hal Canary209e4b12017-05-04 14:23:55 -040022struct SkAdvancedTypefaceMetrics;
halcanary7a14b312015-10-01 07:28:13 -070023
halcanary792c80f2015-02-20 07:21:05 -080024/**
halcanarya50151d2016-03-25 11:57:49 -070025 * The SkPDFCanon canonicalizes objects across PDF pages
26 * (SkPDFDevices) and across draw calls.
halcanary792c80f2015-02-20 07:21:05 -080027 */
Hal Canary94fd66c2017-07-05 11:25:42 -040028class SkPDFCanon {
halcanaryfb62b3d2015-01-21 09:59:14 -080029public:
halcanarycee13422016-08-18 09:52:48 -070030 ~SkPDFCanon();
Hal Canary94fd66c2017-07-05 11:25:42 -040031 SkPDFCanon();
Hal Canary67362362018-04-24 13:58:37 -040032 SkPDFCanon(SkPDFCanon&&);
Hal Canary94fd66c2017-07-05 11:25:42 -040033 SkPDFCanon(const SkPDFCanon&) = delete;
Hal Canary67362362018-04-24 13:58:37 -040034 SkPDFCanon& operator=(SkPDFCanon&&);
Hal Canary94fd66c2017-07-05 11:25:42 -040035 SkPDFCanon& operator=(const SkPDFCanon&) = delete;
halcanary2e3f9d82015-02-27 12:41:03 -080036
Hal Canaryec257682017-07-06 08:37:02 -040037 SkTHashMap<SkPDFImageShaderKey, sk_sp<SkPDFObject>> fImageShaderMap;
halcanary530ea8e2015-01-23 06:17:35 -080038
Hal Canary2d171392017-07-05 14:41:22 -040039 SkPDFGradientShader::HashMap fGradientPatternMap;
halcanaryfb62b3d2015-01-21 09:59:14 -080040
Hal Canary5c1b3602017-04-17 16:30:06 -040041 SkTHashMap<SkBitmapKey, sk_sp<SkPDFObject>> fPDFBitmapMap;
halcanarya1f1ee92015-02-20 06:17:26 -080042
Hal Canary209e4b12017-05-04 14:23:55 -040043 SkTHashMap<uint32_t, std::unique_ptr<SkAdvancedTypefaceMetrics>> fTypefaceMetrics;
Hal Canary5bdc4d52018-04-10 11:13:24 -040044 SkTHashMap<uint32_t, std::vector<SkString>> fType1GlyphNames;
Hal Canary46cc3da2018-05-09 11:50:34 -040045 SkTHashMap<uint32_t, std::vector<SkUnichar>> fToUnicodeMap;
Hal Canary5c1b3602017-04-17 16:30:06 -040046 SkTHashMap<uint32_t, sk_sp<SkPDFDict>> fFontDescriptors;
47 SkTHashMap<uint64_t, sk_sp<SkPDFFont>> fFontMap;
halcanary66a82f32015-10-12 13:05:04 -070048
Hal Canary80fa7ce2017-06-28 16:04:20 -040049 SkTHashMap<SkPDFStrokeGraphicState, sk_sp<SkPDFDict>> fStrokeGSMap;
50 SkTHashMap<SkPDFFillGraphicState, sk_sp<SkPDFDict>> fFillGSMap;
51
Hal Canary5c1b3602017-04-17 16:30:06 -040052 sk_sp<SkPDFStream> fInvertFunction;
53 sk_sp<SkPDFDict> fNoSmaskGraphicState;
54 sk_sp<SkPDFArray> fRangeObject;
halcanaryfb62b3d2015-01-21 09:59:14 -080055};
Hal Canary9b9510a2017-07-18 09:39:00 -040056
halcanaryfb62b3d2015-01-21 09:59:14 -080057#endif // SkPDFCanon_DEFINED