| Index: src/gpu/GrContext.cpp
|
| ===================================================================
|
| --- src/gpu/GrContext.cpp (revision 9127)
|
| +++ src/gpu/GrContext.cpp (working copy)
|
| @@ -680,11 +680,17 @@
|
| verts[9] = verts[1];
|
| }
|
|
|
| +static bool isIRect(const GrRect& r) {
|
| + return SkScalarIsInt(r.fLeft) && SkScalarIsInt(r.fTop) &&
|
| + SkScalarIsInt(r.fRight) && SkScalarIsInt(r.fBottom);
|
| +}
|
| +
|
| static bool apply_aa_to_rect(GrDrawTarget* target,
|
| const GrRect& rect,
|
| SkScalar strokeWidth,
|
| const SkMatrix* matrix,
|
| SkMatrix* combinedMatrix,
|
| + GrRect* devRect,
|
| bool* useVertexCoverage) {
|
| // we use a simple coverage ramp to do aa on axis-aligned rects
|
| // we check if the rect will be axis-aligned, and the rect won't land on
|
| @@ -754,11 +760,13 @@
|
| #endif
|
| }
|
|
|
| - if (0 == rect.width() || 0 == rect.height()) {
|
| - return false;
|
| + combinedMatrix->mapRect(devRect, rect);
|
| +
|
| + if (strokeWidth < 0) {
|
| + return !isIRect(*devRect);
|
| + } else {
|
| + return true;
|
| }
|
| -
|
| - return true;
|
| }
|
|
|
| void GrContext::drawRect(const GrPaint& paint,
|
| @@ -770,12 +778,13 @@
|
| GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW);
|
| GrDrawState::AutoStageDisable atr(fDrawState);
|
|
|
| + GrRect devRect;
|
| SkMatrix combinedMatrix;
|
| bool useVertexCoverage;
|
| bool needAA = paint.isAntiAlias() &&
|
| !this->getRenderTarget()->isMultisampled();
|
| bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix,
|
| - &combinedMatrix,
|
| + &combinedMatrix, &devRect,
|
| &useVertexCoverage);
|
| if (doAA) {
|
| GrDrawState::AutoDeviceCoordDraw adcd(target->drawState());
|
| @@ -792,12 +801,12 @@
|
| strokeSize.set(SK_Scalar1, SK_Scalar1);
|
| }
|
| fAARectRenderer->strokeAARect(this->getGpu(), target,
|
| - rect, combinedMatrix,
|
| + rect, combinedMatrix, devRect,
|
| strokeSize, useVertexCoverage);
|
| } else {
|
| // filled AA rect
|
| fAARectRenderer->fillAARect(this->getGpu(), target,
|
| - rect, combinedMatrix,
|
| + rect, combinedMatrix, devRect,
|
| useVertexCoverage);
|
| }
|
| return;
|
|
|