Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 118143002: Initialize writen paths and strokerecs lazily during GPU drawPath (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 36e76e99409e2975d9581e44a2ce038dc68c0787..5ba174cafcc53e9f483b7844c1f1d98b173629ac 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -877,13 +877,14 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
// where the original path can in fact be modified in place (even though
// its parameter type is const).
SkPath* pathPtr = const_cast<SkPath*>(&origSrcPath);
- SkPath tmpPath, effectPath;
+ SkTLazy<SkPath> tmpPath;
+ SkTLazy<SkPath> effectPath;
if (prePathMatrix) {
SkPath* result = pathPtr;
if (!pathIsMutable) {
- result = &tmpPath;
+ result = tmpPath.init();
pathIsMutable = true;
}
// should I push prePathMatrix on our MV stack temporarily, instead
@@ -897,22 +898,24 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
SkStrokeRec stroke(paint);
SkPathEffect* pathEffect = paint.getPathEffect();
const SkRect* cullRect = NULL; // TODO: what is our bounds?
- if (pathEffect && pathEffect->filterPath(&effectPath, *pathPtr, &stroke,
+ if (pathEffect && pathEffect->filterPath(effectPath.init(), *pathPtr, &stroke,
cullRect)) {
- pathPtr = &effectPath;
+ pathPtr = effectPath.get();
+ pathIsMutable = true;
}
if (paint.getMaskFilter()) {
if (!stroke.isHairlineStyle()) {
- if (stroke.applyToPath(&tmpPath, *pathPtr)) {
- pathPtr = &tmpPath;
+ SkPath* strokedPath = pathIsMutable ? pathPtr : tmpPath.init();
+ if (stroke.applyToPath(strokedPath, *pathPtr)) {
+ pathPtr = strokedPath;
pathIsMutable = true;
stroke.setFillStyle();
}
}
// avoid possibly allocating a new path in transform if we can
- SkPath* devPathPtr = pathIsMutable ? pathPtr : &tmpPath;
+ SkPath* devPathPtr = pathIsMutable ? pathPtr : tmpPath.init();
// transform the path into device space
pathPtr->transform(fContext->getMatrix(), devPathPtr);
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698