| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 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->insertInt("FunctionType", 4); | 140 invertFunction->dict()->insertInt("FunctionType", 4); |
| 141 invertFunction->insertObject("Domain", domainAndRange); | 141 invertFunction->dict()->insertObject("Domain", domainAndRange); |
| 142 invertFunction->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 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. |
| (...skipping 49 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 |