Chromium Code Reviews| Index: src/gpu/GrContext.cpp |
| =================================================================== |
| --- src/gpu/GrContext.cpp (revision 8539) |
| +++ src/gpu/GrContext.cpp (working copy) |
| @@ -686,7 +686,8 @@ |
| const SkMatrix* matrix, |
| SkMatrix* combinedMatrix, |
| GrRect* devRect, |
| - bool* useVertexCoverage) { |
| + bool* useVertexCoverage, |
| + bool stroked) { |
|
bsalomon
2013/04/08 15:48:39
I think the width param already tells you if its s
robertphillips
2013/04/08 19:33:20
Done.
|
| // 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 |
| // integer coords. |
| @@ -715,19 +716,44 @@ |
| return false; |
| } |
| - if (!drawState.getViewMatrix().preservesAxisAlignment()) { |
| - return false; |
| - } |
| +#ifdef SHADER_AA_FILL_RECT |
| + if (stroked) { |
| +#endif |
| + if (!drawState.getViewMatrix().preservesAxisAlignment()) { |
| + return false; |
| + } |
| - if (NULL != matrix && |
| - !matrix->preservesAxisAlignment()) { |
| - return false; |
| + if (NULL != matrix && !matrix->preservesAxisAlignment()) { |
| + return false; |
| + } |
| +#ifdef SHADER_AA_FILL_RECT |
| + } else { |
| + if (!drawState.getViewMatrix().preservesAxisAlignment() && |
| + !drawState.getViewMatrix().notSkewOrPersp()) { |
| + return false; |
| + } |
| + |
| + if (NULL != matrix && !matrix->notSkewOrPersp()) { |
| + return false; |
| + } |
| } |
| +#endif |
| *combinedMatrix = drawState.getViewMatrix(); |
| if (NULL != matrix) { |
| combinedMatrix->preConcat(*matrix); |
| - GrAssert(combinedMatrix->preservesAxisAlignment()); |
| + |
| +#if GR_DEBUG |
| +#ifdef SHADER_AA_FILL_RECT |
| + if (stroked) { |
| +#endif |
| + GrAssert(combinedMatrix->preservesAxisAlignment()); |
| +#ifdef SHADER_AA_FILL_RECT |
| + } else { |
| + GrAssert(combinedMatrix->notSkewOrPersp()); |
| + } |
| +#endif |
| +#endif |
| } |
| combinedMatrix->mapRect(devRect, rect); |
| @@ -756,7 +782,8 @@ |
| !this->getRenderTarget()->isMultisampled(); |
| bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix, |
| &combinedMatrix, &devRect, |
| - &useVertexCoverage); |
| + &useVertexCoverage, |
| + width >= 0); |
| if (doAA) { |
| GrDrawState::AutoDeviceCoordDraw adcd(target->drawState()); |
| @@ -773,10 +800,17 @@ |
| strokeSize.set(SK_Scalar1, SK_Scalar1); |
| } |
| fAARectRenderer->strokeAARect(this->getGpu(), target, devRect, |
| - strokeSize, useVertexCoverage); |
| + strokeSize, useVertexCoverage); |
| } else { |
| + // filled AA rect |
| +#ifdef SHADER_AA_FILL_RECT |
| + fAARectRenderer->shaderFillAARect(this->getGpu(), target, |
| + rect, combinedMatrix, devRect, |
| + useVertexCoverage); |
| +#else |
| fAARectRenderer->fillAARect(this->getGpu(), target, |
| - devRect, useVertexCoverage); |
| + devRect, useVertexCoverage); |
| +#endif |
| } |
| return; |
| } |
| @@ -822,6 +856,7 @@ |
| target->drawNonIndexed(primType, 0, vertCount); |
| } else { |
| + // filled BW rect |
| #if GR_STATIC_RECT_VB |
| const GrVertexBuffer* sqVB = fGpu->getUnitSquareVertexBuffer(); |
| if (NULL == sqVB) { |