Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1170)

Side by Side Diff: src/pdf/SkPDFGraphicState.cpp

Issue 1135693003: Revert of Revert of stop calling SkScalarDiv (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFDevice.cpp ('k') | src/pdf/SkPDFShader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDevice.cpp ('k') | src/pdf/SkPDFShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698