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

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

Issue 1967513002: Revert of Replace GrStrokeInfo with GrStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@resscale
Patch Set: Created 4 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 05460187ef989f6fdffbe9e3eabeeb355b9b214f..ed5a31d9d2f67bf97d90c702c8d2327160e79e48 100644
--- a/src/gpu/gl/GrGLPath.cpp
+++ b/src/gpu/gl/GrGLPath.cpp
@@ -8,7 +8,6 @@
#include "GrGLPath.h"
#include "GrGLPathRendering.h"
#include "GrGLGpu.h"
-#include "GrStyle.h"
namespace {
inline GrGLubyte verb_to_gl_path_cmd(SkPath::Verb verb) {
@@ -252,7 +251,9 @@
SkAssertResult(init_path_object_for_general_path<false>(gpu, pathID, skPath));
}
-void GrGLPath::InitPathObjectStroke(GrGLGpu* gpu, GrGLuint pathID, const SkStrokeRec& stroke) {
+void GrGLPath::InitPathObjectStroke(GrGLGpu* gpu, GrGLuint pathID, const GrStrokeInfo& stroke) {
+ SkASSERT(stroke.needToApply());
+ SkASSERT(!stroke.isDashed());
SkASSERT(!stroke.isHairlineStyle());
GR_GL_CALL(gpu->glInterface(),
PathParameterf(pathID, GR_GL_PATH_STROKE_WIDTH, SkScalarToFloat(stroke.getWidth())));
@@ -269,8 +270,8 @@
GR_GL_CALL(gpu->glInterface(), PathCommands(pathID, 0, nullptr, 0, GR_GL_FLOAT, nullptr));
}
-GrGLPath::GrGLPath(GrGLGpu* gpu, const SkPath& origSkPath, const GrStyle& style)
- : INHERITED(gpu, origSkPath, style),
+GrGLPath::GrGLPath(GrGLGpu* gpu, const SkPath& origSkPath, const GrStrokeInfo& origStroke)
+ : INHERITED(gpu, origSkPath, origStroke),
fPathID(gpu->glPathRendering()->genPaths(1)) {
if (origSkPath.isEmpty()) {
@@ -280,21 +281,21 @@
} else {
const SkPath* skPath = &origSkPath;
SkTLazy<SkPath> tmpPath;
- SkStrokeRec stroke(SkStrokeRec::kFill_InitStyle);
-
- if (style.pathEffect()) {
+ const GrStrokeInfo* stroke = &origStroke;
+ GrStrokeInfo tmpStroke(SkStrokeRec::kFill_InitStyle);
+
+ if (stroke->isDashed()) {
// Skia stroking and NVPR stroking differ with respect to dashing
// pattern.
- // Convert a dashing (or other path effect) to either a stroke or a fill.
- if (style.applyPathEffectToPath(tmpPath.init(), &stroke, *skPath, SK_Scalar1)) {
+ // Convert a dashing to either a stroke or a fill.
+ if (stroke->applyDashToPath(tmpPath.init(), &tmpStroke, *skPath)) {
skPath = tmpPath.get();
+ stroke = &tmpStroke;
}
- } else {
- stroke = style.strokeRec();
}
bool didInit = false;
- if (stroke.needToApply() && stroke.getCap() != SkPaint::kButt_Cap) {
+ if (stroke->needToApply() && stroke->getCap() != SkPaint::kButt_Cap) {
// Skia stroking and NVPR stroking differ with respect to stroking
// end caps of empty subpaths.
// Convert stroke to fill if path contains empty subpaths.
@@ -303,9 +304,10 @@
if (!tmpPath.isValid()) {
tmpPath.init();
}
- SkAssertResult(stroke.applyToPath(tmpPath.get(), *skPath));
+ SkAssertResult(stroke->applyToPath(tmpPath.get(), *skPath));
skPath = tmpPath.get();
- stroke.setFillStyle();
+ tmpStroke.setFillStyle();
+ stroke = &tmpStroke;
}
}
@@ -313,16 +315,18 @@
InitPathObjectPathData(gpu, fPathID, *skPath);
}
- fShouldStroke = stroke.needToApply();
- fShouldFill = stroke.isFillStyle() ||
- stroke.getStyle() == SkStrokeRec::kStrokeAndFill_Style;
+ fShouldStroke = stroke->needToApply();
+ fShouldFill = stroke->isFillStyle() ||
+ stroke->getStyle() == SkStrokeRec::kStrokeAndFill_Style;
fFillType = convert_skpath_filltype(skPath->getFillType());
fBounds = skPath->getBounds();
- SkScalar radius = stroke.getInflationRadius();
- fBounds.outset(radius, radius);
+
if (fShouldStroke) {
- InitPathObjectStroke(gpu, fPathID, stroke);
+ InitPathObjectStroke(gpu, fPathID, *stroke);
+
+ // FIXME: try to account for stroking, without rasterizing the stroke.
+ fBounds.outset(stroke->getWidth(), stroke->getWidth());
}
}
« 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