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

Unified Diff: src/gpu/GrDrawContext.cpp

Issue 1584703003: Remove two varieties of drawNonAARect from GrDrawTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@hidedrawtargetabit
Patch Set: deprecation message on GrTest Created 4 years, 11 months 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 | « gm/yuvtorgbeffect.cpp ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawContext.cpp
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 497af7ce9b764fa0b64c21b2759db1e68e1753c7..0874c268a0a025665ae27ef339aa3a0f8e09b54a 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -214,11 +214,10 @@ void GrDrawContext::drawPaint(const GrClip& clip,
AutoCheckFlush acf(fDrawingManager);
GrPipelineBuilder pipelineBuilder(*paint, fRenderTarget, clip);
- this->getDrawTarget()->drawNonAARect(pipelineBuilder,
- paint->getColor(),
- SkMatrix::I(),
- r,
- localMatrix);
+ SkAutoTUnref<GrDrawBatch> batch(
+ GrRectBatchFactory::CreateNonAAFill(paint->getColor(), SkMatrix::I(), r, nullptr,
+ &localMatrix));
+ this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
}
}
@@ -288,8 +287,8 @@ void GrDrawContext::drawRect(const GrClip& clip,
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip);
GrColor color = paint.getColor();
+ SkAutoTUnref<GrDrawBatch> batch;
if (should_apply_coverage_aa(paint, fRenderTarget)) {
- SkAutoTUnref<GrDrawBatch> batch;
if (width >= 0) {
// The stroke path needs the rect to remain axis aligned (no rotation or skew).
if (viewMatrix.rectStaysRect()) {
@@ -305,34 +304,30 @@ void GrDrawContext::drawRect(const GrClip& clip,
devBoundRect));
}
}
- if (batch) {
- this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
- } else {
+ if (!batch) {
SkPath path;
path.setIsVolatile(true);
path.addRect(rect);
this->internalDrawPath(&pipelineBuilder, viewMatrix, color, true, path, *strokeInfo);
SkASSERT(paint.isAntiAlias());
+ return;
}
- return;
- }
-
- if (width >= 0) {
+ } else if (width >= 0) {
// Non-AA hairlines are snapped to pixel centers to make which pixels are hit deterministic
bool snapToPixelCenters = (0 == width && !fRenderTarget->isUnifiedMultisampled());
- SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAStroke(
- color, viewMatrix, rect, width, snapToPixelCenters));
+ batch.reset(GrRectBatchFactory::CreateNonAAStroke(color, viewMatrix, rect, width,
+ snapToPixelCenters));
// Depending on sub-pixel coordinates and the particular GPU, we may lose a corner of
// hairline rects. We jam all the vertices to pixel centers to avoid this, but not when MSAA
// is enabled because it can cause ugly artifacts.
pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_Flag,
snapToPixelCenters);
- this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
} else {
// filled BW rect
- this->getDrawTarget()->drawNonAARect(pipelineBuilder, color, viewMatrix, rect);
+ batch.reset(GrRectBatchFactory::CreateNonAAFill(color, viewMatrix, rect, nullptr, nullptr));
}
+ this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
}
void GrDrawContext::fillRectToRect(const GrClip& clip,
@@ -347,19 +342,18 @@ void GrDrawContext::fillRectToRect(const GrClip& clip,
AutoCheckFlush acf(fDrawingManager);
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip);
+ SkAutoTUnref<GrDrawBatch> batch;
if (should_apply_coverage_aa(paint, fRenderTarget) &&
view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
- SkAutoTUnref<GrDrawBatch> batch(GrAAFillRectBatch::CreateWithLocalRect(
- paint.getColor(), viewMatrix, rectToDraw, localRect));
- if (batch) {
- this->drawBatch(&pipelineBuilder, batch);
- }
+ batch.reset(GrAAFillRectBatch::CreateWithLocalRect(paint.getColor(), viewMatrix, rectToDraw,
+ localRect));
} else {
- this->getDrawTarget()->drawNonAARect(pipelineBuilder,
- paint.getColor(),
- viewMatrix,
- rectToDraw,
- localRect);
+ batch.reset(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix, rectToDraw,
+ &localRect, nullptr));
+ }
+
+ if (batch) {
+ this->drawBatch(&pipelineBuilder, batch);
}
}
@@ -376,18 +370,16 @@ void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip,
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip);
+ SkAutoTUnref<GrDrawBatch> batch;
if (should_apply_coverage_aa(paint, fRenderTarget) &&
view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
- SkAutoTUnref<GrDrawBatch> batch(GrAAFillRectBatch::Create(
- paint.getColor(), viewMatrix, localMatrix, rectToDraw));
- this->drawBatch(&pipelineBuilder, batch);
+ batch.reset(GrAAFillRectBatch::Create(paint.getColor(), viewMatrix, localMatrix,
+ rectToDraw));
} else {
- this->getDrawTarget()->drawNonAARect(pipelineBuilder,
- paint.getColor(),
- viewMatrix,
- rectToDraw,
- localMatrix);
+ batch.reset(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix, rectToDraw,
+ nullptr, &localMatrix));
}
+ this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
}
void GrDrawContext::drawVertices(const GrClip& clip,
« no previous file with comments | « gm/yuvtorgbeffect.cpp ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698