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 783763002: Initial CL to move color / coverage off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@no-static-gp
Patch Set: bug fix 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/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 7f61840d73cb39541c6cdf98152f758ba6d6b86e..0cf757502e45e326bee841db0a898b88900e9871 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -25,16 +25,16 @@ enum CoverageAttribType {
};
}
-static CoverageAttribType set_rect_attribs(GrDrawState* drawState) {
+static CoverageAttribType set_rect_attribs(GrDrawState* drawState, GrColor color) {
uint32_t flags = GrDefaultGeoProcFactory::kColor_GPType;
if (drawState->canTweakAlphaForCoverage()) {
- drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(flags))->unref();
+ drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(color, flags))->unref();
SkASSERT(drawState->getGeometryProcessor()->getVertexStride() ==
sizeof(GrDefaultGeoProcFactory::PositionColorAttr));
return kUseColor_CoverageAttribType;
} else {
flags |= GrDefaultGeoProcFactory::kCoverage_GPType;
- drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(flags))->unref();
+ drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(color, flags))->unref();
SkASSERT(drawState->getGeometryProcessor()->getVertexStride() ==
sizeof(GrDefaultGeoProcFactory::PositionColorCoverageAttr));
return kUseCoverage_CoverageAttribType;
@@ -176,14 +176,13 @@ GrIndexBuffer* GrAARectRenderer::aaStrokeRectIndexBuffer(bool miterStroke) {
void GrAARectRenderer::geometryFillAARect(GrDrawTarget* target,
GrDrawState* drawState,
+ GrColor color,
const SkRect& rect,
const SkMatrix& combinedMatrix,
const SkRect& devRect) {
GrDrawState::AutoRestoreEffects are(drawState);
- GrColor color = drawState->getColor();
-
- CoverageAttribType covAttribType = set_rect_attribs(drawState);
+ CoverageAttribType covAttribType = set_rect_attribs(drawState, color);
if (kUseCoverage_CoverageAttribType == covAttribType && GrColorIsOpaque(color)) {
drawState->setHint(GrDrawState::kVertexColorsAreOpaque_Hint, true);
}
@@ -308,6 +307,7 @@ void GrAARectRenderer::geometryFillAARect(GrDrawTarget* target,
void GrAARectRenderer::strokeAARect(GrDrawTarget* target,
GrDrawState* drawState,
+ GrColor color,
const SkRect& rect,
const SkMatrix& combinedMatrix,
const SkRect& devRect,
@@ -354,7 +354,7 @@ void GrAARectRenderer::strokeAARect(GrDrawTarget* target,
}
if (spare <= 0 && miterStroke) {
- this->fillAARect(target, drawState, devOutside, SkMatrix::I(), devOutside);
+ this->fillAARect(target, drawState, color, devOutside, SkMatrix::I(), devOutside);
return;
}
@@ -371,20 +371,20 @@ void GrAARectRenderer::strokeAARect(GrDrawTarget* target,
devOutsideAssist.outset(0, ry);
}
- this->geometryStrokeAARect(target, drawState, devOutside, devOutsideAssist, devInside,
+ this->geometryStrokeAARect(target, drawState, color, devOutside, devOutsideAssist, devInside,
miterStroke);
}
void GrAARectRenderer::geometryStrokeAARect(GrDrawTarget* target,
GrDrawState* drawState,
+ GrColor color,
const SkRect& devOutside,
const SkRect& devOutsideAssist,
const SkRect& devInside,
bool miterStroke) {
GrDrawState::AutoRestoreEffects are(drawState);
- CoverageAttribType covAttribType = set_rect_attribs(drawState);
+ CoverageAttribType covAttribType = set_rect_attribs(drawState, color);
- GrColor color = drawState->getColor();
if (kUseCoverage_CoverageAttribType == covAttribType && GrColorIsOpaque(color)) {
drawState->setHint(GrDrawState::kVertexColorsAreOpaque_Hint, true);
}
@@ -510,6 +510,7 @@ void GrAARectRenderer::geometryStrokeAARect(GrDrawTarget* target,
void GrAARectRenderer::fillAANestedRects(GrDrawTarget* target,
GrDrawState* drawState,
+ GrColor color,
const SkRect rects[2],
const SkMatrix& combinedMatrix) {
SkASSERT(combinedMatrix.rectStaysRect());
@@ -521,9 +522,10 @@ void GrAARectRenderer::fillAANestedRects(GrDrawTarget* target,
combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2);
if (devInside.isEmpty()) {
- this->fillAARect(target, drawState, devOutside, SkMatrix::I(), devOutside);
+ this->fillAARect(target, drawState, color, devOutside, SkMatrix::I(), devOutside);
return;
}
- this->geometryStrokeAARect(target, drawState, devOutside, devOutsideAssist, devInside, true);
+ this->geometryStrokeAARect(target, drawState, color, 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