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

Unified Diff: src/gpu/GrSoftwarePathRenderer.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/GrSoftwarePathRenderer.h ('k') | src/gpu/GrStencilAndCoverPathRenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrSoftwarePathRenderer.cpp
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 8eb66d81bf14e02eff581912f4a1978e0c523fef..90b35f7431a38e2e0f382c67757e796ff38d5238 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -13,6 +13,7 @@
////////////////////////////////////////////////////////////////////////////////
bool GrSoftwarePathRenderer::canDrawPath(const GrDrawTarget*,
const GrDrawState*,
+ const SkMatrix& viewMatrix,
const SkPath&,
const SkStrokeRec&,
bool antiAlias) const {
@@ -79,36 +80,34 @@ bool get_path_and_clip_bounds(const GrDrawTarget* target,
void draw_around_inv_path(GrDrawTarget* target,
GrDrawState* drawState,
GrColor color,
+ const SkMatrix& viewMatrix,
const SkIRect& devClipBounds,
const SkIRect& devPathBounds) {
- const SkMatrix& matrix = drawState->getViewMatrix();
SkMatrix invert;
- if (!matrix.invert(&invert)) {
+ if (!viewMatrix.invert(&invert)) {
return;
}
- GrDrawState::AutoViewMatrixRestore avmr(drawState);
-
SkRect rect;
if (devClipBounds.fTop < devPathBounds.fTop) {
rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
devClipBounds.fRight, devPathBounds.fTop);
- target->drawRect(drawState, color, rect, NULL, &invert);
+ target->drawRect(drawState, color, SkMatrix::I(), rect, NULL, &invert);
}
if (devClipBounds.fLeft < devPathBounds.fLeft) {
rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
devPathBounds.fLeft, devPathBounds.fBottom);
- target->drawRect(drawState, color, rect, NULL, &invert);
+ target->drawRect(drawState, color, SkMatrix::I(), rect, NULL, &invert);
}
if (devClipBounds.fRight > devPathBounds.fRight) {
rect.iset(devPathBounds.fRight, devPathBounds.fTop,
devClipBounds.fRight, devPathBounds.fBottom);
- target->drawRect(drawState, color, rect, NULL, &invert);
+ target->drawRect(drawState, color, SkMatrix::I(), rect, NULL, &invert);
}
if (devClipBounds.fBottom > devPathBounds.fBottom) {
rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
devClipBounds.fRight, devClipBounds.fBottom);
- target->drawRect(drawState, color, rect, NULL, &invert);
+ target->drawRect(drawState, color, SkMatrix::I(), rect, NULL, &invert);
}
}
@@ -119,6 +118,7 @@ void draw_around_inv_path(GrDrawTarget* target,
bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target,
GrDrawState* drawState,
GrColor color,
+ const SkMatrix& viewMatrix,
const SkPath& path,
const SkStrokeRec& stroke,
bool antiAlias) {
@@ -127,13 +127,11 @@ bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target,
return false;
}
- SkMatrix vm = drawState->getViewMatrix();
-
SkIRect devPathBounds, devClipBounds;
- if (!get_path_and_clip_bounds(target, drawState, path, vm,
+ if (!get_path_and_clip_bounds(target, drawState, path, viewMatrix,
&devPathBounds, &devClipBounds)) {
if (path.isInverseFillType()) {
- draw_around_inv_path(target, drawState, color, devClipBounds, devPathBounds);
+ draw_around_inv_path(target, drawState, color, viewMatrix, devClipBounds,devPathBounds);
}
return true;
}
@@ -141,16 +139,17 @@ bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target,
SkAutoTUnref<GrTexture> texture(
GrSWMaskHelper::DrawPathMaskToTexture(fContext, path, stroke,
devPathBounds,
- antiAlias, &vm));
+ antiAlias, &viewMatrix));
if (NULL == texture) {
return false;
}
GrDrawState copy = *drawState;
- GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, &copy, color, devPathBounds);
+ GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, &copy, color, viewMatrix,
+ devPathBounds);
if (path.isInverseFillType()) {
- draw_around_inv_path(target, drawState, color, devClipBounds, devPathBounds);
+ draw_around_inv_path(target, drawState, color, viewMatrix, devClipBounds, devPathBounds);
}
return true;
« no previous file with comments | « src/gpu/GrSoftwarePathRenderer.h ('k') | src/gpu/GrStencilAndCoverPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698