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

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

Issue 2190883003: SkPDF: PDFStream has-a not is-a PDFDict (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-07-29 (Friday) 12:30:20 EDT Created 4 years, 4 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/SkPDFGraphicState.h ('k') | src/pdf/SkPDFShader.h » ('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 "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
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
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 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFGraphicState.h ('k') | src/pdf/SkPDFShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698