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

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

Issue 23654044: pdf: ifgnore shader colors applied for 0 range. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkPDFShader.h" 10 #include "SkPDFShader.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 between startOffset and endOffset from prevColor to curColor (for each color 48 between startOffset and endOffset from prevColor to curColor (for each color
49 component), leaving the result in component order on the stack. It assumes 49 component), leaving the result in component order on the stack. It assumes
50 there are always 3 components per color. 50 there are always 3 components per color.
51 @param range endOffset - startOffset 51 @param range endOffset - startOffset
52 @param curColor[components] The current color components. 52 @param curColor[components] The current color components.
53 @param prevColor[components] The previous color components. 53 @param prevColor[components] The previous color components.
54 @param result The result ps function. 54 @param result The result ps function.
55 */ 55 */
56 static void interpolateColorCode(SkScalar range, SkScalar* curColor, 56 static void interpolateColorCode(SkScalar range, SkScalar* curColor,
57 SkScalar* prevColor, SkString* result) { 57 SkScalar* prevColor, SkString* result) {
58 if (range == SkIntToScalar(0)) {
59 result->append("pop");
vandebo (ex-Chrome) 2013/09/17 16:07:35 Looking more closely, it seems that this is not su
edisonn 2013/09/17 16:42:07 changed the implementation
60 }
61
58 static const int kColorComponents = 3; 62 static const int kColorComponents = 3;
59 63
60 // Figure out how to scale each color component. 64 // Figure out how to scale each color component.
61 SkScalar multiplier[kColorComponents]; 65 SkScalar multiplier[kColorComponents];
62 for (int i = 0; i < kColorComponents; i++) { 66 for (int i = 0; i < kColorComponents; i++) {
63 multiplier[i] = SkScalarDiv(curColor[i] - prevColor[i], range); 67 multiplier[i] = SkScalarDiv(curColor[i] - prevColor[i], range);
64 } 68 }
65 69
66 // Calculate when we no longer need to keep a copy of the input parameter t. 70 // Calculate when we no longer need to keep a copy of the input parameter t.
67 // If the last component to use t is i, then dupInput[0..i - 1] = true 71 // If the last component to use t is i, then dupInput[0..i - 1] = true
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 return false; 1214 return false;
1211 } 1215 }
1212 1216
1213 void SkPDFShader::State::AllocateGradientInfoStorage() { 1217 void SkPDFShader::State::AllocateGradientInfoStorage() {
1214 fColorData.set(sk_malloc_throw( 1218 fColorData.set(sk_malloc_throw(
1215 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); 1219 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar))));
1216 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); 1220 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get());
1217 fInfo.fColorOffsets = 1221 fInfo.fColorOffsets =
1218 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); 1222 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount);
1219 } 1223 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698