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

Unified Diff: src/gpu/batches/GrNonAAStrokeRectBatch.cpp

Issue 2127673002: Consolidate handling of infinitely thin primitives and aa bloat handing WRT batch bounds (Closed) Base URL: https://skia.googlesource.com/skia.git@AAStrokeRect
Patch Set: update for instanced rendering Created 4 years, 5 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 | « src/gpu/batches/GrNonAAFillRectPerspectiveBatch.cpp ('k') | src/gpu/batches/GrPLSPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrNonAAStrokeRectBatch.cpp
diff --git a/src/gpu/batches/GrNonAAStrokeRectBatch.cpp b/src/gpu/batches/GrNonAAStrokeRectBatch.cpp
index 299d995fc70251347b605f49fc2928018d6c3829..f443b32f19f8d2313b895a7e732357995541c547 100644
--- a/src/gpu/batches/GrNonAAStrokeRectBatch.cpp
+++ b/src/gpu/batches/GrNonAAStrokeRectBatch.cpp
@@ -72,24 +72,25 @@ public:
batch->fRect.sort();
batch->fStrokeWidth = stroke.getWidth();
- batch->fBounds = batch->fRect;
SkScalar rad = SkScalarHalf(batch->fStrokeWidth);
- batch->fBounds.outset(rad, rad);
- batch->fViewMatrix.mapRect(&batch->fBounds);
+ SkRect bounds = rect;
+ bounds.outset(rad, rad);
// If our caller snaps to pixel centers then we have to round out the bounds
if (snapToPixelCenters) {
+ viewMatrix.mapRect(&bounds);
// We want to be consistent with how we snap non-aa lines. To match what we do in
// GrGLSLVertexShaderBuilder, we first floor all the vertex values and then add half a
// pixel to force us to pixel centers.
- batch->fBounds.set(SkScalarFloorToScalar(batch->fBounds.fLeft),
- SkScalarFloorToScalar(batch->fBounds.fTop),
- SkScalarFloorToScalar(batch->fBounds.fRight),
- SkScalarFloorToScalar(batch->fBounds.fBottom));
- batch->fBounds.offset(0.5f, 0.5f);
-
- // Round out the bounds to integer values
- batch->fBounds.roundOut();
+ bounds.set(SkScalarFloorToScalar(bounds.fLeft),
+ SkScalarFloorToScalar(bounds.fTop),
+ SkScalarFloorToScalar(bounds.fRight),
+ SkScalarFloorToScalar(bounds.fBottom));
+ bounds.offset(0.5f, 0.5f);
+ batch->setBounds(bounds, HasAABloat::kNo, IsZeroArea::kNo);
+ } else {
+ batch->setTransformedBounds(bounds, batch->fViewMatrix, HasAABloat ::kNo,
+ IsZeroArea::kNo);
}
return batch;
}
« no previous file with comments | « src/gpu/batches/GrNonAAFillRectPerspectiveBatch.cpp ('k') | src/gpu/batches/GrPLSPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698