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

Unified Diff: src/gpu/GrAAConvexPathRenderer.cpp

Issue 815553003: Move ViewMatrix off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@remove-fragment-stage
Patch Set: more claenup Created 6 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
Index: src/gpu/GrAAConvexPathRenderer.cpp
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 3a344ce0b8130f9f4a90c3f8bdc4641bb345cbcb..bd4085f2c2f550dd8f7e04a5257df8b49ba9dba7 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -505,8 +505,10 @@ static void create_vertices(const SegmentArray& segments,
class QuadEdgeEffect : public GrGeometryProcessor {
public:
- static GrGeometryProcessor* Create(GrColor color, const SkMatrix& localMatrix) {
- return SkNEW_ARGS(QuadEdgeEffect, (color, localMatrix));
+ static GrGeometryProcessor* Create(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkMatrix& localMatrix) {
+ return SkNEW_ARGS(QuadEdgeEffect, (color, viewMatrix, localMatrix));
}
virtual ~QuadEdgeEffect() {}
@@ -626,8 +628,8 @@ public:
}
private:
- QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix)
- : INHERITED(color, false, localMatrix) {
+ QuadEdgeEffect(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& localMatrix)
+ : INHERITED(color, viewMatrix, localMatrix) {
this->initClassID<QuadEdgeEffect>();
fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVertexAttribType));
fInQuadEdge = &this->addVertexAttrib(GrAttribute("inQuadEdge", kVec4f_GrVertexAttribType));
@@ -664,6 +666,7 @@ GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random,
// Doesn't work without derivative instructions.
return caps.shaderDerivativeSupport() ?
QuadEdgeEffect::Create(GrRandomColor(random),
+ GrProcessorUnitTest::TestMatrix(random),
GrProcessorUnitTest::TestMatrix(random)) : NULL;
}
@@ -671,6 +674,7 @@ GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random,
bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target,
const GrDrawState*,
+ const SkMatrix& viewMatrix,
const SkPath& path,
const SkStrokeRec& stroke,
bool antiAlias) const {
@@ -681,6 +685,7 @@ bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target,
bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target,
GrDrawState* drawState,
GrColor color,
+ const SkMatrix& vm,
const SkPath& origPath,
const SkStrokeRec&,
bool antiAlias) {
@@ -690,14 +695,12 @@ bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target,
return true;
}
- SkMatrix viewMatrix = drawState->getViewMatrix();
+ SkMatrix viewMatrix = vm;
SkMatrix invert;
if (!viewMatrix.invert(&invert)) {
return false;
}
- GrDrawState::AutoViewMatrixRestore avmr(drawState);
-
// We use the fact that SkPath::transform path does subdivision based on
// perspective. Otherwise, we apply the view matrix when copying to the
// segment representation.
@@ -730,7 +733,9 @@ bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target,
// Our computed verts should all be within one pixel of the segment control points.
devBounds.outset(SK_Scalar1, SK_Scalar1);
- SkAutoTUnref<GrGeometryProcessor> quadProcessor(QuadEdgeEffect::Create(color, invert));
+ SkAutoTUnref<GrGeometryProcessor> quadProcessor(QuadEdgeEffect::Create(color,
+ SkMatrix::I(),
+ invert));
GrDrawTarget::AutoReleaseGeometry arg(target, vCount, quadProcessor->getVertexStride(), iCount);
SkASSERT(quadProcessor->getVertexStride() == sizeof(QuadVertex));

Powered by Google App Engine
This is Rietveld 408576698