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

Unified Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 1530503004: 2D canvas: pass unmodified primitive bounds to saveLayer(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mark some more tests NeedsRebaseline 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 | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
index 7976efea1fe1e58224b3cebdca278a6ee222beb6..5d5cecbda69a6693ecf1e6a77e897917c6d89e45 100644
--- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
@@ -1308,26 +1308,20 @@ void CanvasRenderingContext2D::drawImageInternal(SkCanvas* c, CanvasImageSource*
SkPaint imagePaint = *paint;
if (paint->getImageFilter()) {
- SkMatrix ctm = c->getTotalMatrix();
SkMatrix invCtm;
- if (!ctm.invert(&invCtm)) {
+ if (!c->getTotalMatrix().invert(&invCtm)) {
// There is an earlier check for invertibility, but the arithmetic
// in AffineTransform is not exactly identical, so it is possible
// for SkMatrix to find the transform to be non-invertible at this stage.
// crbug.com/504687
return;
}
- c->save();
- c->concat(invCtm);
SkRect bounds = dstRect;
- ctm.mapRect(&bounds);
- SkRect filteredBounds;
- paint->getImageFilter()->computeFastBounds(bounds, &filteredBounds);
SkPaint layerPaint;
layerPaint.setXfermode(paint->getXfermode());
- layerPaint.setImageFilter(paint->getImageFilter());
- c->saveLayer(&filteredBounds, &layerPaint);
- c->concat(ctm);
+ SkAutoTUnref<SkImageFilter> localFilter(paint->getImageFilter()->newWithLocalMatrix(invCtm));
+ layerPaint.setImageFilter(localFilter);
+ c->saveLayer(&bounds, &layerPaint);
imagePaint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
imagePaint.setImageFilter(nullptr);
}
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698