| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/SVGFilterPainter.h" | 6 #include "core/paint/SVGFilterPainter.h" |
| 7 | 7 |
| 8 #include "core/layout/PaintInfo.h" | 8 #include "core/layout/PaintInfo.h" |
| 9 #include "core/layout/svg/LayoutSVGResourceFilter.h" | 9 #include "core/layout/svg/LayoutSVGResourceFilter.h" |
| 10 #include "core/paint/CompositingRecorder.h" | 10 #include "core/paint/CompositingRecorder.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 filterData->m_displayItemList = nullptr; | 61 filterData->m_displayItemList = nullptr; |
| 62 filterData->m_context = nullptr; | 62 filterData->m_context = nullptr; |
| 63 } | 63 } |
| 64 | 64 |
| 65 filterData->m_state = FilterData::ReadyToPaint; | 65 filterData->m_state = FilterData::ReadyToPaint; |
| 66 } | 66 } |
| 67 | 67 |
| 68 static void paintFilteredContent(GraphicsContext* context, FilterData* filterDat
a, SVGFilterElement* filterElement) | 68 static void paintFilteredContent(GraphicsContext* context, FilterData* filterDat
a, SVGFilterElement* filterElement) |
| 69 { | 69 { |
| 70 ASSERT(filterData->m_state == FilterData::ReadyToPaint); | 70 ASSERT(filterData->m_state == FilterData::ReadyToPaint); |
| 71 ASSERT(filterData->builder->getEffectById(SourceGraphic::effectName())); |
| 72 |
| 71 filterData->m_state = FilterData::PaintingFilter; | 73 filterData->m_state = FilterData::PaintingFilter; |
| 72 | 74 |
| 73 SkiaImageFilterBuilder builder(context); | 75 SkiaImageFilterBuilder builder(context); |
| 74 SourceGraphic* sourceGraphic = static_cast<SourceGraphic*>(filterData->build
er->getEffectById(SourceGraphic::effectName())); | |
| 75 ASSERT(sourceGraphic); | |
| 76 builder.setSourceGraphic(sourceGraphic); | |
| 77 RefPtr<SkImageFilter> imageFilter = builder.build(filterData->builder->lastE
ffect(), ColorSpaceDeviceRGB); | 76 RefPtr<SkImageFilter> imageFilter = builder.build(filterData->builder->lastE
ffect(), ColorSpaceDeviceRGB); |
| 78 FloatRect boundaries = filterData->boundaries; | 77 FloatRect boundaries = filterData->boundaries; |
| 79 context->save(); | 78 context->save(); |
| 80 | 79 |
| 81 // Clip drawing of filtered image to the minimum required paint rect. | 80 // Clip drawing of filtered image to the minimum required paint rect. |
| 82 FilterEffect* lastEffect = filterData->builder->lastEffect(); | 81 FilterEffect* lastEffect = filterData->builder->lastEffect(); |
| 83 context->clipRect(lastEffect->determineAbsolutePaintRect(lastEffect->maxEffe
ctRect())); | 82 context->clipRect(lastEffect->determineAbsolutePaintRect(lastEffect->maxEffe
ctRect())); |
| 84 if (filterElement->hasAttribute(SVGNames::filterResAttr)) { | 83 if (filterElement->hasAttribute(SVGNames::filterResAttr)) { |
| 85 // Get boundaries in device coords. | 84 // Get boundaries in device coords. |
| 86 // FIXME: See crbug.com/382491. Is the use of getCTM OK here, given it d
oes not include device | 85 // FIXME: See crbug.com/382491. Is the use of getCTM OK here, given it d
oes not include device |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 189 |
| 191 LayoutObjectDrawingRecorder recorder(*context, object, DisplayItem::SVGFilte
r, LayoutRect::infiniteIntRect()); | 190 LayoutObjectDrawingRecorder recorder(*context, object, DisplayItem::SVGFilte
r, LayoutRect::infiniteIntRect()); |
| 192 if (recorder.canUseCachedDrawing()) | 191 if (recorder.canUseCachedDrawing()) |
| 193 return; | 192 return; |
| 194 | 193 |
| 195 if (filterData && filterData->m_state == FilterData::ReadyToPaint) | 194 if (filterData && filterData->m_state == FilterData::ReadyToPaint) |
| 196 paintFilteredContent(context, filterData, toSVGFilterElement(m_filter.el
ement())); | 195 paintFilteredContent(context, filterData, toSVGFilterElement(m_filter.el
ement())); |
| 197 } | 196 } |
| 198 | 197 |
| 199 } | 198 } |
| OLD | NEW |