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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 1216523005: Fix 2D canvas drawImage handling of non-invertible transform matrices (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 SkCanvas* c = drawingCanvas(); 1275 SkCanvas* c = drawingCanvas();
1276 ASSERT(c); 1276 ASSERT(c);
1277 1277
1278 int initialSaveCount = c->getSaveCount(); 1278 int initialSaveCount = c->getSaveCount();
1279 SkPaint imagePaint = *paint; 1279 SkPaint imagePaint = *paint;
1280 1280
1281 if (paint->getImageFilter()) { 1281 if (paint->getImageFilter()) {
1282 SkMatrix ctm = c->getTotalMatrix(); 1282 SkMatrix ctm = c->getTotalMatrix();
1283 SkMatrix invCtm; 1283 SkMatrix invCtm;
1284 if (!ctm.invert(&invCtm)) { 1284 if (!ctm.invert(&invCtm)) {
1285 ASSERT_NOT_REACHED(); // There is an earlier check for invertibility 1285 // There is an earlier check for invertibility, but the arithmetic
1286 // in AffineTransform is not exactly identical, so it is possible
1287 // for SkMatrix to find the transform to be non-invertible at this s tage.
1288 // crbug.com/504687
1289 return;
1286 } 1290 }
1287 c->save(); 1291 c->save();
1288 c->concat(invCtm); 1292 c->concat(invCtm);
1289 SkRect bounds = dstRect; 1293 SkRect bounds = dstRect;
1290 ctm.mapRect(&bounds); 1294 ctm.mapRect(&bounds);
1291 SkRect filteredBounds; 1295 SkRect filteredBounds;
1292 paint->getImageFilter()->computeFastBounds(bounds, &filteredBounds); 1296 paint->getImageFilter()->computeFastBounds(bounds, &filteredBounds);
1293 SkPaint layerPaint; 1297 SkPaint layerPaint;
1294 layerPaint.setXfermode(paint->getXfermode()); 1298 layerPaint.setXfermode(paint->getXfermode());
1295 layerPaint.setImageFilter(paint->getImageFilter()); 1299 layerPaint.setImageFilter(paint->getImageFilter());
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) 2239 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage)
2236 return; 2240 return;
2237 if (alpha < 0xFF) 2241 if (alpha < 0xFF)
2238 return; 2242 return;
2239 } 2243 }
2240 2244
2241 canvas()->buffer()->willOverwriteCanvas(); 2245 canvas()->buffer()->willOverwriteCanvas();
2242 } 2246 }
2243 2247
2244 } // namespace blink 2248 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698