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

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: comments 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
Index: src/gpu/batches/GrNonAAStrokeRectBatch.cpp
diff --git a/src/gpu/batches/GrNonAAStrokeRectBatch.cpp b/src/gpu/batches/GrNonAAStrokeRectBatch.cpp
index 299d995fc70251347b605f49fc2928018d6c3829..048f5615c9c031609b0742d8bbd87829aac22bb2 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);
robertphillips 2016/07/07 20:26:42 xtra space here ?
bsalomon 2016/07/07 23:40:57 Done.
+ batch->setBounds(bounds, HasAABloat ::kNo, IsZeroArea::kNo);
+ } else {
+ batch->setTransformedBounds(bounds, batch->fViewMatrix, HasAABloat ::kNo,
+ IsZeroArea::kNo);
}
return batch;
}

Powered by Google App Engine
This is Rietveld 408576698