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

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

Issue 18585002: Implemented transparent gradients (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Merge new SkPDFResourceDict method names Created 7 years, 5 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 | Annotate | Revision Log
« 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 "SkPDFFormXObject.h" 8 #include "SkPDFFormXObject.h"
9 #include "SkPDFGraphicState.h" 9 #include "SkPDFGraphicState.h"
10 #include "SkPDFUtils.h" 10 #include "SkPDFUtils.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 invertFunction = new SkPDFStream(psInvertStream.get()); 131 invertFunction = new SkPDFStream(psInvertStream.get());
132 invertFunction->insertInt("FunctionType", 4); 132 invertFunction->insertInt("FunctionType", 4);
133 invertFunction->insert("Domain", domainAndRange.get()); 133 invertFunction->insert("Domain", domainAndRange.get());
134 invertFunction->insert("Range", domainAndRange.get()); 134 invertFunction->insert("Range", domainAndRange.get());
135 } 135 }
136 return invertFunction; 136 return invertFunction;
137 } 137 }
138 138
139 // static 139 // static
140 SkPDFGraphicState* SkPDFGraphicState::GetSMaskGraphicState( 140 SkPDFGraphicState* SkPDFGraphicState::GetSMaskGraphicState(
141 SkPDFFormXObject* sMask, bool invert) { 141 SkPDFFormXObject* sMask, bool invert, SkPDFSMaskMode sMaskMode) {
142 // The practical chances of using the same mask more than once are unlikely 142 // The practical chances of using the same mask more than once are unlikely
143 // enough that it's not worth canonicalizing. 143 // enough that it's not worth canonicalizing.
144 SkAutoMutexAcquire lock(CanonicalPaintsMutex()); 144 SkAutoMutexAcquire lock(CanonicalPaintsMutex());
145 145
146 SkAutoTUnref<SkPDFDict> sMaskDict(new SkPDFDict("Mask")); 146 SkAutoTUnref<SkPDFDict> sMaskDict(new SkPDFDict("Mask"));
147 sMaskDict->insertName("S", "Alpha"); 147 if (sMaskMode == kAlpha_SMaskMode) {
148 sMaskDict->insertName("S", "Alpha");
149 } else if (sMaskMode == kLuminosity_SMaskMode) {
150 sMaskDict->insertName("S", "Luminosity");
151 }
148 sMaskDict->insert("G", new SkPDFObjRef(sMask))->unref(); 152 sMaskDict->insert("G", new SkPDFObjRef(sMask))->unref();
149 153
150 SkPDFGraphicState* result = new SkPDFGraphicState; 154 SkPDFGraphicState* result = new SkPDFGraphicState;
151 result->fPopulated = true; 155 result->fPopulated = true;
152 result->fSMask = true; 156 result->fSMask = true;
153 result->insertName("Type", "ExtGState"); 157 result->insertName("Type", "ExtGState");
154 result->insert("SMask", sMaskDict.get()); 158 result->insert("SMask", sMaskDict.get());
155 result->fResources.push(sMask); 159 result->fResources.push(sMask);
156 sMask->ref(); 160 sMask->ref();
157 161
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 280 }
277 if (bXfermodeName < 0 || bXfermodeName > SkXfermode::kLastMode || 281 if (bXfermodeName < 0 || bXfermodeName > SkXfermode::kLastMode ||
278 blend_mode_from_xfermode(bXfermodeName) == NULL) { 282 blend_mode_from_xfermode(bXfermodeName) == NULL) {
279 bXfermodeName = SkXfermode::kSrcOver_Mode; 283 bXfermodeName = SkXfermode::kSrcOver_Mode;
280 } 284 }
281 const char* bXfermodeString = blend_mode_from_xfermode(bXfermodeName); 285 const char* bXfermodeString = blend_mode_from_xfermode(bXfermodeName);
282 SkASSERT(bXfermodeString != NULL); 286 SkASSERT(bXfermodeString != NULL);
283 287
284 return strcmp(aXfermodeString, bXfermodeString) == 0; 288 return strcmp(aXfermodeString, bXfermodeString) == 0;
285 } 289 }
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