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

Unified Diff: src/gpu/GrSoftwarePathRenderer.cpp

Issue 732693002: Drawstate on stack (Closed) Base URL: https://skia.googlesource.com/skia.git@real_def_gp
Patch Set: tiny fix Created 6 years, 1 month 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 0d3ef62dc29b3452610e5f11900a0e131419daff..9a9cf328c88d3d286de4734847175da314e2e8e5 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -11,9 +11,10 @@
#include "GrSWMaskHelper.h"
////////////////////////////////////////////////////////////////////////////////
-bool GrSoftwarePathRenderer::canDrawPath(const SkPath&,
+bool GrSoftwarePathRenderer::canDrawPath(const GrDrawTarget*,
+ const GrDrawState*,
+ const SkPath&,
const SkStrokeRec&,
- const GrDrawTarget*,
bool antiAlias) const {
if (NULL == fContext) {
return false;
@@ -22,10 +23,11 @@ bool GrSoftwarePathRenderer::canDrawPath(const SkPath&,
return true;
}
-GrPathRenderer::StencilSupport GrSoftwarePathRenderer::onGetStencilSupport(
- const SkPath&,
- const SkStrokeRec&,
- const GrDrawTarget*) const {
+GrPathRenderer::StencilSupport
+GrSoftwarePathRenderer::onGetStencilSupport(const GrDrawTarget*,
+ const GrDrawState*,
+ const SkPath&,
+ const SkStrokeRec&) const {
return GrPathRenderer::kNoSupport_StencilSupport;
}
@@ -36,12 +38,13 @@ namespace {
// path bounds will be a subset of the clip bounds. returns false if
// path bounds would be empty.
bool get_path_and_clip_bounds(const GrDrawTarget* target,
+ const GrDrawState* drawState,
const SkPath& path,
const SkMatrix& matrix,
SkIRect* devPathBounds,
SkIRect* devClipBounds) {
// compute bounds as intersection of rt size, clip, and path
- const GrRenderTarget* rt = target->getDrawState().getRenderTarget();
+ const GrRenderTarget* rt = drawState->getRenderTarget();
if (NULL == rt) {
return false;
}
@@ -74,32 +77,33 @@ bool get_path_and_clip_bounds(const GrDrawTarget* target,
////////////////////////////////////////////////////////////////////////////////
void draw_around_inv_path(GrDrawTarget* target,
+ GrDrawState* drawState,
const SkIRect& devClipBounds,
const SkIRect& devPathBounds) {
GrDrawState::AutoViewMatrixRestore avmr;
- if (!avmr.setIdentity(target->drawState())) {
+ if (!avmr.setIdentity(drawState)) {
return;
}
SkRect rect;
if (devClipBounds.fTop < devPathBounds.fTop) {
rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
devClipBounds.fRight, devPathBounds.fTop);
- target->drawSimpleRect(rect);
+ target->drawSimpleRect(drawState, rect);
}
if (devClipBounds.fLeft < devPathBounds.fLeft) {
rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
devPathBounds.fLeft, devPathBounds.fBottom);
- target->drawSimpleRect(rect);
+ target->drawSimpleRect(drawState, rect);
}
if (devClipBounds.fRight > devPathBounds.fRight) {
rect.iset(devPathBounds.fRight, devPathBounds.fTop,
devClipBounds.fRight, devPathBounds.fBottom);
- target->drawSimpleRect(rect);
+ target->drawSimpleRect(drawState, rect);
}
if (devClipBounds.fBottom > devPathBounds.fBottom) {
rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
devClipBounds.fRight, devClipBounds.fBottom);
- target->drawSimpleRect(rect);
+ target->drawSimpleRect(drawState, rect);
}
}
@@ -107,24 +111,23 @@ void draw_around_inv_path(GrDrawTarget* target,
////////////////////////////////////////////////////////////////////////////////
// return true on success; false on failure
-bool GrSoftwarePathRenderer::onDrawPath(const SkPath& path,
+bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target,
+ GrDrawState* drawState,
+ const SkPath& path,
const SkStrokeRec& stroke,
- GrDrawTarget* target,
bool antiAlias) {
if (NULL == fContext) {
return false;
}
- GrDrawState* drawState = target->drawState();
-
SkMatrix vm = drawState->getViewMatrix();
SkIRect devPathBounds, devClipBounds;
- if (!get_path_and_clip_bounds(target, path, vm,
+ if (!get_path_and_clip_bounds(target, drawState, path, vm,
&devPathBounds, &devClipBounds)) {
if (path.isInverseFillType()) {
- draw_around_inv_path(target, devClipBounds, devPathBounds);
+ draw_around_inv_path(target, drawState, devClipBounds, devPathBounds);
}
return true;
}
@@ -137,10 +140,11 @@ bool GrSoftwarePathRenderer::onDrawPath(const SkPath& path,
return false;
}
- GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, devPathBounds);
+ GrDrawState copy = *drawState;
+ GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, &copy, devPathBounds);
if (path.isInverseFillType()) {
- draw_around_inv_path(target, devClipBounds, devPathBounds);
+ draw_around_inv_path(target, drawState, 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