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

Unified Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 815553003: Move ViewMatrix off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@remove-fragment-stage
Patch Set: more cleaning 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
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | src/gpu/GrOptDrawState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrInOrderDrawBuffer.cpp
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 1f4903591924b1e4dee4be321c4e7ab6f5bfb819..e6e7b8082914974c522dbc327385a57891c40198 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -69,10 +69,11 @@ static const GrGeometryProcessor* create_rect_gp(bool hasExplicitLocalCoords,
GrDefaultGeoProcFactory::kColor_GPType;
flags |= hasExplicitLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0;
if (localMatrix) {
- return GrDefaultGeoProcFactory::Create(color, flags, GrColorIsOpaque(color), 0xff,
- *localMatrix);
+ return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), *localMatrix,
+ GrColorIsOpaque(color));
} else {
- return GrDefaultGeoProcFactory::Create(color, flags, GrColorIsOpaque(color));
+ return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), SkMatrix::I(),
+ GrColorIsOpaque(color));
}
}
@@ -115,20 +116,20 @@ static inline bool cmd_has_trace_marker(uint8_t cmd) { return SkToBool(cmd & kTr
void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds,
GrColor color,
+ const SkMatrix& viewMatrix,
const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix) {
GrDrawState::AutoRestoreEffects are(ds);
// Go to device coords to allow batching across matrix changes
- SkMatrix matrix = ds->getViewMatrix();
SkMatrix invert = SkMatrix::I();
// if we have a local rect, then we apply the localMatrix directly to the localRect to generate
// vertex local coords
bool hasExplicitLocalCoords = SkToBool(localRect);
if (!hasExplicitLocalCoords) {
- if (!matrix.isIdentity() && !matrix.invert(&invert)) {
+ if (!viewMatrix.isIdentity() && !viewMatrix.invert(&invert)) {
SkDebugf("Could not invert\n");
return;
}
@@ -151,15 +152,14 @@ void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds,
return;
}
- // When the caller has provided an explicit source rect for a stage then we don't want to
- // modify that stage's matrix. Otherwise if the effect is generating its source rect from
- // the vertex positions then we have to account for the view matrix change.
- GrDrawState::AutoViewMatrixRestore avmr(ds);
-
geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vstride);
- matrix.mapPointsWithStride(geo.positions(), vstride, 4);
+ viewMatrix.mapPointsWithStride(geo.positions(), vstride, 4);
+ // When the caller has provided an explicit source rect for a stage then we don't want to
+ // modify that stage's matrix. Otherwise if the effect is generating its source rect from
+ // the vertex positions then we have to account for the view matrix
SkRect devBounds;
+
// since we already computed the dev verts, set the bounds hint. This will help us avoid
// unnecessary clipping in our onDraw().
get_vertex_bounds(geo.vertices(), vstride, 4, &devBounds);
@@ -275,7 +275,7 @@ void GrInOrderDrawBuffer::onStencilPath(const GrDrawState& ds,
(path, ds.getRenderTarget()));
sp->fScissor = scissorState;
sp->fUseHWAA = ds.isHWAntialias();
- sp->fViewMatrix = ds.getViewMatrix();
+ sp->fViewMatrix = pathProc->viewMatrix();
sp->fStencil = stencilSettings;
this->recordTraceMarkersIfNecessary();
}
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | src/gpu/GrOptDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698