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

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

Issue 13637006: Add canvas blending modes under a runtime flag (Closed) Base URL: http://src.chromium.org/blink/trunk/
Patch Set: 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
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 17 matching lines...) Expand all
28 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33 #include "config.h" 33 #include "config.h"
34 #include "core/html/canvas/CanvasRenderingContext2D.h" 34 #include "core/html/canvas/CanvasRenderingContext2D.h"
35 35
36 #include "CSSPropertyNames.h" 36 #include "CSSPropertyNames.h"
37 #include "HTMLNames.h" 37 #include "HTMLNames.h"
38 #include "RuntimeEnabledFeatures.h"
38 #include "core/css/CSSFontSelector.h" 39 #include "core/css/CSSFontSelector.h"
39 #include "core/css/CSSParser.h" 40 #include "core/css/CSSParser.h"
40 #include "core/css/StylePropertySet.h" 41 #include "core/css/StylePropertySet.h"
41 #include "core/css/StyleResolver.h" 42 #include "core/css/StyleResolver.h"
42 #include "core/dom/ExceptionCode.h" 43 #include "core/dom/ExceptionCode.h"
43 #include "core/dom/ExceptionCodePlaceholder.h" 44 #include "core/dom/ExceptionCodePlaceholder.h"
44 #include "core/html/HTMLCanvasElement.h" 45 #include "core/html/HTMLCanvasElement.h"
45 #include "core/html/HTMLImageElement.h" 46 #include "core/html/HTMLImageElement.h"
46 #include "core/html/HTMLMediaElement.h" 47 #include "core/html/HTMLMediaElement.h"
47 #include "core/html/HTMLVideoElement.h" 48 #include "core/html/HTMLVideoElement.h"
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 { 605 {
605 return compositeOperatorName(state().m_globalComposite, state().m_globalBlen d); 606 return compositeOperatorName(state().m_globalComposite, state().m_globalBlen d);
606 } 607 }
607 608
608 void CanvasRenderingContext2D::setGlobalCompositeOperation(const String& operati on) 609 void CanvasRenderingContext2D::setGlobalCompositeOperation(const String& operati on)
609 { 610 {
610 CompositeOperator op = CompositeSourceOver; 611 CompositeOperator op = CompositeSourceOver;
611 BlendMode blendMode = BlendModeNormal; 612 BlendMode blendMode = BlendModeNormal;
612 if (!parseCompositeAndBlendOperator(operation, op, blendMode)) 613 if (!parseCompositeAndBlendOperator(operation, op, blendMode))
613 return; 614 return;
615 if (!RuntimeEnabledFeatures::cssCompositingEnabled() && blendMode != BlendMo deNormal)
616 blendMode = BlendModeNormal;
614 if ((state().m_globalComposite == op) && (state().m_globalBlend == blendMode )) 617 if ((state().m_globalComposite == op) && (state().m_globalBlend == blendMode ))
615 return; 618 return;
616 realizeSaves(); 619 realizeSaves();
617 modifiableState().m_globalComposite = op; 620 modifiableState().m_globalComposite = op;
618 modifiableState().m_globalBlend = blendMode; 621 modifiableState().m_globalBlend = blendMode;
619 GraphicsContext* c = drawingContext(); 622 GraphicsContext* c = drawingContext();
620 if (!c) 623 if (!c)
621 return; 624 return;
622 c->setCompositeOperation(op, blendMode); 625 c->setCompositeOperation(op, blendMode);
623 } 626 }
(...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 } 2256 }
2254 2257
2255 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib utes() const 2258 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib utes() const
2256 { 2259 {
2257 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr eate(); 2260 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr eate();
2258 attributes->setAlpha(m_hasAlpha); 2261 attributes->setAlpha(m_hasAlpha);
2259 return attributes.release(); 2262 return attributes.release();
2260 } 2263 }
2261 2264
2262 } // namespace WebCore 2265 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/script-tests/canvas-blend-solid.js ('k') | Source/core/platform/graphics/GraphicsContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698