Chromium Code Reviews| Index: src/gpu/GrContext.cpp |
| diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
| index cc6a63726766a1bda2e7ed51f9547727c6d86197..93d3f22361830ccee1a253ed3ffa68029b9c744f 100755 |
| --- a/src/gpu/GrContext.cpp |
| +++ b/src/gpu/GrContext.cpp |
| @@ -557,27 +557,41 @@ void GrContext::drawPaint(const GrPaint& origPaint, const SkMatrix& viewMatrix) |
| 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()) { |
| + AutoCheckFlush acf(this); |
| + GrDrawState drawState; |
| + GrDrawTarget* target = this->prepareToDraw(&drawState, paint, |
| + isPerspective ? &SkMatrix::I() : &viewMatrix, &acf); |
| + if (NULL == target) { |
| + return; |
| + } |
| + |
| + GR_CREATE_TRACE_MARKER("GrContext::drawPaint", target); |
|
bsalomon
2014/12/22 15:33:53
this looks duplicated from above? probably don't w
|
| + if (!isPerspective) { |
| SkMatrix inverse; |
| if (!viewMatrix.invert(&inverse)) { |
| SkDebugf("Could not invert matrix\n"); |
| return; |
| } |
| inverse.mapRect(&r); |
| + target->drawSimpleRect(&drawState, paint->getColor(), r); |
| } else { |
| - if (!paint.writable()->localCoordChangeInverse(viewMatrix)) { |
| + SkMatrix localMatrix; |
| + if (!viewMatrix.invert(&localMatrix)) { |
| SkDebugf("Could not invert matrix\n"); |
| return; |
| } |
| + target->drawRect(&drawState, paint->getColor(), r, NULL, 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 |
| @@ -809,7 +823,7 @@ void GrContext::drawNonAARectToRect(const GrPaint& paint, |
| GR_CREATE_TRACE_MARKER("GrContext::drawRectToRect", target); |
| - target->drawRect(&drawState, paint.getColor(), rectToDraw, &localRect, localMatrix); |
| + target->drawRect(&drawState, paint.getColor(), rectToDraw, &localRect, localMatrix, NULL); |
| } |
| static const GrGeometryProcessor* set_vertex_attributes(const SkPoint* texCoords, |