aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDraw.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkDraw.cpp')
-rw-r--r--src/core/SkDraw.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index cdd59c1cdb..885a810836 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -931,16 +931,13 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
// at this point we're done with prePathMatrix
SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;)
- const SkPaint* paint = &origPaint;
- SkTLazy<SkPaint> lazyPaint;
+ SkTCopyOnFirstWrite<SkPaint> paint(origPaint);
{
SkScalar coverage;
if (SkDrawTreatAsHairline(origPaint, *matrix, &coverage)) {
if (SK_Scalar1 == coverage) {
- lazyPaint.set(origPaint);
- lazyPaint.get()->setStrokeWidth(0);
- paint = lazyPaint.get();
+ paint.writable()->setStrokeWidth(0);
} else if (xfermodeSupportsCoverageAsAlpha(origPaint.getXfermode())) {
U8CPU newAlpha;
#if 0
@@ -953,10 +950,9 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
int scale = (int)SkScalarMul(coverage, 256);
newAlpha = origPaint.getAlpha() * scale >> 8;
#endif
- lazyPaint.set(origPaint);
- lazyPaint.get()->setStrokeWidth(0);
- lazyPaint.get()->setAlpha(newAlpha);
- paint = lazyPaint.get();
+ SkPaint* writablePaint = paint.writable();
+ writablePaint->setStrokeWidth(0);
+ writablePaint->setAlpha(newAlpha);
}
}
}