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

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

Issue 15137009: Refactor shadow rendering logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: merge upstream changes Created 7 years, 7 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 | « Source/core/core.gypi ('k') | Source/core/platform/graphics/DrawLooper.h » ('j') | 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 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012 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 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 applyShadow(); 1177 applyShadow();
1178 } 1178 }
1179 1179
1180 void CanvasRenderingContext2D::applyShadow() 1180 void CanvasRenderingContext2D::applyShadow()
1181 { 1181 {
1182 GraphicsContext* c = drawingContext(); 1182 GraphicsContext* c = drawingContext();
1183 if (!c) 1183 if (!c)
1184 return; 1184 return;
1185 1185
1186 if (shouldDrawShadows()) 1186 if (shouldDrawShadows())
1187 c->setShadow(state().m_shadowOffset, state().m_shadowBlur, state().m_sha dowColor, ColorSpaceDeviceRGB); 1187 c->setShadow(state().m_shadowOffset, state().m_shadowBlur, state().m_sha dowColor);
1188 else 1188 else
1189 c->clearShadow(); 1189 c->clearShadow();
1190 } 1190 }
1191 1191
1192 bool CanvasRenderingContext2D::shouldDrawShadows() const 1192 bool CanvasRenderingContext2D::shouldDrawShadows() const
1193 { 1193 {
1194 return alphaChannel(state().m_shadowColor) && (state().m_shadowBlur || !stat e().m_shadowOffset.isZero()); 1194 return alphaChannel(state().m_shadowColor) && (state().m_shadowBlur || !stat e().m_shadowOffset.isZero());
1195 } 1195 }
1196 1196
1197 static LayoutSize size(HTMLImageElement* image) 1197 static LayoutSize size(HTMLImageElement* image)
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 } 2250 }
2251 2251
2252 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib utes() const 2252 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib utes() const
2253 { 2253 {
2254 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr eate(); 2254 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr eate();
2255 attributes->setAlpha(m_hasAlpha); 2255 attributes->setAlpha(m_hasAlpha);
2256 return attributes.release(); 2256 return attributes.release();
2257 } 2257 }
2258 2258
2259 } // namespace WebCore 2259 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/platform/graphics/DrawLooper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698