diff options
author | 2014-12-22 15:27:05 -0800 | |
---|---|---|
committer | 2014-12-22 15:27:05 -0800 | |
commit | 8fc6c2d82c1f30ff82274334c01f0799def6a609 (patch) | |
tree | 6499d32fd02b524167a690704d855e804f66c8a3 /src/gpu/GrContext.cpp | |
parent | 16c8f14cd481b78673a33450a1395958e3e10e62 (diff) |
This CL cleans up the last remaining users of localCoordChange on paint
NOTREECHECKS=True
BUG=skia:
Review URL: https://codereview.chromium.org/817853002
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rwxr-xr-x | src/gpu/GrContext.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index c637101d07..2818aa92dd 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -555,29 +555,42 @@ void GrContext::drawPaint(const GrPaint& origPaint, const SkMatrix& viewMatrix) SkIntToScalar(getRenderTarget()->width()), SkIntToScalar(getRenderTarget()->height())); SkTCopyOnFirstWrite<GrPaint> paint(origPaint); - GR_CREATE_TRACE_MARKER_CONTEXT("GrContext::drawPaint", this); + + // by definition this fills the entire clip, no need for AA + if (paint->isAntiAlias()) { + paint.writable()->setAntiAlias(false); + } + + bool isPerspective = viewMatrix.hasPerspective(); // We attempt to map r by the inverse matrix and draw that. mapRect will // map the four corners and bound them with a new rect. This will not // produce a correct result for some perspective matrices. - if (!viewMatrix.hasPerspective()) { + if (!isPerspective) { SkMatrix inverse; if (!viewMatrix.invert(&inverse)) { SkDebugf("Could not invert matrix\n"); return; } inverse.mapRect(&r); + this->drawRect(*paint, viewMatrix, r); } else { - if (!paint.writable()->localCoordChangeInverse(viewMatrix)) { + SkMatrix localMatrix; + if (!viewMatrix.invert(&localMatrix)) { SkDebugf("Could not invert matrix\n"); return; } + + AutoCheckFlush acf(this); + GrDrawState drawState; + GrDrawTarget* target = this->prepareToDraw(&drawState, paint, &SkMatrix::I(), &acf); + if (NULL == target) { + return; + } + + GR_CREATE_TRACE_MARKER("GrContext::drawPaintWithPerspective", target); + target->drawRect(&drawState, paint->getColor(), r, NULL, &localMatrix); } - // by definition this fills the entire clip, no need for AA - if (paint->isAntiAlias()) { - paint.writable()->setAntiAlias(false); - } - this->drawRect(*paint, viewMatrix.hasPerspective() ? SkMatrix::I() : viewMatrix, r); } #ifdef SK_DEVELOPER |