[PDF] Fix PDF code to not crash on SkComposeShader.
Review URL: https://codereview.appspot.com/6354053
git-svn-id: http://skia.googlecode.com/svn/trunk@4400 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index fc9f8c0..22175cc 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -362,6 +362,14 @@
SkPDFObject* result;
SkAutoMutexAcquire lock(CanonicalShadersMutex());
SkAutoTDelete<State> shaderState(new State(shader, matrix, surfaceBBox));
+ if (shaderState.get()->fType == SkShader::kNone_GradientType &&
+ shaderState.get()->fImage.isNull()) {
+ // TODO(vandebo) This drops SKComposeShader on the floor. We could
+ // handle compose shader by pulling things up to a layer, drawing with
+ // the first shader, applying the xfer mode and drawing again with the
+ // second shader, then applying the layer to the original drawing.
+ return NULL;
+ }
ShaderCanonicalEntry entry(NULL, shaderState.get());
int index = CanonicalShaders().find(entry);