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 "SkLazyPtr.h" | 9 #include "SkLazyPtr.h" |
10 #include "SkPDFCanon.h" | 10 #include "SkPDFCanon.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 SK_DECLARE_STATIC_LAZY_PTR(SkPDFDict, | 188 SK_DECLARE_STATIC_LAZY_PTR(SkPDFDict, |
189 noSMaskGraphicState, | 189 noSMaskGraphicState, |
190 create_no_smask_graphic_state, | 190 create_no_smask_graphic_state, |
191 unref<SkPDFDict>); | 191 unref<SkPDFDict>); |
192 | 192 |
193 // static | 193 // static |
194 SkPDFDict* SkPDFGraphicState::GetNoSMaskGraphicState() { | 194 SkPDFDict* SkPDFGraphicState::GetNoSMaskGraphicState() { |
195 return SkRef(noSMaskGraphicState.get()); | 195 return SkRef(noSMaskGraphicState.get()); |
196 } | 196 } |
197 | 197 |
198 void SkPDFGraphicState::emitObject(SkWStream* stream, | 198 void SkPDFGraphicState::emitObject( |
199 const SkPDFObjNumMap& objNumMap, | 199 SkWStream* stream, |
200 const SkPDFSubstituteMap& substitutes) { | 200 const SkPDFObjNumMap& objNumMap, |
| 201 const SkPDFSubstituteMap& substitutes) const { |
201 SkAutoTUnref<SkPDFDict> dict(SkNEW_ARGS(SkPDFDict, ("ExtGState"))); | 202 SkAutoTUnref<SkPDFDict> dict(SkNEW_ARGS(SkPDFDict, ("ExtGState"))); |
202 dict->insertName("Type", "ExtGState"); | 203 dict->insertName("Type", "ExtGState"); |
203 | 204 |
204 SkScalar alpha = SkIntToScalar(fAlpha) / 0xFF; | 205 SkScalar alpha = SkIntToScalar(fAlpha) / 0xFF; |
205 dict->insertScalar("CA", alpha); | 206 dict->insertScalar("CA", alpha); |
206 dict->insertScalar("ca", alpha); | 207 dict->insertScalar("ca", alpha); |
207 | 208 |
208 SkPaint::Cap strokeCap = (SkPaint::Cap)fStrokeCap; | 209 SkPaint::Cap strokeCap = (SkPaint::Cap)fStrokeCap; |
209 SkPaint::Join strokeJoin = (SkPaint::Join)fStrokeJoin; | 210 SkPaint::Join strokeJoin = (SkPaint::Join)fStrokeJoin; |
210 SkXfermode::Mode xferMode = (SkXfermode::Mode)fMode; | 211 SkXfermode::Mode xferMode = (SkXfermode::Mode)fMode; |
(...skipping 11 matching lines...) Expand all Loading... |
222 SK_COMPILE_ASSERT(SkPaint::kJoinCount == 3, paint_join_mismatch); | 223 SK_COMPILE_ASSERT(SkPaint::kJoinCount == 3, paint_join_mismatch); |
223 SkASSERT(strokeJoin >= 0 && strokeJoin <= 2); | 224 SkASSERT(strokeJoin >= 0 && strokeJoin <= 2); |
224 dict->insertInt("LJ", strokeJoin); | 225 dict->insertInt("LJ", strokeJoin); |
225 | 226 |
226 dict->insertScalar("LW", fStrokeWidth); | 227 dict->insertScalar("LW", fStrokeWidth); |
227 dict->insertScalar("ML", fStrokeMiter); | 228 dict->insertScalar("ML", fStrokeMiter); |
228 dict->insertBool("SA", true); // SA = Auto stroke adjustment. | 229 dict->insertBool("SA", true); // SA = Auto stroke adjustment. |
229 dict->insertName("BM", as_blend_mode(xferMode)); | 230 dict->insertName("BM", as_blend_mode(xferMode)); |
230 dict->emitObject(stream, objNumMap, substitutes); | 231 dict->emitObject(stream, objNumMap, substitutes); |
231 } | 232 } |
OLD | NEW |