Index: src/core/SkDraw.cpp |
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp |
index 34c7d73b3ed1852342ad7a924ccc7a8a698b04fb..53c8e5f0e886a7f93a217213cb5b36ee4571ab52 100644 |
--- a/src/core/SkDraw.cpp |
+++ b/src/core/SkDraw.cpp |
@@ -1302,8 +1302,10 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix, |
return; |
} |
- SkPaint paint(origPaint); |
- paint.setStyle(SkPaint::kFill_Style); |
+ SkTCopyOnFirstWrite<SkPaint> paint(origPaint); |
+ if (origPaint.getStyle() != SkPaint::kFill_Style) { |
+ paint.writable()->setStyle(SkPaint::kFill_Style); |
+ } |
SkMatrix matrix; |
matrix.setConcat(*fMatrix, prematrix); |
@@ -1313,7 +1315,7 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix, |
} |
if (bitmap.colorType() != kAlpha_8_SkColorType |
- && SkTreatAsSprite(matrix, bitmap.dimensions(), paint)) { |
+ && SkTreatAsSprite(matrix, bitmap.dimensions(), *paint)) { |
// |
// It is safe to call lock pixels now, since we know the matrix is |
// (more or less) identity. |
@@ -1328,7 +1330,7 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix, |
if (clipHandlesSprite(*fRC, ix, iy, pmap)) { |
SkTBlitterAllocator allocator; |
// blitter will be owned by the allocator. |
- SkBlitter* blitter = SkBlitter::ChooseSprite(fDst, paint, pmap, ix, iy, &allocator); |
+ SkBlitter* blitter = SkBlitter::ChooseSprite(fDst, *paint, pmap, ix, iy, &allocator); |
if (blitter) { |
SkScan::FillIRect(SkIRect::MakeXYWH(ix, iy, pmap.width(), pmap.height()), |
*fRC, blitter); |
@@ -1344,9 +1346,9 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix, |
draw.fMatrix = &matrix; |
if (bitmap.colorType() == kAlpha_8_SkColorType) { |
- draw.drawBitmapAsMask(bitmap, paint); |
+ draw.drawBitmapAsMask(bitmap, *paint); |
} else { |
- SkAutoBitmapShaderInstall install(bitmap, paint); |
+ SkAutoBitmapShaderInstall install(bitmap, *paint); |
const SkPaint& paintWithShader = install.paintWithShader(); |
const SkRect srcBounds = SkRect::MakeIWH(bitmap.width(), bitmap.height()); |
if (dstBounds) { |