1 /* 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann (at) kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis (at) kde.org> 4 * Copyright (C) 2005 Eric Seidel <eric (at) webkit.org> 5 * Copyright (C) 2010 Dirk Schulze <krit (at) webkit.org> 6 * Copyright (C) 2013 Google Inc. All rights reserved. 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Library General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Library General Public License for more details. 17 * 18 * You should have received a copy of the GNU Library General Public License 19 * along with this library; see the file COPYING.LIB. If not, write to 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 * Boston, MA 02110-1301, USA. 22 */ 23 24 #ifndef SVGFEImage_h 25 #define SVGFEImage_h 26 27 #include "core/dom/TreeScope.h" 28 #include "core/svg/SVGPreserveAspectRatio.h" 29 #include "platform/graphics/filters/FilterEffect.h" 30 31 namespace blink { 32 33 class Image; 34 class RenderObject; 35 36 class FEImage FINAL : public FilterEffect { 37 public: 38 static PassRefPtr<FEImage> createWithImage(Filter*, PassRefPtr<Image>, PassRefPtr<SVGPreserveAspectRatio>); 39 static PassRefPtr<FEImage> createWithIRIReference(Filter*, TreeScope&, const String&, PassRefPtr<SVGPreserveAspectRatio>); 40 41 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedRect) OVERRIDE; 42 43 virtual FilterEffectType filterEffectType() const OVERRIDE { return FilterEffectTypeImage; } 44 45 virtual TextStream& externalRepresentation(TextStream&, int indention) const OVERRIDE; 46 virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) OVERRIDE; 47 48 private: 49 virtual ~FEImage() { } 50 FEImage(Filter*, PassRefPtr<Image>, PassRefPtr<SVGPreserveAspectRatio>); 51 FEImage(Filter*, TreeScope&, const String&, PassRefPtr<SVGPreserveAspectRatio>); 52 RenderObject* referencedRenderer() const; 53 54 virtual void applySoftware() OVERRIDE; 55 PassRefPtr<SkImageFilter> createImageFilterForRenderer(RenderObject* rendererer, SkiaImageFilterBuilder*); 56 57 RefPtr<Image> m_image; 58 59 // m_treeScope will never be a dangling reference. See https://bugs.webkit.org/show_bug.cgi?id=99243 60 TreeScope* m_treeScope; 61 String m_href; 62 PassRefPtr<SVGPreserveAspectRatio> m_preserveAspectRatio; 63 }; 64 65 } // namespace blink 66 67 #endif // SVGFEImage_h 68