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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 1583103007: Use an up-to-date canvas size when building canvas filters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 c->restore(); 869 c->restore();
870 c->setMatrix(ctm); 870 c->setMatrix(ctm);
871 } 871 }
872 872
873 template<typename DrawFunc, typename ContainsFunc> 873 template<typename DrawFunc, typename ContainsFunc>
874 bool CanvasRenderingContext2D::draw(const DrawFunc& drawFunc, const ContainsFunc & drawCoversClipBounds, const SkRect& bounds, CanvasRenderingContext2DState::Pai ntType paintType, CanvasRenderingContext2DState::ImageType imageType) 874 bool CanvasRenderingContext2D::draw(const DrawFunc& drawFunc, const ContainsFunc & drawCoversClipBounds, const SkRect& bounds, CanvasRenderingContext2DState::Pai ntType paintType, CanvasRenderingContext2DState::ImageType imageType)
875 { 875 {
876 if (!state().isTransformInvertible()) 876 if (!state().isTransformInvertible())
877 return false; 877 return false;
878 878
879 // Filter construction can depend on the bounding box of the canvas' layout object,
880 // so we need layout to be up-to-date if filter construction is needed. Howe ver,
881 // layout can trigger scripts that cause the canvas to be freed, so we need to
882 // trigger layout before checking for the drawing canvas.
883 if (state().needsToBuildFilter())
884 canvas()->document().updateLayoutIgnorePendingStylesheets();
Justin Novosad 2016/01/15 21:16:28 This is a big hammer that may affect performance i
ajuma 2016/01/18 14:34:15 Turns out that updateLayoutTreeForNodeIfNeeded isn
885
879 SkIRect clipBounds; 886 SkIRect clipBounds;
880 if (!drawingCanvas() || !drawingCanvas()->getClipDeviceBounds(&clipBounds)) 887 if (!drawingCanvas() || !drawingCanvas()->getClipDeviceBounds(&clipBounds))
881 return false; 888 return false;
882 889
883 // If gradient size is zero, then paint nothing. 890 // If gradient size is zero, then paint nothing.
884 CanvasStyle* style = state().style(paintType); 891 CanvasStyle* style = state().style(paintType);
885 if (style) { 892 if (style) {
886 CanvasGradient* gradient = style->canvasGradient(); 893 CanvasGradient* gradient = style->canvasGradient();
887 if (gradient && gradient->gradient()->isZeroSize()) 894 if (gradient && gradient->gradient()->isZeroSize())
888 return false; 895 return false;
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) 2335 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage)
2329 return; 2336 return;
2330 if (alpha < 0xFF) 2337 if (alpha < 0xFF)
2331 return; 2338 return;
2332 } 2339 }
2333 2340
2334 canvas()->buffer()->willOverwriteCanvas(); 2341 canvas()->buffer()->willOverwriteCanvas();
2335 } 2342 }
2336 2343
2337 } // namespace blink 2344 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698