diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-02-24 19:03:20 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-02-24 19:03:20 +0000 |
commit | 3469c76c40790b409621fd7eff34f56240718549 (patch) | |
tree | ebfc8f033409d4a4a42492d79a07dd454bddea8d /src/core | |
parent | ff7f389c8ad6248a10ce39459b96ba3c4bbd4daf (diff) |
Handle kA8 bitmaps drawing through a matrix (was infinitely recursive)
git-svn-id: http://skia.googlecode.com/svn/trunk@95 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkBitmapProcState.cpp | 1 | ||||
-rw-r--r-- | src/core/SkDraw.cpp | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp index aa03f59ae2..35585736dd 100644 --- a/src/core/SkBitmapProcState.cpp +++ b/src/core/SkBitmapProcState.cpp @@ -379,6 +379,7 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { case SkBitmap::kA8_Config: index |= 32; fPaintPMColor = SkPreMultiplyColor(paint.getColor()); + break; default: return false; } diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index d59b813ef5..323438b859 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 mannually 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); } |