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

Unified Diff: src/gpu/GrDrawContext.cpp

Issue 2268443002: add SkMatrixPriv for specialized helpers Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months 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/core/SkMatrixPriv.h ('k') | src/gpu/batches/GrNonAAFillRectBatch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawContext.cpp
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 9e80f732c259c7c7bde2778baeff664138e542c8..7044b499fa953e96326d73efe8b32a8fa8ea2f9a 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -37,6 +37,7 @@
#include "../private/GrAuditTrail.h"
#include "SkLatticeIter.h"
+#include "SkMatrixPriv.h"
#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingManager->getContext())
#define ASSERT_SINGLE_OWNER \
@@ -260,12 +261,10 @@ void GrDrawContext::drawPaint(const GrClip& clip,
// map the four corners and bound them with a new rect. This will not
// produce a correct result for some perspective matrices.
if (!isPerspective) {
- SkMatrix inverse;
- if (!viewMatrix.invert(&inverse)) {
+ if (!SkMatrixPriv::InverseMapRect(viewMatrix, &r, r)) {
SkDebugf("Could not invert matrix\n");
return;
}
- inverse.mapRect(&r);
this->drawRect(clip, *paint, viewMatrix, r);
} else {
SkMatrix localMatrix;
@@ -314,17 +313,13 @@ static bool crop_filled_rect(const GrRenderTarget* rt, const GrClip& clip,
return true;
}
- SkMatrix inverseViewMatrix;
- if (!viewMatrix.invert(&inverseViewMatrix)) {
- return false;
- }
-
SkIRect clipDevBounds;
SkRect clipBounds;
- SkASSERT(inverseViewMatrix.rectStaysRect());
clip.getConservativeBounds(rt->width(), rt->height(), &clipDevBounds);
- inverseViewMatrix.mapRect(&clipBounds, SkRect::Make(clipDevBounds));
+ if (!SkMatrixPriv::InverseMapRect(viewMatrix, &clipBounds, SkRect::Make(clipDevBounds))) {
+ return false;
+ }
if (localRect) {
if (!rect->intersects(clipBounds)) {
« no previous file with comments | « src/core/SkMatrixPriv.h ('k') | src/gpu/batches/GrNonAAFillRectBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698