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

Unified Diff: src/gpu/gl/GrGLPath.cpp

Issue 1116123003: Improve caching of dashed paths in GrStencilAndCoverPathRenderer (Closed) Base URL: https://skia.googlesource.com/skia.git@dashing-nvpr-01
Patch Set: Created 5 years, 7 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/gl/GrGLPath.h ('k') | src/gpu/gl/GrGLPathRange.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLPath.cpp
diff --git a/src/gpu/gl/GrGLPath.cpp b/src/gpu/gl/GrGLPath.cpp
index 6417e684f9f61b985f1061ed7c8d47adcc7efdb4..6d04f0b7226f87803323f3c95a638a65ca708c51 100644
--- a/src/gpu/gl/GrGLPath.cpp
+++ b/src/gpu/gl/GrGLPath.cpp
@@ -91,7 +91,8 @@ inline void points_to_coords(const SkPoint points[], size_t first_point, size_t
void GrGLPath::InitPathObject(GrGLGpu* gpu,
GrGLuint pathID,
const SkPath& skPath,
- const SkStrokeRec& stroke) {
+ const GrStrokeInfo& stroke) {
+ SkASSERT(!stroke.isDashed());
if (!skPath.isEmpty()) {
int verbCnt = skPath.countVerbs();
int pointCnt = skPath.countPoints();
@@ -181,16 +182,33 @@ void GrGLPath::InitPathObject(GrGLGpu* gpu,
}
}
-GrGLPath::GrGLPath(GrGLGpu* gpu, const SkPath& path, const SkStrokeRec& stroke)
- : INHERITED(gpu, path, stroke),
+GrGLPath::GrGLPath(GrGLGpu* gpu, const SkPath& origSkPath, const GrStrokeInfo& origStroke)
+ : INHERITED(gpu, origSkPath, origStroke),
fPathID(gpu->glPathRendering()->genPaths(1)) {
+ // Convert a dashing to either a stroke or a fill.
+ const SkPath* skPath = &origSkPath;
+ SkTLazy<SkPath> tmpPath;
+ const GrStrokeInfo* stroke = &origStroke;
+ GrStrokeInfo tmpStroke(SkStrokeRec::kFill_InitStyle);
+
+ if (stroke->isDashed()) {
+ if (stroke->applyDashToPath(tmpPath.init(), &tmpStroke, *skPath)) {
+ skPath = tmpPath.get();
+ stroke = &tmpStroke;
+ }
+ }
- InitPathObject(gpu, fPathID, fSkPath, stroke);
+ InitPathObject(gpu, fPathID, *skPath, *stroke);
- if (stroke.needToApply()) {
+ fShouldStroke = stroke->needToApply();
+ fShouldFill = stroke->isFillStyle() ||
+ stroke->getStyle() == SkStrokeRec::kStrokeAndFill_Style;
+
+ if (fShouldStroke) {
// FIXME: try to account for stroking, without rasterizing the stroke.
- fBounds.outset(stroke.getWidth(), stroke.getWidth());
+ fBounds.outset(stroke->getWidth(), stroke->getWidth());
}
+
this->registerWithCache();
}
« no previous file with comments | « src/gpu/gl/GrGLPath.h ('k') | src/gpu/gl/GrGLPathRange.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698