OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkData.h" | 8 #include "SkData.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkPDFCanon.h" | 10 #include "SkPDFCanon.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 sk_sp<SkPDFStream> SkPDFGraphicState::MakeInvertFunction() { | 128 sk_sp<SkPDFStream> SkPDFGraphicState::MakeInvertFunction() { |
129 // Acrobat crashes if we use a type 0 function, kpdf crashes if we use | 129 // Acrobat crashes if we use a type 0 function, kpdf crashes if we use |
130 // a type 2 function, so we use a type 4 function. | 130 // a type 2 function, so we use a type 4 function. |
131 auto domainAndRange = sk_make_sp<SkPDFArray>(); | 131 auto domainAndRange = sk_make_sp<SkPDFArray>(); |
132 domainAndRange->reserve(2); | 132 domainAndRange->reserve(2); |
133 domainAndRange->appendInt(0); | 133 domainAndRange->appendInt(0); |
134 domainAndRange->appendInt(1); | 134 domainAndRange->appendInt(1); |
135 | 135 |
136 static const char psInvert[] = "{1 exch sub}"; | 136 static const char psInvert[] = "{1 exch sub}"; |
137 // Do not copy the trailing '\0' into the SkData. | 137 // Do not copy the trailing '\0' into the SkData. |
138 sk_sp<SkData> psInvertStream( | 138 auto invertFunction = sk_make_sp<SkPDFStream>( |
139 SkData::NewWithoutCopy(psInvert, strlen(psInvert))); | 139 SkData::MakeWithoutCopy(psInvert, strlen(psInvert))); |
140 | |
141 auto invertFunction = sk_make_sp<SkPDFStream>(psInvertStream.get()); | |
142 invertFunction->insertInt("FunctionType", 4); | 140 invertFunction->insertInt("FunctionType", 4); |
143 invertFunction->insertObject("Domain", domainAndRange); | 141 invertFunction->insertObject("Domain", domainAndRange); |
144 invertFunction->insertObject("Range", std::move(domainAndRange)); | 142 invertFunction->insertObject("Range", std::move(domainAndRange)); |
145 return invertFunction; | 143 return invertFunction; |
146 } | 144 } |
147 | 145 |
148 sk_sp<SkPDFDict> SkPDFGraphicState::GetSMaskGraphicState( | 146 sk_sp<SkPDFDict> SkPDFGraphicState::GetSMaskGraphicState( |
149 SkPDFFormXObject* sMask, | 147 SkPDFFormXObject* sMask, |
150 bool invert, | 148 bool invert, |
151 SkPDFSMaskMode sMaskMode, | 149 SkPDFSMaskMode sMaskMode, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 static_assert(SkPaint::kJoinCount == 3, "paint_join_mismatch"); | 202 static_assert(SkPaint::kJoinCount == 3, "paint_join_mismatch"); |
205 SkASSERT(strokeJoin >= 0 && strokeJoin <= 2); | 203 SkASSERT(strokeJoin >= 0 && strokeJoin <= 2); |
206 dict->insertInt("LJ", strokeJoin); | 204 dict->insertInt("LJ", strokeJoin); |
207 | 205 |
208 dict->insertScalar("LW", fStrokeWidth); | 206 dict->insertScalar("LW", fStrokeWidth); |
209 dict->insertScalar("ML", fStrokeMiter); | 207 dict->insertScalar("ML", fStrokeMiter); |
210 dict->insertBool("SA", true); // SA = Auto stroke adjustment. | 208 dict->insertBool("SA", true); // SA = Auto stroke adjustment. |
211 dict->insertName("BM", as_blend_mode(xferMode)); | 209 dict->insertName("BM", as_blend_mode(xferMode)); |
212 dict->emitObject(stream, objNumMap, substitutes); | 210 dict->emitObject(stream, objNumMap, substitutes); |
213 } | 211 } |
OLD | NEW |