Home | History | Annotate | Download | only in filters
      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/platform/graphics/filters/FilterEffect.h"
     28 #include "core/svg/SVGPreserveAspectRatio.h"
     29 
     30 namespace WebCore {
     31 
     32 class Document;
     33 class Image;
     34 class RenderObject;
     35 
     36 class FEImage : public FilterEffect {
     37 public:
     38     static PassRefPtr<FEImage> createWithImage(Filter*, PassRefPtr<Image>, const SVGPreserveAspectRatio&);
     39     static PassRefPtr<FEImage> createWithIRIReference(Filter*, Document*, const String&, const SVGPreserveAspectRatio&);
     40 
     41     virtual void determineAbsolutePaintRect();
     42 
     43     virtual FilterEffectType filterEffectType() const { return FilterEffectTypeImage; }
     44 
     45     virtual TextStream& externalRepresentation(TextStream&, int indention) const;
     46     virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) OVERRIDE;
     47 
     48 private:
     49     virtual ~FEImage() { }
     50     FEImage(Filter*, PassRefPtr<Image>, const SVGPreserveAspectRatio&);
     51     FEImage(Filter*, Document*, const String&, const SVGPreserveAspectRatio&);
     52     RenderObject* referencedRenderer() const;
     53 
     54     virtual void applySoftware() OVERRIDE;
     55 
     56     RefPtr<Image> m_image;
     57 
     58     // m_document will never be a dangling reference. See https://bugs.webkit.org/show_bug.cgi?id=99243
     59     Document* m_document;
     60     String m_href;
     61     SVGPreserveAspectRatio m_preserveAspectRatio;
     62 };
     63 
     64 } // namespace WebCore
     65 
     66 #endif // SVGFEImage_h
     67