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

Unified Diff: src/core/SkRecordDraw.cpp

Issue 1308703007: Fix filter primitive bounds computations. (Closed) Base URL: https://skia.googlesource.com/skia.git@saveLayer-bounds-not-transformed
Patch Set: Fix comment style; remove useless param names Created 5 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/core/SkMatrixImageFilter.cpp ('k') | src/effects/SkBlurImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecordDraw.cpp
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 4847273f52a826f4eb2510abb75b4e7860cc82d2..90b85d1e969e63277b0eef6679576049c0e15d11 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -221,6 +221,7 @@ private:
int controlOps; // Number of control ops in this Save block, including the Save.
Bounds bounds; // Bounds of everything in the block.
const SkPaint* paint; // Unowned. If set, adjusts the bounds of all ops in this block.
+ SkMatrix ctm;
};
// Only Restore, SetMatrix, and Concat change the CTM.
@@ -301,6 +302,7 @@ private:
sb.bounds =
PaintMayAffectTransparentBlack(paint) ? fCurrentClipBounds : Bounds::MakeEmpty();
sb.paint = paint;
+ sb.ctm = this->fCTM;
fSaveStack.push(sb);
this->pushControl();
@@ -563,9 +565,15 @@ private:
bool adjustForSaveLayerPaints(SkRect* rect, int savesToIgnore = 0) const {
for (int i = fSaveStack.count() - 1 - savesToIgnore; i >= 0; i--) {
+ SkMatrix inverse;
+ if (!fSaveStack[i].ctm.invert(&inverse)) {
+ return false;
+ }
+ inverse.mapRect(rect);
if (!AdjustForPaint(fSaveStack[i].paint, rect)) {
return false;
}
+ fSaveStack[i].ctm.mapRect(rect);
mtklein 2015/12/09 16:59:41 Is it important that we do rect = (M (M^-1 rect))
mtklein 2015/12/09 17:00:53 (Or put (M^-1 rect) into another SkRect instead of
Stephen White 2015/12/09 17:02:57 The problem is that we don't know the rect at save
mtklein 2015/12/09 17:06:04 So, (*rect at line 577) != (*rect at line 571)?
Stephen White 2015/12/09 17:10:52 Yeah. It may have been munged by AdjustForPaint().
mtklein 2015/12/09 17:15:25 Oh, of course. That's the whole point of this met
}
return true;
}
« no previous file with comments | « src/core/SkMatrixImageFilter.cpp ('k') | src/effects/SkBlurImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698