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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #include "core/frame/FrameHost.h" | 28 #include "core/frame/FrameHost.h" |
29 #include "core/layout/Layer.h" | 29 #include "core/layout/Layer.h" |
30 #include "core/layout/PaintInfo.h" | 30 #include "core/layout/PaintInfo.h" |
31 #include "core/layout/svg/LayoutSVGResourceFilter.h" | 31 #include "core/layout/svg/LayoutSVGResourceFilter.h" |
32 #include "core/layout/svg/LayoutSVGResourceMasker.h" | 32 #include "core/layout/svg/LayoutSVGResourceMasker.h" |
33 #include "core/layout/svg/SVGLayoutSupport.h" | 33 #include "core/layout/svg/SVGLayoutSupport.h" |
34 #include "core/layout/svg/SVGResources.h" | 34 #include "core/layout/svg/SVGResources.h" |
35 #include "core/layout/svg/SVGResourcesCache.h" | 35 #include "core/layout/svg/SVGResourcesCache.h" |
36 #include "core/paint/LayoutObjectDrawingRecorder.h" | 36 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 37 #include "core/paint/SVGFilterPainter.h" |
37 #include "core/paint/SVGMaskPainter.h" | 38 #include "core/paint/SVGMaskPainter.h" |
38 #include "platform/FloatConversion.h" | 39 #include "platform/FloatConversion.h" |
39 | 40 |
40 namespace blink { | 41 namespace blink { |
41 | 42 |
42 SVGPaintContext::~SVGPaintContext() | 43 SVGPaintContext::~SVGPaintContext() |
43 { | 44 { |
44 if (m_filter) { | 45 if (m_filter) { |
45 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); | 46 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); |
46 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->filt
er() == m_filter); | 47 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->filt
er() == m_filter); |
47 | 48 |
48 LayoutObjectDrawingRecorder recorder(m_originalPaintInfo->context, *m_ob
ject, DisplayItem::SVGFilter, LayoutRect::infiniteIntRect()); | 49 LayoutObjectDrawingRecorder recorder(m_originalPaintInfo->context, *m_ob
ject, DisplayItem::SVGFilter, LayoutRect::infiniteIntRect()); |
49 if (!recorder.canUseCachedDrawing()) | 50 if (!recorder.canUseCachedDrawing()) |
50 m_filter->finishEffect(m_object, m_originalPaintInfo->context); | 51 SVGFilterPainter(*m_filter).finishEffect(m_object, m_originalPaintIn
fo->context); |
51 | 52 |
52 // Reset the paint info after the filter effect has been completed. | 53 // Reset the paint info after the filter effect has been completed. |
53 // This isn't strictly required (e.g., m_paintInfo.rect is not used | 54 // This isn't strictly required (e.g., m_paintInfo.rect is not used |
54 // after this). | 55 // after this). |
55 m_paintInfo.context = m_originalPaintInfo->context; | 56 m_paintInfo.context = m_originalPaintInfo->context; |
56 m_paintInfo.rect = m_originalPaintInfo->rect; | 57 m_paintInfo.rect = m_originalPaintInfo->rect; |
57 } | 58 } |
58 | 59 |
59 if (m_masker) { | 60 if (m_masker) { |
60 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); | 61 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return true; | 154 return true; |
154 } | 155 } |
155 | 156 |
156 bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources) | 157 bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources) |
157 { | 158 { |
158 if (!resources) { | 159 if (!resources) { |
159 if (m_object->style()->svgStyle().hasFilter()) | 160 if (m_object->style()->svgStyle().hasFilter()) |
160 return false; | 161 return false; |
161 } else if (LayoutSVGResourceFilter* filter = resources->filter()) { | 162 } else if (LayoutSVGResourceFilter* filter = resources->filter()) { |
162 m_filter = filter; | 163 m_filter = filter; |
163 GraphicsContext* filterContext = filter->prepareEffect(m_object, m_paint
Info.context); | 164 GraphicsContext* filterContext = SVGFilterPainter(*filter).prepareEffect
(m_object, m_paintInfo.context); |
164 if (!filterContext) | 165 if (!filterContext) |
165 return false; | 166 return false; |
166 | 167 |
167 // Because the filter needs to cache its contents we replace the context | 168 // Because the filter needs to cache its contents we replace the context |
168 // during filtering with the filter's context. | 169 // during filtering with the filter's context. |
169 m_paintInfo.context = filterContext; | 170 m_paintInfo.context = filterContext; |
170 | 171 |
171 // Because we cache the filter contents and do not invalidate on paint | 172 // Because we cache the filter contents and do not invalidate on paint |
172 // invalidation rect changes, we need to paint the entire filter region | 173 // invalidation rect changes, we need to paint the entire filter region |
173 // so elements outside the initial paint (due to scrolling, etc) paint. | 174 // so elements outside the initial paint (due to scrolling, etc) paint. |
(...skipping 17 matching lines...) Expand all Loading... |
191 { | 192 { |
192 ASSERT(context); | 193 ASSERT(context); |
193 ASSERT(item); | 194 ASSERT(item); |
194 ASSERT(!item->needsLayout()); | 195 ASSERT(!item->needsLayout()); |
195 | 196 |
196 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground,
PaintBehaviorNormal); | 197 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground,
PaintBehaviorNormal); |
197 item->paint(info, IntPoint()); | 198 item->paint(info, IntPoint()); |
198 } | 199 } |
199 | 200 |
200 } // namespace blink | 201 } // namespace blink |
OLD | NEW |