1/* 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21#ifndef SVGFilter_h 22#define SVGFilter_h 23 24#if ENABLE(FILTERS) 25#include "AffineTransform.h" 26#include "Filter.h" 27#include "FilterEffect.h" 28#include "FloatRect.h" 29#include "FloatSize.h" 30 31#include <wtf/PassRefPtr.h> 32#include <wtf/RefCounted.h> 33#include <wtf/RefPtr.h> 34 35namespace WebCore { 36 37class SVGFilter : public Filter { 38public: 39 static PassRefPtr<SVGFilter> create(const AffineTransform&, const FloatRect&, const FloatRect&, const FloatRect&, bool); 40 41 FloatRect filterRegionInUserSpace() const { return m_filterRegion; } 42 virtual FloatRect filterRegion() const override { return m_absoluteFilterRegion; } 43 44 virtual float applyHorizontalScale(float value) const override; 45 virtual float applyVerticalScale(float value) const override; 46 47 virtual FloatRect sourceImageRect() const override { return m_absoluteSourceDrawingRegion; } 48 FloatRect targetBoundingBox() const { return m_targetBoundingBox; } 49 50 virtual bool isSVGFilter() const override final { return true; } 51 52private: 53 SVGFilter(const AffineTransform& absoluteTransform, const FloatRect& absoluteSourceDrawingRegion, const FloatRect& targetBoundingBox, const FloatRect& filterRegion, bool effectBBoxMode); 54 55 FloatRect m_absoluteSourceDrawingRegion; 56 FloatRect m_targetBoundingBox; 57 FloatRect m_absoluteFilterRegion; 58 FloatRect m_filterRegion; 59 bool m_effectBBoxMode; 60}; 61 62FILTER_TYPE_CASTS(SVGFilter, isSVGFilter()) 63 64} // namespace WebCore 65 66#endif // ENABLE(FILTERS) 67 68#endif // SVGFilter_h 69