• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) Research In Motion Limited 2011. All rights reserved.
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 FEDropShadow_h
22 #define FEDropShadow_h
23 
24 #include "platform/graphics/Color.h"
25 #include "platform/graphics/filters/Filter.h"
26 #include "platform/graphics/filters/FilterEffect.h"
27 
28 namespace WebCore {
29 
30 class PLATFORM_EXPORT FEDropShadow : public FilterEffect {
31 public:
32     static PassRefPtr<FEDropShadow> create(Filter*, float, float, float, float, const Color&, float);
33 
stdDeviationX()34     float stdDeviationX() const { return m_stdX; }
setStdDeviationX(float stdX)35     void setStdDeviationX(float stdX) { m_stdX = stdX; }
36 
stdDeviationY()37     float stdDeviationY() const { return m_stdY; }
setStdDeviationY(float stdY)38     void setStdDeviationY(float stdY) { m_stdY = stdY; }
39 
dx()40     float dx() const { return m_dx; }
setDx(float dx)41     void setDx(float dx) { m_dx = dx; }
42 
dy()43     float dy() const { return m_dy; }
setDy(float dy)44     void setDy(float dy) { m_dy = dy; }
45 
shadowColor()46     Color shadowColor() const { return m_shadowColor; }
setShadowColor(const Color & shadowColor)47     void setShadowColor(const Color& shadowColor) { m_shadowColor = shadowColor; }
48 
shadowOpacity()49     float shadowOpacity() const { return m_shadowOpacity; }
setShadowOpacity(float shadowOpacity)50     void setShadowOpacity(float shadowOpacity) { m_shadowOpacity = shadowOpacity; }
51 
52     static float calculateStdDeviation(float);
53 
54     virtual void determineAbsolutePaintRect();
55     virtual FloatRect mapRect(const FloatRect&, bool forward = true) OVERRIDE FINAL;
56 
57     virtual TextStream& externalRepresentation(TextStream&, int indention) const;
58     virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) OVERRIDE;
59 
60 private:
61     FEDropShadow(Filter*, float, float, float, float, const Color&, float);
62 
63     virtual void applySoftware() OVERRIDE;
64 
65     float m_stdX;
66     float m_stdY;
67     float m_dx;
68     float m_dy;
69     Color m_shadowColor;
70     float m_shadowOpacity;
71 };
72 
73 } // namespace WebCore
74 
75 #endif // FEDropShadow_h
76