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

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

Issue 1900523003: Revert "2D canvas: pass unmodified primitive bounds to saveLayer()." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « 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/BaseRenderingContext2D.cpp
diff --git a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
index e35505224bd6aa3f9e2be6d7ca1942ece41065b3..979f62dbbef87c8b32de46b54ea4ca1fb6c0cd69 100644
--- a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
@@ -911,19 +911,25 @@ void BaseRenderingContext2D::drawImageInternal(SkCanvas* c, CanvasImageSource* i
SkPaint imagePaint = *paint;
if (paint->getImageFilter()) {
+ SkMatrix ctm = c->getTotalMatrix();
SkMatrix invCtm;
- if (!c->getTotalMatrix().invert(&invCtm)) {
+ if (!ctm.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);
SkPaint layerPaint;
layerPaint.setXfermode(sk_ref_sp(paint->getXfermode()));
- layerPaint.setImageFilter(paint->getImageFilter()->makeWithLocalMatrix(invCtm));
+ layerPaint.setImageFilter(paint->getImageFilter());
+
c->saveLayer(&bounds, &layerPaint);
+ c->concat(ctm);
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