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

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

Issue 2190643002: SkPDF: refactor font subset: fewer copies (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-07-27 (Wednesday) 16:22:36 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/SkPDFFont.cpp ('k') | src/pdf/SkPDFStream.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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 sk_sp<SkPDFStream> SkPDFGraphicState::MakeInvertFunction() { 128 sk_sp<SkPDFStream> SkPDFGraphicState::MakeInvertFunction() {
129 // Acrobat crashes if we use a type 0 function, kpdf crashes if we use 129 // Acrobat crashes if we use a type 0 function, kpdf crashes if we use
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 sk_sp<SkData> psInvertStream( 138 auto invertFunction = sk_make_sp<SkPDFStream>(
139 SkData::NewWithoutCopy(psInvert, strlen(psInvert))); 139 SkData::MakeWithoutCopy(psInvert, strlen(psInvert)));
140
141 auto invertFunction = sk_make_sp<SkPDFStream>(psInvertStream.get());
142 invertFunction->insertInt("FunctionType", 4); 140 invertFunction->insertInt("FunctionType", 4);
143 invertFunction->insertObject("Domain", domainAndRange); 141 invertFunction->insertObject("Domain", domainAndRange);
144 invertFunction->insertObject("Range", std::move(domainAndRange)); 142 invertFunction->insertObject("Range", std::move(domainAndRange));
145 return invertFunction; 143 return invertFunction;
146 } 144 }
147 145
148 sk_sp<SkPDFDict> SkPDFGraphicState::GetSMaskGraphicState( 146 sk_sp<SkPDFDict> SkPDFGraphicState::GetSMaskGraphicState(
149 SkPDFFormXObject* sMask, 147 SkPDFFormXObject* sMask,
150 bool invert, 148 bool invert,
151 SkPDFSMaskMode sMaskMode, 149 SkPDFSMaskMode sMaskMode,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 static_assert(SkPaint::kJoinCount == 3, "paint_join_mismatch"); 202 static_assert(SkPaint::kJoinCount == 3, "paint_join_mismatch");
205 SkASSERT(strokeJoin >= 0 && strokeJoin <= 2); 203 SkASSERT(strokeJoin >= 0 && strokeJoin <= 2);
206 dict->insertInt("LJ", strokeJoin); 204 dict->insertInt("LJ", strokeJoin);
207 205
208 dict->insertScalar("LW", fStrokeWidth); 206 dict->insertScalar("LW", fStrokeWidth);
209 dict->insertScalar("ML", fStrokeMiter); 207 dict->insertScalar("ML", fStrokeMiter);
210 dict->insertBool("SA", true); // SA = Auto stroke adjustment. 208 dict->insertBool("SA", true); // SA = Auto stroke adjustment.
211 dict->insertName("BM", as_blend_mode(xferMode)); 209 dict->insertName("BM", as_blend_mode(xferMode));
212 dict->emitObject(stream, objNumMap, substitutes); 210 dict->emitObject(stream, objNumMap, substitutes);
213 } 211 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | src/pdf/SkPDFStream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698