OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 } |
OLD | NEW |