Index: src/effects/SkLayerDrawLooper.cpp |
diff --git a/src/effects/SkLayerDrawLooper.cpp b/src/effects/SkLayerDrawLooper.cpp |
index fa590d2d3fc7c1f9945abe409227b058ae68e93d..7c471c261487ce65dae303e366b21a68f53995f0 100644 |
--- a/src/effects/SkLayerDrawLooper.cpp |
+++ b/src/effects/SkLayerDrawLooper.cpp |
@@ -153,6 +153,49 @@ bool SkLayerDrawLooper::LayerDrawLooperContext::next(SkCanvas* canvas, |
return true; |
} |
+bool SkLayerDrawLooper::asABlurShadow(BlurShadowRec* bsRec) const { |
+ if (fCount != 2) { |
+ return false; |
+ } |
+ const Rec* rec = fRecs; |
+ |
+ // 2nd layer needs to be "plain" |
+ if (rec[1].fInfo.fPaintBits) { |
+ return false; |
+ } |
+ if (SkXfermode::kDst_Mode != rec[1].fInfo.fColorMode) { |
+ return false; |
+ } |
+ if (0 != rec[1].fInfo.fOffset.x() || 0 != rec[1].fInfo.fOffset.y()) { |
+ return false; |
+ } |
+ |
+ // 1st layer needs to be just blur(maskfilter) |
+ if ((rec[0].fInfo.fPaintBits & ~kMaskFilter_Bit)) { |
+ return false; |
+ } |
+ if (SkXfermode::kSrc_Mode != rec[0].fInfo.fColorMode) { |
+ return false; |
+ } |
+ const SkMaskFilter* mf = rec[0].fPaint.getMaskFilter(); |
+ if (NULL == mf) { |
+ return false; |
+ } |
+ SkMaskFilter::BlurRec maskBlur; |
+ if (!mf->asABlur(&maskBlur)) { |
+ return false; |
+ } |
+ |
+ if (bsRec) { |
+ bsRec->fSigma = maskBlur.fSigma; |
+ bsRec->fOffset = rec[0].fInfo.fOffset; |
+ bsRec->fColor = rec[0].fPaint.getColor(); |
+ bsRec->fStyle = maskBlur.fStyle; |
+ bsRec->fQuality = maskBlur.fQuality; |
+ } |
+ return true; |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////// |
void SkLayerDrawLooper::flatten(SkWriteBuffer& buffer) const { |