aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathRenderer.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-05-10 06:19:21 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-10 06:19:21 -0700
commit85d9667f59d4138438427bb2cdf67992d100e1a0 (patch)
tree1d86fd1d78a1bdd36f6b250bf31dd285986db5ef /src/gpu/GrPathRenderer.h
parent00e9452791a80ed9fb824214b259ecb9af0c25c6 (diff)
Revert of Replace GrStrokeInfo with GrStyle. (patchset #4 id:160001 of https://codereview.chromium.org/1957363002/ )
Reason for revert: Breaking some bots Original issue's description: > Replace GrStrokeInfo with GrStyle. > > A side effect is that arbitrary path effects can no be pushed deeper into the Ganesh flow for paths. They may be applied by path renderers. > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1957363002 > > Committed: https://skia.googlesource.com/skia/+/33595bdf4b64a745f6340338d307e806e96c587f TBR=egdaniel@google.com,robertphillips@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/1967513002
Diffstat (limited to 'src/gpu/GrPathRenderer.h')
-rw-r--r--src/gpu/GrPathRenderer.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index 3bc02306e6..1072f69649 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -10,12 +10,13 @@
#include "GrDrawTarget.h"
#include "GrStencil.h"
-#include "GrStyle.h"
+#include "GrStrokeInfo.h"
#include "SkDrawProcs.h"
#include "SkTArray.h"
class SkPath;
+
struct GrPoint;
/**
@@ -71,14 +72,14 @@ public:
* fPipelineBuilder The pipelineBuilder
* fViewMatrix The viewMatrix
* fPath The path to draw
- * fStyle The styling info (path effect, stroking info)
+ * fStroke The stroke information (width, join, cap)
* fAntiAlias True if anti-aliasing is required.
*/
struct CanDrawPathArgs {
const GrShaderCaps* fShaderCaps;
const SkMatrix* fViewMatrix;
const SkPath* fPath;
- const GrStyle* fStyle;
+ const GrStrokeInfo* fStroke;
bool fAntiAlias;
// These next two are only used by GrStencilAndCoverPathRenderer
@@ -89,7 +90,7 @@ public:
SkASSERT(fShaderCaps);
SkASSERT(fViewMatrix);
SkASSERT(fPath);
- SkASSERT(fStyle);
+ SkASSERT(fStroke);
SkASSERT(!fPath->isEmpty());
}
};
@@ -115,7 +116,7 @@ public:
* fColor Color to render with
* fViewMatrix The viewMatrix
* fPath the path to draw.
- * fStyle the style information (path effect, stroke info)
+ * fStroke the stroke information (width, join, cap)
* fAntiAlias true if anti-aliasing is required.
* fGammaCorrect true if gamma-correct rendering is to be used.
*/
@@ -126,7 +127,7 @@ public:
GrColor fColor;
const SkMatrix* fViewMatrix;
const SkPath* fPath;
- const GrStyle* fStyle;
+ const GrStrokeInfo* fStroke;
bool fAntiAlias;
bool fGammaCorrect;
@@ -136,7 +137,7 @@ public:
SkASSERT(fPipelineBuilder);
SkASSERT(fViewMatrix);
SkASSERT(fPath);
- SkASSERT(fStyle);
+ SkASSERT(fStroke);
SkASSERT(!fPath->isEmpty());
}
};
@@ -152,7 +153,7 @@ public:
canArgs.fShaderCaps = args.fTarget->caps()->shaderCaps();
canArgs.fViewMatrix = args.fViewMatrix;
canArgs.fPath = args.fPath;
- canArgs.fStyle = args.fStyle;
+ canArgs.fStroke = args.fStroke;
canArgs.fAntiAlias = args.fAntiAlias;
canArgs.fIsStencilDisabled = args.fPipelineBuilder->getStencil().isDisabled();
@@ -161,7 +162,8 @@ public:
SkASSERT(this->canDrawPath(canArgs));
if (!args.fPipelineBuilder->getStencil().isDisabled()) {
SkASSERT(kNoRestriction_StencilSupport == this->getStencilSupport(*args.fPath));
- SkASSERT(args.fStyle->isSimpleFill());
+ SkASSERT(!args.fStroke->isDashed());
+ SkASSERT(args.fStroke->isFillStyle());
}
#endif
return this->onDrawPath(args);
@@ -195,21 +197,22 @@ public:
/**
* Draws the path to the stencil buffer. Assume the writable stencil bits are already
* initialized to zero. The pixels inside the path will have non-zero stencil values afterwards.
+ *
*/
void stencilPath(const StencilPathArgs& args) {
SkDEBUGCODE(args.validate();)
SkASSERT(kNoSupport_StencilSupport != this->getStencilSupport(*args.fPath));
+
this->onStencilPath(args);
}
// Helper for determining if we can treat a thin stroke as a hairline w/ coverage.
// If we can, we draw lots faster (raster device does this same test).
- static bool IsStrokeHairlineOrEquivalent(const GrStyle& style, const SkMatrix& matrix,
+ static bool IsStrokeHairlineOrEquivalent(const GrStrokeInfo& stroke, const SkMatrix& matrix,
SkScalar* outCoverage) {
- if (style.pathEffect()) {
+ if (stroke.isDashed()) {
return false;
}
- const SkStrokeRec& stroke = style.strokeRec();
if (stroke.isHairlineStyle()) {
if (outCoverage) {
*outCoverage = SK_Scalar1;
@@ -276,12 +279,13 @@ private:
drawArgs.fColor = 0xFFFFFFFF;
drawArgs.fViewMatrix = args.fViewMatrix;
drawArgs.fPath = args.fPath;
- drawArgs.fStyle = &GrStyle::SimpleFill();
+ drawArgs.fStroke = &GrStrokeInfo::FillInfo();
drawArgs.fAntiAlias = false;
drawArgs.fGammaCorrect = false;
this->drawPath(drawArgs);
}
+
typedef SkRefCnt INHERITED;
};