| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(SkWStream* stream, |
| 199 const SkPDFObjNumMap& objNumMap, | 199 const SkPDFObjNumMap& objNumMap, |
| 200 const SkPDFSubstituteMap& substitutes) { | 200 const SkPDFSubstituteMap& substitutes) { |
| 201 SkAutoTUnref<SkPDFDict> dict(SkNEW_ARGS(SkPDFDict, ("ExtGState"))); | 201 SkAutoTUnref<SkPDFDict> dict(SkNEW_ARGS(SkPDFDict, ("ExtGState"))); |
| 202 dict->insertName("Type", "ExtGState"); | 202 dict->insertName("Type", "ExtGState"); |
| 203 | 203 |
| 204 SkScalar alpha = SkScalarDiv(fAlpha, 0xFF); | 204 SkScalar alpha = SkIntToScalar(fAlpha) / 0xFF; |
| 205 dict->insertScalar("CA", alpha); | 205 dict->insertScalar("CA", alpha); |
| 206 dict->insertScalar("ca", alpha); | 206 dict->insertScalar("ca", alpha); |
| 207 | 207 |
| 208 SkPaint::Cap strokeCap = (SkPaint::Cap)fStrokeCap; | 208 SkPaint::Cap strokeCap = (SkPaint::Cap)fStrokeCap; |
| 209 SkPaint::Join strokeJoin = (SkPaint::Join)fStrokeJoin; | 209 SkPaint::Join strokeJoin = (SkPaint::Join)fStrokeJoin; |
| 210 SkXfermode::Mode xferMode = (SkXfermode::Mode)fMode; | 210 SkXfermode::Mode xferMode = (SkXfermode::Mode)fMode; |
| 211 | 211 |
| 212 SK_COMPILE_ASSERT(SkPaint::kButt_Cap == 0, paint_cap_mismatch); | 212 SK_COMPILE_ASSERT(SkPaint::kButt_Cap == 0, paint_cap_mismatch); |
| 213 SK_COMPILE_ASSERT(SkPaint::kRound_Cap == 1, paint_cap_mismatch); | 213 SK_COMPILE_ASSERT(SkPaint::kRound_Cap == 1, paint_cap_mismatch); |
| 214 SK_COMPILE_ASSERT(SkPaint::kSquare_Cap == 2, paint_cap_mismatch); | 214 SK_COMPILE_ASSERT(SkPaint::kSquare_Cap == 2, paint_cap_mismatch); |
| 215 SK_COMPILE_ASSERT(SkPaint::kCapCount == 3, paint_cap_mismatch); | 215 SK_COMPILE_ASSERT(SkPaint::kCapCount == 3, paint_cap_mismatch); |
| 216 SkASSERT(strokeCap >= 0 && strokeCap <= 2); | 216 SkASSERT(strokeCap >= 0 && strokeCap <= 2); |
| 217 dict->insertInt("LC", strokeCap); | 217 dict->insertInt("LC", strokeCap); |
| 218 | 218 |
| 219 SK_COMPILE_ASSERT(SkPaint::kMiter_Join == 0, paint_join_mismatch); | 219 SK_COMPILE_ASSERT(SkPaint::kMiter_Join == 0, paint_join_mismatch); |
| 220 SK_COMPILE_ASSERT(SkPaint::kRound_Join == 1, paint_join_mismatch); | 220 SK_COMPILE_ASSERT(SkPaint::kRound_Join == 1, paint_join_mismatch); |
| 221 SK_COMPILE_ASSERT(SkPaint::kBevel_Join == 2, paint_join_mismatch); | 221 SK_COMPILE_ASSERT(SkPaint::kBevel_Join == 2, paint_join_mismatch); |
| 222 SK_COMPILE_ASSERT(SkPaint::kJoinCount == 3, paint_join_mismatch); | 222 SK_COMPILE_ASSERT(SkPaint::kJoinCount == 3, paint_join_mismatch); |
| 223 SkASSERT(strokeJoin >= 0 && strokeJoin <= 2); | 223 SkASSERT(strokeJoin >= 0 && strokeJoin <= 2); |
| 224 dict->insertInt("LJ", strokeJoin); | 224 dict->insertInt("LJ", strokeJoin); |
| 225 | 225 |
| 226 dict->insertScalar("LW", fStrokeWidth); | 226 dict->insertScalar("LW", fStrokeWidth); |
| 227 dict->insertScalar("ML", fStrokeMiter); | 227 dict->insertScalar("ML", fStrokeMiter); |
| 228 dict->insertBool("SA", true); // SA = Auto stroke adjustment. | 228 dict->insertBool("SA", true); // SA = Auto stroke adjustment. |
| 229 dict->insertName("BM", as_blend_mode(xferMode)); | 229 dict->insertName("BM", as_blend_mode(xferMode)); |
| 230 dict->emitObject(stream, objNumMap, substitutes); | 230 dict->emitObject(stream, objNumMap, substitutes); |
| 231 } | 231 } |
| OLD | NEW |