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

Unified Diff: src/gpu/GrContext.cpp

Issue 1128113008: Make GrStrokeInfo inherit from SkStrokeRec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address review comments 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/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »
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 266ed57e13b85980d9129155990c9272e3e4280c..1863b7f9628c3d645cb68f743096a74548ccb2ef 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -595,7 +595,7 @@ void GrContext::drawRect(GrRenderTarget* rt,
}
GR_CREATE_TRACE_MARKER("GrContext::drawRect", target);
- SkScalar width = NULL == strokeInfo ? -1 : strokeInfo->getStrokeRec().getWidth();
+ SkScalar width = NULL == strokeInfo ? -1 : strokeInfo->getWidth();
// Check if this is a full RT draw and can be replaced with a clear. We don't bother checking
// cases where the RT is fully inside a stroke.
@@ -639,14 +639,13 @@ void GrContext::drawRect(GrRenderTarget* rt,
if (doAA) {
if (width >= 0) {
- const SkStrokeRec& strokeRec = strokeInfo->getStrokeRec();
fAARectRenderer->strokeAARect(target,
&pipelineBuilder,
color,
viewMatrix,
rect,
devBoundRect,
- strokeRec);
+ *strokeInfo);
} else {
// filled AA rect
fAARectRenderer->fillAARect(target,
@@ -1060,8 +1059,6 @@ void GrContext::drawRRect(GrRenderTarget*rt,
GR_CREATE_TRACE_MARKER("GrContext::drawRRect", target);
- const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec();
-
GrColor color = paint.getColor();
if (!fOvalRenderer->drawRRect(target,
&pipelineBuilder,
@@ -1069,7 +1066,7 @@ void GrContext::drawRRect(GrRenderTarget*rt,
viewMatrix,
paint.isAntiAlias(),
rrect,
- strokeRec)) {
+ strokeInfo)) {
SkPath path;
path.addRRect(rrect);
this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, paint.isAntiAlias(),
@@ -1144,8 +1141,6 @@ void GrContext::drawOval(GrRenderTarget* rt,
GR_CREATE_TRACE_MARKER("GrContext::drawOval", target);
- const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec();
-
GrColor color = paint.getColor();
if (!fOvalRenderer->drawOval(target,
&pipelineBuilder,
@@ -1153,7 +1148,7 @@ void GrContext::drawOval(GrRenderTarget* rt,
viewMatrix,
paint.isAntiAlias(),
oval,
- strokeRec)) {
+ strokeInfo)) {
SkPath path;
path.addOval(oval);
this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, paint.isAntiAlias(),
@@ -1245,15 +1240,14 @@ void GrContext::drawPath(GrRenderTarget* rt,
GR_CREATE_TRACE_MARKER1("GrContext::drawPath", target, "Is Convex", path.isConvex());
if (!strokeInfo.isDashed()) {
- const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec();
bool useCoverageAA = paint.isAntiAlias() &&
!pipelineBuilder.getRenderTarget()->isMultisampled();
- if (useCoverageAA && strokeRec.getWidth() < 0 && !path.isConvex()) {
+ if (useCoverageAA && strokeInfo.getWidth() < 0 && !path.isConvex()) {
// Concave AA paths are expensive - try to avoid them for special cases
SkRect rects[2];
- if (is_nested_rects(target, &pipelineBuilder, color, viewMatrix, path, strokeRec,
+ if (is_nested_rects(target, &pipelineBuilder, color, viewMatrix, path, strokeInfo,
rects)) {
fAARectRenderer->fillAANestedRects(target, &pipelineBuilder, color, viewMatrix,
rects);
@@ -1270,7 +1264,7 @@ void GrContext::drawPath(GrRenderTarget* rt,
viewMatrix,
paint.isAntiAlias(),
ovalRect,
- strokeRec)) {
+ strokeInfo)) {
return;
}
}
@@ -1315,7 +1309,7 @@ void GrContext::internalDrawPath(GrDrawTarget* target,
GrStrokeInfo dashlessStrokeInfo(strokeInfo, false);
if (NULL == pr && strokeInfo.isDashed()) {
// It didn't work above, so try again with dashed stroke converted to a dashless stroke.
- if (!strokeInfo.applyDash(tmpPath.init(), &dashlessStrokeInfo, *pathPtr)) {
+ if (!strokeInfo.applyDashToPath(tmpPath.init(), &dashlessStrokeInfo, *pathPtr)) {
return;
}
pathPtr = tmpPath.get();
@@ -1334,16 +1328,15 @@ void GrContext::internalDrawPath(GrDrawTarget* target,
if (!tmpPath.isValid()) {
tmpPath.init();
}
- SkStrokeRec* strokeRec = dashlessStrokeInfo.getStrokeRecPtr();
- strokeRec->setResScale(SkScalarAbs(viewMatrix.getMaxScale()));
- if (!strokeRec->applyToPath(tmpPath.get(), *pathPtr)) {
+ dashlessStrokeInfo.setResScale(SkScalarAbs(viewMatrix.getMaxScale()));
+ if (!dashlessStrokeInfo.applyToPath(tmpPath.get(), *pathPtr)) {
return;
}
pathPtr = tmpPath.get();
if (pathPtr->isEmpty()) {
return;
}
- strokeRec->setFillStyle();
+ dashlessStrokeInfo.setFillStyle();
strokeInfoPtr = &dashlessStrokeInfo;
}
« no previous file with comments | « src/gpu/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698