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

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

Issue 1777923002: SkPDF: use sk_ref_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/SkPDFFormXObject.cpp ('k') | src/pdf/SkPDFResourceDict.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 "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
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
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 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFFormXObject.cpp ('k') | src/pdf/SkPDFResourceDict.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698