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

Side by Side Diff: Source/core/paint/SVGPaintContext.cpp

Issue 947893002: Implement SVG masking with slimming paint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add a mask debug print string Created 5 years, 10 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/paint/LayerPainter.cpp ('k') | Source/core/svg/graphics/SVGImage.cpp » ('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) 2007, 2008 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. All rights reserved. 5 * Copyright (C) 2009 Google, Inc. All rights reserved.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 if (!applyClipIfNecessary(resources)) 89 if (!applyClipIfNecessary(resources))
90 return false; 90 return false;
91 91
92 if (!applyMaskIfNecessary(resources)) 92 if (!applyMaskIfNecessary(resources))
93 return false; 93 return false;
94 94
95 if (!applyFilterIfNecessary(resources)) 95 if (!applyFilterIfNecessary(resources))
96 return false; 96 return false;
97 97
98 if (!isIsolationInstalled() && SVGLayoutSupport::isIsolationRequired(m_objec t)) 98 if (!isIsolationInstalled() && SVGLayoutSupport::isIsolationRequired(m_objec t))
99 m_compositingRecorder = adoptPtr(new CompositingRecorder(m_paintInfo.con text, m_object->displayItemClient(), m_paintInfo.context->compositeOperationDepr ecated(), WebBlendModeNormal, 1)); 99 m_compositingRecorder = adoptPtr(new CompositingRecorder(m_paintInfo.con text, m_object->displayItemClient(), WebCoreCompositeToSkiaComposite(m_paintInfo .context->compositeOperationDeprecated(), WebBlendModeNormal), 1));
100 100
101 return true; 101 return true;
102 } 102 }
103 103
104 void SVGPaintContext::applyCompositingIfNecessary() 104 void SVGPaintContext::applyCompositingIfNecessary()
105 { 105 {
106 ASSERT(!m_paintInfo.isRenderingClipPathAsMaskImage()); 106 ASSERT(!m_paintInfo.isRenderingClipPathAsMaskImage());
107 107
108 // Layer takes care of root opacity and blend mode. 108 // Layer takes care of root opacity and blend mode.
109 if (m_object->isSVGRoot()) 109 if (m_object->isSVGRoot())
110 return; 110 return;
111 111
112 const LayoutStyle& style = m_object->styleRef(); 112 const LayoutStyle& style = m_object->styleRef();
113 float opacity = style.opacity(); 113 float opacity = style.opacity();
114 bool hasBlendMode = style.hasBlendMode() && m_object->isBlendingAllowed(); 114 bool hasBlendMode = style.hasBlendMode() && m_object->isBlendingAllowed();
115 if (opacity < 1 || hasBlendMode) { 115 if (opacity < 1 || hasBlendMode) {
116 m_clipRecorder = adoptPtr(new FloatClipRecorder(*m_paintInfo.context, m_ object->displayItemClient(), m_paintInfo.phase, m_object->paintInvalidationRectI nLocalCoordinates())); 116 m_clipRecorder = adoptPtr(new FloatClipRecorder(*m_paintInfo.context, m_ object->displayItemClient(), m_paintInfo.phase, m_object->paintInvalidationRectI nLocalCoordinates()));
117 WebBlendMode blendMode = hasBlendMode ? style.blendMode() : WebBlendMode Normal; 117 WebBlendMode blendMode = hasBlendMode ? style.blendMode() : WebBlendMode Normal;
118 CompositeOperator compositeOp = hasBlendMode ? CompositeSourceOver : m_p aintInfo.context->compositeOperationDeprecated(); 118 CompositeOperator compositeOp = hasBlendMode ? CompositeSourceOver : m_p aintInfo.context->compositeOperationDeprecated();
119 m_compositingRecorder = adoptPtr(new CompositingRecorder(m_paintInfo.con text, m_object->displayItemClient(), compositeOp, blendMode, opacity)); 119 m_compositingRecorder = adoptPtr(new CompositingRecorder(m_paintInfo.con text, m_object->displayItemClient(), WebCoreCompositeToSkiaComposite(compositeOp , blendMode), opacity));
120 } 120 }
121 } 121 }
122 122
123 bool SVGPaintContext::applyClipIfNecessary(SVGResources* resources) 123 bool SVGPaintContext::applyClipIfNecessary(SVGResources* resources)
124 { 124 {
125 // resources->clipper() corresponds to the non-prefixed 'clip-path' whereas 125 // resources->clipper() corresponds to the non-prefixed 'clip-path' whereas
126 // m_object->style()->clipPath() corresponds to '-webkit-clip-path'. 126 // m_object->style()->clipPath() corresponds to '-webkit-clip-path'.
127 // FIXME: We should unify the clip-path and -webkit-clip-path codepaths. 127 // FIXME: We should unify the clip-path and -webkit-clip-path codepaths.
128 if (LayoutSVGResourceClipper* clipper = resources ? resources->clipper() : n ullptr) { 128 if (LayoutSVGResourceClipper* clipper = resources ? resources->clipper() : n ullptr) {
129 if (!clipper->applyStatefulResource(m_object, m_paintInfo.context, m_cli pperState)) 129 if (!clipper->applyStatefulResource(m_object, m_paintInfo.context, m_cli pperState))
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 { 189 {
190 ASSERT(context); 190 ASSERT(context);
191 ASSERT(item); 191 ASSERT(item);
192 ASSERT(!item->needsLayout()); 192 ASSERT(!item->needsLayout());
193 193
194 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal); 194 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal);
195 item->paint(info, IntPoint()); 195 item->paint(info, IntPoint());
196 } 196 }
197 197
198 } // namespace blink 198 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/LayerPainter.cpp ('k') | Source/core/svg/graphics/SVGImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698