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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 if (!SVGMaskPainter(*masker).prepareEffect(m_object, paintInfo().context
)) | 140 if (!SVGMaskPainter(*masker).prepareEffect(m_object, paintInfo().context
)) |
141 return false; | 141 return false; |
142 m_masker = masker; | 142 m_masker = masker; |
143 } | 143 } |
144 return true; | 144 return true; |
145 } | 145 } |
146 | 146 |
147 bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources) | 147 bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources) |
148 { | 148 { |
149 if (!resources) { | 149 if (!resources) { |
150 if (m_object.style()->svgStyle().hasFilter()) | 150 if (m_object.style()->hasFilter()) |
151 return false; | 151 return false; // Do not allow a draw: the SVG filter is invalid. |
152 } else if (LayoutSVGResourceFilter* filter = resources->filter()) { | 152 return true; |
| 153 } |
| 154 |
| 155 if (LayoutSVGResourceFilter* filter = resources->filter()) { |
| 156 // The root element's filter is applied by the layer filter painter. |
| 157 if (m_object.isSVGRoot() && m_object.hasLayer()) |
| 158 return true; |
| 159 |
153 m_filterRecordingContext = adoptPtr(new SVGFilterRecordingContext(paintI
nfo().context)); | 160 m_filterRecordingContext = adoptPtr(new SVGFilterRecordingContext(paintI
nfo().context)); |
154 m_filter = filter; | 161 m_filter = filter; |
155 GraphicsContext* filterContext = SVGFilterPainter(*filter).prepareEffect
(m_object, *m_filterRecordingContext); | 162 GraphicsContext* filterContext = SVGFilterPainter(*filter).prepareEffect
(m_object, *m_filterRecordingContext); |
156 if (!filterContext) | 163 if (!filterContext) |
157 return false; | 164 return false; |
158 | 165 |
159 // Because the filter needs to cache its contents we replace the context | 166 // Because the filter needs to cache its contents we replace the context |
160 // during filtering with the filter's context. | 167 // during filtering with the filter's context. |
161 m_filterPaintInfo = adoptPtr(new PaintInfo(*filterContext, m_paintInfo))
; | 168 m_filterPaintInfo = adoptPtr(new PaintInfo(*filterContext, m_paintInfo))
; |
162 | 169 |
163 // Because we cache the filter contents and do not invalidate on paint | 170 // Because we cache the filter contents and do not invalidate on paint |
164 // invalidation rect changes, we need to paint the entire filter region | 171 // invalidation rect changes, we need to paint the entire filter region |
165 // so elements outside the initial paint (due to scrolling, etc) paint. | 172 // so elements outside the initial paint (due to scrolling, etc) paint. |
166 m_filterPaintInfo->m_cullRect.m_rect = LayoutRect::infiniteIntRect(); | 173 m_filterPaintInfo->m_cullRect.m_rect = LayoutRect::infiniteIntRect(); |
167 } | 174 } |
| 175 |
168 return true; | 176 return true; |
169 } | 177 } |
170 | 178 |
171 bool SVGPaintContext::isIsolationInstalled() const | 179 bool SVGPaintContext::isIsolationInstalled() const |
172 { | 180 { |
173 if (m_compositingRecorder) | 181 if (m_compositingRecorder) |
174 return true; | 182 return true; |
175 if (m_masker || m_filter) | 183 if (m_masker || m_filter) |
176 return true; | 184 return true; |
177 if (m_clipper && m_clipperState == SVGClipPainter::ClipperAppliedMask) | 185 if (m_clipper && m_clipperState == SVGClipPainter::ClipperAppliedMask) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // though. | 230 // though. |
223 // Additionally, it's not really safe/guaranteed to be correct, as | 231 // Additionally, it's not really safe/guaranteed to be correct, as |
224 // something down the paint pipe may want to farther tweak the color | 232 // something down the paint pipe may want to farther tweak the color |
225 // filter, which could yield incorrect results. (Consider just using | 233 // filter, which could yield incorrect results. (Consider just using |
226 // saveLayer() w/ this color filter explicitly instead.) | 234 // saveLayer() w/ this color filter explicitly instead.) |
227 paint.setColorFilter(sk_ref_sp(paintInfo.context.colorFilter())); | 235 paint.setColorFilter(sk_ref_sp(paintInfo.context.colorFilter())); |
228 return true; | 236 return true; |
229 } | 237 } |
230 | 238 |
231 } // namespace blink | 239 } // namespace blink |
OLD | NEW |