OLD | NEW |
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 return false; | 94 return false; |
95 | 95 |
96 if (isSVGRoot) { | 96 if (isSVGRoot) { |
97 DCHECK(!m_object.styleRef().hasFilter() || m_object.hasLayer()); | 97 DCHECK(!m_object.styleRef().hasFilter() || m_object.hasLayer()); |
98 } else if (!applyFilterIfNecessary(resources)) { | 98 } else if (!applyFilterIfNecessary(resources)) { |
99 return false; | 99 return false; |
100 } | 100 } |
101 | 101 |
102 if (!isIsolationInstalled() && | 102 if (!isIsolationInstalled() && |
103 SVGLayoutSupport::isIsolationRequired(&m_object)) { | 103 SVGLayoutSupport::isIsolationRequired(&m_object)) { |
104 m_compositingRecorder = wrapUnique(new CompositingRecorder( | 104 m_compositingRecorder = WTF::wrapUnique(new CompositingRecorder( |
105 paintInfo().context, m_object, SkBlendMode::kSrcOver, 1)); | 105 paintInfo().context, m_object, SkBlendMode::kSrcOver, 1)); |
106 } | 106 } |
107 | 107 |
108 return true; | 108 return true; |
109 } | 109 } |
110 | 110 |
111 void SVGPaintContext::applyCompositingIfNecessary() { | 111 void SVGPaintContext::applyCompositingIfNecessary() { |
112 DCHECK(!paintInfo().isRenderingClipPathAsMaskImage()); | 112 DCHECK(!paintInfo().isRenderingClipPathAsMaskImage()); |
113 | 113 |
114 const ComputedStyle& style = m_object.styleRef(); | 114 const ComputedStyle& style = m_object.styleRef(); |
115 float opacity = style.opacity(); | 115 float opacity = style.opacity(); |
116 WebBlendMode blendMode = style.hasBlendMode() && m_object.isBlendingAllowed() | 116 WebBlendMode blendMode = style.hasBlendMode() && m_object.isBlendingAllowed() |
117 ? style.blendMode() | 117 ? style.blendMode() |
118 : WebBlendModeNormal; | 118 : WebBlendModeNormal; |
119 if (opacity < 1 || blendMode != WebBlendModeNormal) { | 119 if (opacity < 1 || blendMode != WebBlendModeNormal) { |
120 const FloatRect compositingBounds = | 120 const FloatRect compositingBounds = |
121 m_object.visualRectInLocalSVGCoordinates(); | 121 m_object.visualRectInLocalSVGCoordinates(); |
122 m_compositingRecorder = wrapUnique(new CompositingRecorder( | 122 m_compositingRecorder = WTF::wrapUnique(new CompositingRecorder( |
123 paintInfo().context, m_object, | 123 paintInfo().context, m_object, |
124 WebCoreCompositeToSkiaComposite(CompositeSourceOver, blendMode), | 124 WebCoreCompositeToSkiaComposite(CompositeSourceOver, blendMode), |
125 opacity, &compositingBounds)); | 125 opacity, &compositingBounds)); |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 void SVGPaintContext::applyClipIfNecessary() { | 129 void SVGPaintContext::applyClipIfNecessary() { |
130 ClipPathOperation* clipPathOperation = m_object.styleRef().clipPath(); | 130 ClipPathOperation* clipPathOperation = m_object.styleRef().clipPath(); |
131 if (!clipPathOperation) | 131 if (!clipPathOperation) |
132 return; | 132 return; |
(...skipping 21 matching lines...) Expand all Loading... |
154 } | 154 } |
155 | 155 |
156 bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources) { | 156 bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources) { |
157 if (!resources) | 157 if (!resources) |
158 return !hasReferenceFilterOnly(m_object.styleRef()); | 158 return !hasReferenceFilterOnly(m_object.styleRef()); |
159 | 159 |
160 LayoutSVGResourceFilter* filter = resources->filter(); | 160 LayoutSVGResourceFilter* filter = resources->filter(); |
161 if (!filter) | 161 if (!filter) |
162 return true; | 162 return true; |
163 m_filterRecordingContext = | 163 m_filterRecordingContext = |
164 wrapUnique(new SVGFilterRecordingContext(paintInfo().context)); | 164 WTF::wrapUnique(new SVGFilterRecordingContext(paintInfo().context)); |
165 m_filter = filter; | 165 m_filter = filter; |
166 GraphicsContext* filterContext = SVGFilterPainter(*filter).prepareEffect( | 166 GraphicsContext* filterContext = SVGFilterPainter(*filter).prepareEffect( |
167 m_object, *m_filterRecordingContext); | 167 m_object, *m_filterRecordingContext); |
168 if (!filterContext) | 168 if (!filterContext) |
169 return false; | 169 return false; |
170 | 170 |
171 // Because the filter needs to cache its contents we replace the context | 171 // Because the filter needs to cache its contents we replace the context |
172 // during filtering with the filter's context. | 172 // during filtering with the filter's context. |
173 m_filterPaintInfo = wrapUnique(new PaintInfo(*filterContext, m_paintInfo)); | 173 m_filterPaintInfo = |
| 174 WTF::wrapUnique(new PaintInfo(*filterContext, m_paintInfo)); |
174 | 175 |
175 // Because we cache the filter contents and do not invalidate on paint | 176 // Because we cache the filter contents and do not invalidate on paint |
176 // invalidation rect changes, we need to paint the entire filter region | 177 // invalidation rect changes, we need to paint the entire filter region |
177 // so elements outside the initial paint (due to scrolling, etc) paint. | 178 // so elements outside the initial paint (due to scrolling, etc) paint. |
178 m_filterPaintInfo->m_cullRect.m_rect = LayoutRect::infiniteIntRect(); | 179 m_filterPaintInfo->m_cullRect.m_rect = LayoutRect::infiniteIntRect(); |
179 return true; | 180 return true; |
180 } | 181 } |
181 | 182 |
182 bool SVGPaintContext::isIsolationInstalled() const { | 183 bool SVGPaintContext::isIsolationInstalled() const { |
183 if (m_compositingRecorder) | 184 if (m_compositingRecorder) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // though. | 241 // though. |
241 // Additionally, it's not really safe/guaranteed to be correct, as | 242 // Additionally, it's not really safe/guaranteed to be correct, as |
242 // something down the paint pipe may want to farther tweak the color | 243 // something down the paint pipe may want to farther tweak the color |
243 // filter, which could yield incorrect results. (Consider just using | 244 // filter, which could yield incorrect results. (Consider just using |
244 // saveLayer() w/ this color filter explicitly instead.) | 245 // saveLayer() w/ this color filter explicitly instead.) |
245 paint.setColorFilter(sk_ref_sp(paintInfo.context.getColorFilter())); | 246 paint.setColorFilter(sk_ref_sp(paintInfo.context.getColorFilter())); |
246 return true; | 247 return true; |
247 } | 248 } |
248 | 249 |
249 } // namespace blink | 250 } // namespace blink |
OLD | NEW |