aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches/GrNonAAStrokeRectBatch.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-07-08 06:40:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-08 06:40:57 -0700
commit88cf17d099085b8085ab11571b5094163dbb2c84 (patch)
tree0737705697caa8998453d5519a19a6f12b888104 /src/gpu/batches/GrNonAAStrokeRectBatch.cpp
parentac41bac40f5a80d2bc5ccec584c23478a6900179 (diff)
Consolidate handling of infinitely thin primitives and aa bloat handing WRT batch bounds.
Diffstat (limited to 'src/gpu/batches/GrNonAAStrokeRectBatch.cpp')
-rw-r--r--src/gpu/batches/GrNonAAStrokeRectBatch.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/gpu/batches/GrNonAAStrokeRectBatch.cpp b/src/gpu/batches/GrNonAAStrokeRectBatch.cpp
index 299d995fc7..f443b32f19 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;
}