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

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

Issue 560653004: SkData can allocate room for its contents in the same block (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox, change fPtr to non const Created 6 years, 3 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/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 "SkPDFFormXObject.h" 9 #include "SkPDFFormXObject.h"
10 #include "SkPDFGraphicState.h" 10 #include "SkPDFGraphicState.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // Acrobat crashes if we use a type 0 function, kpdf crashes if we use 116 // Acrobat crashes if we use a type 0 function, kpdf crashes if we use
117 // a type 2 function, so we use a type 4 function. 117 // a type 2 function, so we use a type 4 function.
118 SkAutoTUnref<SkPDFArray> domainAndRange(new SkPDFArray); 118 SkAutoTUnref<SkPDFArray> domainAndRange(new SkPDFArray);
119 domainAndRange->reserve(2); 119 domainAndRange->reserve(2);
120 domainAndRange->appendInt(0); 120 domainAndRange->appendInt(0);
121 domainAndRange->appendInt(1); 121 domainAndRange->appendInt(1);
122 122
123 static const char psInvert[] = "{1 exch sub}"; 123 static const char psInvert[] = "{1 exch sub}";
124 // Do not copy the trailing '\0' into the SkData. 124 // Do not copy the trailing '\0' into the SkData.
125 SkAutoTUnref<SkData> psInvertStream( 125 SkAutoTUnref<SkData> psInvertStream(
126 SkData::NewWithCopy(psInvert, strlen(psInvert))); 126 SkData::NewWithoutCopy(psInvert, strlen(psInvert)));
127 127
128 invertFunction = new SkPDFStream(psInvertStream.get()); 128 invertFunction = new SkPDFStream(psInvertStream.get());
129 invertFunction->insertInt("FunctionType", 4); 129 invertFunction->insertInt("FunctionType", 4);
130 invertFunction->insert("Domain", domainAndRange.get()); 130 invertFunction->insert("Domain", domainAndRange.get());
131 invertFunction->insert("Range", domainAndRange.get()); 131 invertFunction->insert("Range", domainAndRange.get());
132 } 132 }
133 return invertFunction; 133 return invertFunction;
134 } 134 }
135 135
136 // static 136 // static
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 278 }
279 if (bXfermodeName < 0 || bXfermodeName > SkXfermode::kLastMode || 279 if (bXfermodeName < 0 || bXfermodeName > SkXfermode::kLastMode ||
280 blend_mode_from_xfermode(bXfermodeName) == NULL) { 280 blend_mode_from_xfermode(bXfermodeName) == NULL) {
281 bXfermodeName = SkXfermode::kSrcOver_Mode; 281 bXfermodeName = SkXfermode::kSrcOver_Mode;
282 } 282 }
283 const char* bXfermodeString = blend_mode_from_xfermode(bXfermodeName); 283 const char* bXfermodeString = blend_mode_from_xfermode(bXfermodeName);
284 SkASSERT(bXfermodeString != NULL); 284 SkASSERT(bXfermodeString != NULL);
285 285
286 return strcmp(aXfermodeString, bXfermodeString) == 0; 286 return strcmp(aXfermodeString, bXfermodeString) == 0;
287 } 287 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | src/pdf/SkPDFShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698