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

Unified Diff: src/gpu/GrContext.cpp

Issue 118143002: Initialize writen paths and strokerecs lazily during GPU drawPath (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | « no previous file | src/gpu/SkGpuDevice.cpp » ('j') | src/gpu/SkGpuDevice.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 0eb8c5b758091a1370591da1a0cb932b7c9f08f0..f113ffc1a5cb412dd744f5ab2a237473567a17e0 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1134,7 +1134,7 @@ void GrContext::drawPath(const GrPaint& paint, const SkPath& path, const SkStrok
}
void GrContext::internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path,
- const SkStrokeRec& stroke) {
+ const SkStrokeRec& origStroke) {
SkASSERT(!path.isEmpty());
// An Assumption here is that path renderer would use some form of tweaking
@@ -1151,18 +1151,18 @@ void GrContext::internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath&
GrPathRendererChain::kColor_DrawType;
const SkPath* pathPtr = &path;
bsalomon 2013/12/18 15:20:04 Could we not use SkTCopyOnFirstWrite for tmpPath/p
Kimmo Kinnunen 2013/12/19 06:30:01 Nope. tmp path is not a *copy* the incoming path,
- SkPath tmpPath;
- SkStrokeRec strokeRec(stroke);
+ SkTLazy<SkPath> tmpPath;
+ SkTCopyOnFirstWrite<SkStrokeRec> stroke(origStroke);
// Try a 1st time without stroking the path and without allowing the SW renderer
- GrPathRenderer* pr = this->getPathRenderer(*pathPtr, strokeRec, target, false, type);
+ GrPathRenderer* pr = this->getPathRenderer(*pathPtr, *stroke, target, false, type);
if (NULL == pr) {
- if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(strokeRec, this->getMatrix(), NULL)) {
+ if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(*stroke, this->getMatrix(), NULL)) {
// It didn't work the 1st time, so try again with the stroked path
- if (strokeRec.applyToPath(&tmpPath, *pathPtr)) {
- pathPtr = &tmpPath;
- strokeRec.setFillStyle();
+ if (stroke->applyToPath(tmpPath.init(), *pathPtr)) {
+ pathPtr = tmpPath.get();
+ stroke.writable()->setFillStyle();
if (pathPtr->isEmpty()) {
return;
}
@@ -1170,7 +1170,7 @@ void GrContext::internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath&
}
// This time, allow SW renderer
- pr = this->getPathRenderer(*pathPtr, strokeRec, target, true, type);
+ pr = this->getPathRenderer(*pathPtr, *stroke, target, true, type);
}
if (NULL == pr) {
@@ -1180,7 +1180,7 @@ void GrContext::internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath&
return;
}
- pr->drawPath(*pathPtr, strokeRec, target, useCoverageAA);
+ pr->drawPath(*pathPtr, *stroke, target, useCoverageAA);
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « no previous file | src/gpu/SkGpuDevice.cpp » ('j') | src/gpu/SkGpuDevice.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698