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

Unified Diff: src/gpu/GrAARectRenderer.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/GrAARectRenderer.h ('k') | src/gpu/GrBitmapTextContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAARectRenderer.cpp
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index f748895ba807ac51d8ab9b67e9a36016cc1f069d..edb59d04d85361fea960930484974d0c64e9ee20 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -177,10 +177,10 @@ GrIndexBuffer* GrAARectRenderer::aaStrokeRectIndexBuffer(bool miterStroke) {
}
void GrAARectRenderer::geometryFillAARect(GrDrawTarget* target,
+ GrDrawState* drawState,
const SkRect& rect,
const SkMatrix& combinedMatrix,
const SkRect& devRect) {
- GrDrawState* drawState = target->drawState();
GrDrawState::AutoRestoreEffects are(drawState);
GrColor color = drawState->getColor();
@@ -190,7 +190,7 @@ void GrAARectRenderer::geometryFillAARect(GrDrawTarget* target,
drawState->setHint(GrDrawState::kVertexColorsAreOpaque_Hint, true);
}
- GrDrawTarget::AutoReleaseGeometry geo(target, 8, 0);
+ GrDrawTarget::AutoReleaseGeometry geo(target, 8, drawState->getVertexStride(), 0);
if (!geo.succeeded()) {
SkDebugf("Failed to get space for vertices!\n");
return;
@@ -300,13 +300,16 @@ void GrAARectRenderer::geometryFillAARect(GrDrawTarget* target,
}
target->setIndexSourceToBuffer(indexBuffer);
- target->drawIndexedInstances(kTriangles_GrPrimitiveType, 1,
+ target->drawIndexedInstances(drawState,
+ kTriangles_GrPrimitiveType,
+ 1,
kVertsPerAAFillRect,
kIndicesPerAAFillRect);
target->resetIndexSource();
}
void GrAARectRenderer::strokeAARect(GrDrawTarget* target,
+ GrDrawState* drawState,
const SkRect& rect,
const SkMatrix& combinedMatrix,
const SkRect& devRect,
@@ -353,7 +356,7 @@ void GrAARectRenderer::strokeAARect(GrDrawTarget* target,
}
if (spare <= 0 && miterStroke) {
- this->fillAARect(target, devOutside, SkMatrix::I(), devOutside);
+ this->fillAARect(target, drawState, devOutside, SkMatrix::I(), devOutside);
return;
}
@@ -370,17 +373,17 @@ void GrAARectRenderer::strokeAARect(GrDrawTarget* target,
devOutsideAssist.outset(0, ry);
}
- this->geometryStrokeAARect(target, devOutside, devOutsideAssist, devInside, miterStroke);
+ this->geometryStrokeAARect(target, drawState, devOutside, devOutsideAssist, devInside,
+ miterStroke);
}
void GrAARectRenderer::geometryStrokeAARect(GrDrawTarget* target,
+ GrDrawState* drawState,
const SkRect& devOutside,
const SkRect& devOutsideAssist,
const SkRect& devInside,
bool miterStroke) {
- GrDrawState* drawState = target->drawState();
GrDrawState::AutoRestoreEffects are(drawState);
-
CoverageAttribType covAttribType = set_rect_attribs(drawState);
GrColor color = drawState->getColor();
@@ -392,7 +395,7 @@ void GrAARectRenderer::geometryStrokeAARect(GrDrawTarget* target,
int outerVertexNum = miterStroke ? 4 : 8;
int totalVertexNum = (outerVertexNum + innerVertexNum) * 2;
- GrDrawTarget::AutoReleaseGeometry geo(target, totalVertexNum, 0);
+ GrDrawTarget::AutoReleaseGeometry geo(target, totalVertexNum, drawState->getVertexStride(), 0);
if (!geo.succeeded()) {
SkDebugf("Failed to get space for vertices!\n");
return;
@@ -499,12 +502,16 @@ void GrAARectRenderer::geometryStrokeAARect(GrDrawTarget* target,
}
target->setIndexSourceToBuffer(indexBuffer);
- target->drawIndexedInstances(kTriangles_GrPrimitiveType, 1,
- totalVertexNum, aa_stroke_rect_index_count(miterStroke));
+ target->drawIndexedInstances(drawState,
+ kTriangles_GrPrimitiveType,
+ 1,
+ totalVertexNum,
+ aa_stroke_rect_index_count(miterStroke));
target->resetIndexSource();
}
void GrAARectRenderer::fillAANestedRects(GrDrawTarget* target,
+ GrDrawState* drawState,
const SkRect rects[2],
const SkMatrix& combinedMatrix) {
SkASSERT(combinedMatrix.rectStaysRect());
@@ -516,9 +523,9 @@ void GrAARectRenderer::fillAANestedRects(GrDrawTarget* target,
combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2);
if (devInside.isEmpty()) {
- this->fillAARect(target, devOutside, SkMatrix::I(), devOutside);
+ this->fillAARect(target, drawState, devOutside, SkMatrix::I(), devOutside);
return;
}
- this->geometryStrokeAARect(target, devOutside, devOutsideAssist, devInside, true);
+ this->geometryStrokeAARect(target, drawState, devOutside, devOutsideAssist, devInside, true);
}
« no previous file with comments | « src/gpu/GrAARectRenderer.h ('k') | src/gpu/GrBitmapTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698