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

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

Issue 238903002: We can reuse the variable which is already declared. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@dfin
Patch Set: Created 6 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 unified diff | Download patch
« 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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 return; 981 return;
982 } 982 }
983 GraphicsContext* c = drawingContext(); 983 GraphicsContext* c = drawingContext();
984 if (!c) { 984 if (!c) {
985 return; 985 return;
986 } 986 }
987 if (!state().m_invertibleCTM) { 987 if (!state().m_invertibleCTM) {
988 return; 988 return;
989 } 989 }
990 FloatRect clipBounds; 990 FloatRect clipBounds;
991 if (!drawingContext()->getTransformedClipBounds(&clipBounds)) { 991 if (!c->getTransformedClipBounds(&clipBounds)) {
992 return; 992 return;
993 } 993 }
994 994
995 // If gradient size is zero, then paint nothing. 995 // If gradient size is zero, then paint nothing.
996 Gradient* gradient = c->fillGradient(); 996 Gradient* gradient = c->fillGradient();
997 if (gradient && gradient->isZeroSize()) { 997 if (gradient && gradient->isZeroSize()) {
998 return; 998 return;
999 } 999 }
1000 1000
1001 WindRule windRule = c->fillRule(); 1001 WindRule windRule = c->fillRule();
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 { 1263 {
1264 if (!validateRectForCanvas(x, y, width, height)) 1264 if (!validateRectForCanvas(x, y, width, height))
1265 return; 1265 return;
1266 1266
1267 GraphicsContext* c = drawingContext(); 1267 GraphicsContext* c = drawingContext();
1268 if (!c) 1268 if (!c)
1269 return; 1269 return;
1270 if (!state().m_invertibleCTM) 1270 if (!state().m_invertibleCTM)
1271 return; 1271 return;
1272 FloatRect clipBounds; 1272 FloatRect clipBounds;
1273 if (!drawingContext()->getTransformedClipBounds(&clipBounds)) 1273 if (!c->getTransformedClipBounds(&clipBounds))
1274 return; 1274 return;
1275 1275
1276 // from the HTML5 Canvas spec: 1276 // from the HTML5 Canvas spec:
1277 // If x0 = x1 and y0 = y1, then the linear gradient must paint nothing 1277 // If x0 = x1 and y0 = y1, then the linear gradient must paint nothing
1278 // If x0 = x1 and y0 = y1 and r0 = r1, then the radial gradient must paint n othing 1278 // If x0 = x1 and y0 = y1 and r0 = r1, then the radial gradient must paint n othing
1279 Gradient* gradient = c->fillGradient(); 1279 Gradient* gradient = c->fillGradient();
1280 if (gradient && gradient->isZeroSize()) 1280 if (gradient && gradient->isZeroSize())
1281 return; 1281 return;
1282 1282
1283 FloatRect rect(x, y, width, height); 1283 FloatRect rect(x, y, width, height);
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 1600
1601 static void drawImageToContext(Image* image, GraphicsContext* context, const Flo atRect& dest, const FloatRect& src, CompositeOperator op) 1601 static void drawImageToContext(Image* image, GraphicsContext* context, const Flo atRect& dest, const FloatRect& src, CompositeOperator op)
1602 { 1602 {
1603 context->drawImage(image, dest, src, op); 1603 context->drawImage(image, dest, src, op);
1604 } 1604 }
1605 1605
1606 template<class T> void CanvasRenderingContext2D::fullCanvasCompositedDrawImage( T* image, const FloatRect& dest, const FloatRect& src, CompositeOperator op) 1606 template<class T> void CanvasRenderingContext2D::fullCanvasCompositedDrawImage( T* image, const FloatRect& dest, const FloatRect& src, CompositeOperator op)
1607 { 1607 {
1608 ASSERT(isFullCanvasCompositeMode(op)); 1608 ASSERT(isFullCanvasCompositeMode(op));
1609 1609
1610 drawingContext()->beginLayer(1, op); 1610 GraphicsContext* c = drawingContext();
1611 drawImageToContext(image, drawingContext(), dest, src, CompositeSourceOver); 1611 c->beginLayer(1, op);
1612 drawingContext()->endLayer(); 1612 drawImageToContext(image, c, dest, src, CompositeSourceOver);
1613 c->endLayer();
1613 } 1614 }
1614 1615
1615 static void fillPrimitive(const FloatRect& rect, GraphicsContext* context) 1616 static void fillPrimitive(const FloatRect& rect, GraphicsContext* context)
1616 { 1617 {
1617 context->fillRect(rect); 1618 context->fillRect(rect);
1618 } 1619 }
1619 1620
1620 static void fillPrimitive(const Path& path, GraphicsContext* context) 1621 static void fillPrimitive(const Path& path, GraphicsContext* context)
1621 { 1622 {
1622 context->fillPath(path); 1623 context->fillPath(path);
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
2421 c->setAlphaAsFloat(1.0); 2422 c->setAlphaAsFloat(1.0);
2422 c->clearShadow(); 2423 c->clearShadow();
2423 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); 2424 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal);
2424 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); 2425 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2425 c->restore(); 2426 c->restore();
2426 2427
2427 didDraw(dirtyRect); 2428 didDraw(dirtyRect);
2428 } 2429 }
2429 2430
2430 } // namespace WebCore 2431 } // namespace WebCore
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