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

Unified Diff: src/pdf/SkPDFShader.cpp

Issue 13471011: Fix build error when building Android in Release mode with -O2. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFShader.cpp
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index b3e57cb95130cccbf5b6b0a159c8dde4e1e19e55..b52111e25d018f29601f0630b02d5782bb32991f 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -43,29 +43,29 @@ static void unitToPointsMatrix(const SkPoint pts[2], SkMatrix* matrix) {
/* Assumes t + startOffset is on the stack and does a linear interpolation on t
between startOffset and endOffset from prevColor to curColor (for each color
- component), leaving the result in component order on the stack.
+ component), leaving the result in component order on the stack. It assumes
+ there are always 3 components per color.
@param range endOffset - startOffset
@param curColor[components] The current color components.
@param prevColor[components] The previous color components.
@param result The result ps function.
*/
static void interpolateColorCode(SkScalar range, SkScalar* curColor,
- SkScalar* prevColor, int components,
- SkString* result) {
+ SkScalar* prevColor, SkString* result) {
+ static const int kColorComponents = 3;
+
// Figure out how to scale each color component.
- SkAutoSTMalloc<4, SkScalar> multiplierAlloc(components);
- SkScalar *multiplier = multiplierAlloc.get();
- for (int i = 0; i < components; i++) {
+ SkScalar multiplier[kColorComponents];
+ for (int i = 0; i < kColorComponents; i++) {
multiplier[i] = SkScalarDiv(curColor[i] - prevColor[i], range);
}
// Calculate when we no longer need to keep a copy of the input parameter t.
// If the last component to use t is i, then dupInput[0..i - 1] = true
// and dupInput[i .. components] = false.
- SkAutoSTMalloc<4, bool> dupInputAlloc(components);
- bool *dupInput = dupInputAlloc.get();
- dupInput[components - 1] = false;
- for (int i = components - 2; i >= 0; i--) {
+ bool dupInput[kColorComponents];
+ dupInput[kColorComponents - 1] = false;
+ for (int i = kColorComponents - 2; i >= 0; i--) {
dupInput[i] = dupInput[i + 1] || multiplier[i + 1] != 0;
}
@@ -73,7 +73,7 @@ static void interpolateColorCode(SkScalar range, SkScalar* curColor,
result->append("pop ");
}
- for (int i = 0; i < components; i++) {
+ for (int i = 0; i < kColorComponents; i++) {
// If the next components needs t and this component will consume a
// copy, make another copy.
if (dupInput[i] && multiplier[i] != 0) {
@@ -159,8 +159,7 @@ static void gradientFunctionCode(const SkShader::GradientInfo& info,
}
interpolateColorCode(info.fColorOffsets[i] - info.fColorOffsets[i - 1],
- colorData[i], colorData[i - 1], kColorComponents,
- result);
+ colorData[i], colorData[i - 1], result);
result->append("}\n");
}
« 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