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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Do not copy the trailing '\0' into the SkData. | 137 // Do not copy the trailing '\0' into the SkData. |
138 auto invertFunction = sk_make_sp<SkPDFStream>( | 138 auto invertFunction = sk_make_sp<SkPDFStream>( |
139 SkData::MakeWithoutCopy(psInvert, strlen(psInvert))); | 139 SkData::MakeWithoutCopy(psInvert, strlen(psInvert))); |
140 invertFunction->dict()->insertInt("FunctionType", 4); | 140 invertFunction->dict()->insertInt("FunctionType", 4); |
141 invertFunction->dict()->insertObject("Domain", domainAndRange); | 141 invertFunction->dict()->insertObject("Domain", domainAndRange); |
142 invertFunction->dict()->insertObject("Range", std::move(domainAndRange)); | 142 invertFunction->dict()->insertObject("Range", std::move(domainAndRange)); |
143 return invertFunction; | 143 return invertFunction; |
144 } | 144 } |
145 | 145 |
146 sk_sp<SkPDFDict> SkPDFGraphicState::GetSMaskGraphicState( | 146 sk_sp<SkPDFDict> SkPDFGraphicState::GetSMaskGraphicState( |
147 SkPDFObject* sMask, | 147 sk_sp<SkPDFObject> sMask, |
148 bool invert, | 148 bool invert, |
149 SkPDFSMaskMode sMaskMode, | 149 SkPDFSMaskMode sMaskMode, |
150 SkPDFCanon* canon) { | 150 SkPDFCanon* canon) { |
151 // The practical chances of using the same mask more than once are unlikely | 151 // The practical chances of using the same mask more than once are unlikely |
152 // enough that it's not worth canonicalizing. | 152 // enough that it's not worth canonicalizing. |
153 auto sMaskDict = sk_make_sp<SkPDFDict>("Mask"); | 153 auto sMaskDict = sk_make_sp<SkPDFDict>("Mask"); |
154 if (sMaskMode == kAlpha_SMaskMode) { | 154 if (sMaskMode == kAlpha_SMaskMode) { |
155 sMaskDict->insertName("S", "Alpha"); | 155 sMaskDict->insertName("S", "Alpha"); |
156 } else if (sMaskMode == kLuminosity_SMaskMode) { | 156 } else if (sMaskMode == kLuminosity_SMaskMode) { |
157 sMaskDict->insertName("S", "Luminosity"); | 157 sMaskDict->insertName("S", "Luminosity"); |
158 } | 158 } |
159 sMaskDict->insertObjRef("G", sk_ref_sp(sMask)); | 159 sMaskDict->insertObjRef("G", std::move(sMask)); |
160 if (invert) { | 160 if (invert) { |
161 // Instead of calling SkPDFGraphicState::MakeInvertFunction, | 161 // Instead of calling SkPDFGraphicState::MakeInvertFunction, |
162 // let the canon deduplicate this object. | 162 // let the canon deduplicate this object. |
163 sMaskDict->insertObjRef("TR", canon->makeInvertFunction()); | 163 sMaskDict->insertObjRef("TR", canon->makeInvertFunction()); |
164 } | 164 } |
165 | 165 |
166 auto result = sk_make_sp<SkPDFDict>("ExtGState"); | 166 auto result = sk_make_sp<SkPDFDict>("ExtGState"); |
167 result->insertObject("SMask", std::move(sMaskDict)); | 167 result->insertObject("SMask", std::move(sMaskDict)); |
168 return result; | 168 return result; |
169 } | 169 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 static_assert(SkPaint::kJoinCount == 3, "paint_join_mismatch"); | 202 static_assert(SkPaint::kJoinCount == 3, "paint_join_mismatch"); |
203 SkASSERT(strokeJoin >= 0 && strokeJoin <= 2); | 203 SkASSERT(strokeJoin >= 0 && strokeJoin <= 2); |
204 dict->insertInt("LJ", strokeJoin); | 204 dict->insertInt("LJ", strokeJoin); |
205 | 205 |
206 dict->insertScalar("LW", fStrokeWidth); | 206 dict->insertScalar("LW", fStrokeWidth); |
207 dict->insertScalar("ML", fStrokeMiter); | 207 dict->insertScalar("ML", fStrokeMiter); |
208 dict->insertBool("SA", true); // SA = Auto stroke adjustment. | 208 dict->insertBool("SA", true); // SA = Auto stroke adjustment. |
209 dict->insertName("BM", as_blend_mode(xferMode)); | 209 dict->insertName("BM", as_blend_mode(xferMode)); |
210 dict->emitObject(stream, objNumMap, substitutes); | 210 dict->emitObject(stream, objNumMap, substitutes); |
211 } | 211 } |
OLD | NEW |