| 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 "SkOncePtr.h" | 9 #include "SkOncePtr.h" |
| 10 #include "SkPDFCanon.h" | 10 #include "SkPDFCanon.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 bool invert, | 158 bool invert, |
| 159 SkPDFSMaskMode sMaskMode) { | 159 SkPDFSMaskMode sMaskMode) { |
| 160 // The practical chances of using the same mask more than once are unlikely | 160 // The practical chances of using the same mask more than once are unlikely |
| 161 // enough that it's not worth canonicalizing. | 161 // enough that it's not worth canonicalizing. |
| 162 auto sMaskDict = sk_make_sp<SkPDFDict>("Mask"); | 162 auto sMaskDict = sk_make_sp<SkPDFDict>("Mask"); |
| 163 if (sMaskMode == kAlpha_SMaskMode) { | 163 if (sMaskMode == kAlpha_SMaskMode) { |
| 164 sMaskDict->insertName("S", "Alpha"); | 164 sMaskDict->insertName("S", "Alpha"); |
| 165 } else if (sMaskMode == kLuminosity_SMaskMode) { | 165 } else if (sMaskMode == kLuminosity_SMaskMode) { |
| 166 sMaskDict->insertName("S", "Luminosity"); | 166 sMaskDict->insertName("S", "Luminosity"); |
| 167 } | 167 } |
| 168 sMaskDict->insertObjRef("G", sk_sp<SkPDFFormXObject>(SkRef(sMask))); | 168 sMaskDict->insertObjRef("G", sk_ref_sp(sMask)); |
| 169 if (invert) { | 169 if (invert) { |
| 170 sMaskDict->insertObjRef("TR", make_invert_function()); | 170 sMaskDict->insertObjRef("TR", make_invert_function()); |
| 171 } | 171 } |
| 172 | 172 |
| 173 auto result = sk_make_sp<SkPDFDict>("ExtGState"); | 173 auto result = sk_make_sp<SkPDFDict>("ExtGState"); |
| 174 result->insertObject("SMask", std::move(sMaskDict)); | 174 result->insertObject("SMask", std::move(sMaskDict)); |
| 175 return result.release(); | 175 return result.release(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 static SkPDFDict* create_no_smask_graphic_state() { | 178 static SkPDFDict* create_no_smask_graphic_state() { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 static_assert(SkPaint::kJoinCount == 3, "paint_join_mismatch"); | 215 static_assert(SkPaint::kJoinCount == 3, "paint_join_mismatch"); |
| 216 SkASSERT(strokeJoin >= 0 && strokeJoin <= 2); | 216 SkASSERT(strokeJoin >= 0 && strokeJoin <= 2); |
| 217 dict->insertInt("LJ", strokeJoin); | 217 dict->insertInt("LJ", strokeJoin); |
| 218 | 218 |
| 219 dict->insertScalar("LW", fStrokeWidth); | 219 dict->insertScalar("LW", fStrokeWidth); |
| 220 dict->insertScalar("ML", fStrokeMiter); | 220 dict->insertScalar("ML", fStrokeMiter); |
| 221 dict->insertBool("SA", true); // SA = Auto stroke adjustment. | 221 dict->insertBool("SA", true); // SA = Auto stroke adjustment. |
| 222 dict->insertName("BM", as_blend_mode(xferMode)); | 222 dict->insertName("BM", as_blend_mode(xferMode)); |
| 223 dict->emitObject(stream, objNumMap, substitutes); | 223 dict->emitObject(stream, objNumMap, substitutes); |
| 224 } | 224 } |
| OLD | NEW |