Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Unified Diff: src/gpu/GrContext.cpp

Issue 817853002: Remove localcoordchange functions off paint (Closed) Base URL: https://skia.googlesource.com/skia.git@local-matrix-on-gp
Patch Set: changing ignores Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDefaultGeoProcFactory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index c637101d072881f2f3fc464df48cc7510fc39a97..2818aa92dd325090b2e97d0da5e0f2ab45174c82 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
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDefaultGeoProcFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698