aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/SkDraw.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkDraw.cpp')
-rw-r--r--src/core/SkDraw.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index d59b813..1d3263f 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -932,7 +932,16 @@ void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap,
c.translate(-SkIntToScalar(mask.fBounds.fLeft),
-SkIntToScalar(mask.fBounds.fTop));
c.concat(*fMatrix);
- c.drawBitmap(bitmap, 0, 0, NULL);
+
+ // We can't call drawBitmap, or we'll infinitely recurse. Instead
+ // we manually build a shader and draw that into our new mask
+ SkPaint tmpPaint;
+ tmpPaint.setFlags(paint.getFlags());
+ SkAutoBitmapShaderInstall install(bitmap, &tmpPaint);
+ SkRect rr;
+ rr.set(0, 0, SkIntToScalar(bitmap.width()),
+ SkIntToScalar(bitmap.height()));
+ c.drawRect(rr, tmpPaint);
}
this->drawDevMask(mask, paint);
}