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

Unified 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 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
===================================================================
--- src/pdf/SkPDFShader.cpp (revision 11306)
+++ src/pdf/SkPDFShader.cpp (working copy)
@@ -55,6 +55,7 @@
*/
static void interpolateColorCode(SkScalar range, SkScalar* curColor,
SkScalar* prevColor, SkString* result) {
+ SkASSERT(range != SkIntToScalar(0));
static const int kColorComponents = 3;
// Figure out how to scale each color component.
@@ -152,7 +153,13 @@
result->append(" }\n");
// The gradient colors.
+ int gradients = 0;
for (int i = 1 ; i < info.fColorCount; i++) {
+ if (info.fColorOffsets[i] == info.fColorOffsets[i - 1]) {
+ continue;
+ }
+ gradients++;
+
result->append("{dup ");
result->appendScalar(info.fColorOffsets[i]);
result->append(" le {");
@@ -174,7 +181,7 @@
result->append(" ");
result->appendScalar(colorData[info.fColorCount - 1][2]);
- for (int i = 0 ; i < info.fColorCount; i++) {
+ for (int i = 0 ; i < gradients + 1; i++) {
result->append("} ifelse\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