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

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

Issue 1288063010: Adding nullptr check in CanvasRenderingContext2D::draw (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: build fix Created 5 years, 4 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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 c->setMatrix(ctm); 878 c->setMatrix(ctm);
879 } 879 }
880 880
881 template<typename DrawFunc, typename ContainsFunc> 881 template<typename DrawFunc, typename ContainsFunc>
882 bool CanvasRenderingContext2D::draw(const DrawFunc& drawFunc, const ContainsFunc & drawCoversClipBounds, const SkRect& bounds, CanvasRenderingContext2DState::Pai ntType paintType, CanvasRenderingContext2DState::ImageType imageType) 882 bool CanvasRenderingContext2D::draw(const DrawFunc& drawFunc, const ContainsFunc & drawCoversClipBounds, const SkRect& bounds, CanvasRenderingContext2DState::Pai ntType paintType, CanvasRenderingContext2DState::ImageType imageType)
883 { 883 {
884 if (!state().isTransformInvertible()) 884 if (!state().isTransformInvertible())
885 return false; 885 return false;
886 886
887 SkIRect clipBounds; 887 SkIRect clipBounds;
888 if (!drawingCanvas()->getClipDeviceBounds(&clipBounds)) 888 if (!drawingCanvas() || !drawingCanvas()->getClipDeviceBounds(&clipBounds))
889 return false; 889 return false;
890 890
891 // If gradient size is zero, then paint nothing. 891 // If gradient size is zero, then paint nothing.
892 CanvasStyle* style = state().style(paintType); 892 CanvasStyle* style = state().style(paintType);
893 if (style) { 893 if (style) {
894 CanvasGradient* gradient = style->canvasGradient(); 894 CanvasGradient* gradient = style->canvasGradient();
895 if (gradient && gradient->gradient()->isZeroSize()) 895 if (gradient && gradient->gradient()->isZeroSize())
896 return false; 896 return false;
897 } 897 }
898 898
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
2311 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) 2311 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage)
2312 return; 2312 return;
2313 if (alpha < 0xFF) 2313 if (alpha < 0xFF)
2314 return; 2314 return;
2315 } 2315 }
2316 2316
2317 canvas()->buffer()->willOverwriteCanvas(); 2317 canvas()->buffer()->willOverwriteCanvas();
2318 } 2318 }
2319 2319
2320 } // namespace blink 2320 } // 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