OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "platform/graphics/Color.h" | 24 #include "platform/graphics/Color.h" |
25 #include "platform/graphics/filters/FilterEffect.h" | 25 #include "platform/graphics/filters/FilterEffect.h" |
26 | 26 |
27 namespace blink { | 27 namespace blink { |
28 | 28 |
29 class PLATFORM_EXPORT FEDropShadow final : public FilterEffect { | 29 class PLATFORM_EXPORT FEDropShadow final : public FilterEffect { |
30 public: | 30 public: |
31 static FEDropShadow* | 31 static FEDropShadow* |
32 create(Filter*, float, float, float, float, const Color&, float); | 32 create(Filter*, float, float, float, float, const Color&, float); |
33 | 33 |
| 34 // Compute which destination area will be affected when applying a drop |
| 35 // shadow effect with |stdDeviation| and |offset| to an area |rect|. |
| 36 static FloatRect mapEffect(const FloatSize& stdDeviation, |
| 37 const FloatPoint& offset, |
| 38 const FloatRect&); |
| 39 |
34 void setShadowColor(const Color& color) { m_shadowColor = color; } | 40 void setShadowColor(const Color& color) { m_shadowColor = color; } |
35 void setShadowOpacity(float opacity) { m_shadowOpacity = opacity; } | 41 void setShadowOpacity(float opacity) { m_shadowOpacity = opacity; } |
36 | 42 |
37 TextStream& externalRepresentation(TextStream&, int indention) const override; | 43 TextStream& externalRepresentation(TextStream&, int indention) const override; |
38 | 44 |
39 private: | 45 private: |
40 FEDropShadow(Filter*, float, float, float, float, const Color&, float); | 46 FEDropShadow(Filter*, float, float, float, float, const Color&, float); |
41 | 47 |
42 FloatRect mapEffect(const FloatRect&) const override; | 48 FloatRect mapEffect(const FloatRect&) const override; |
43 | 49 |
44 sk_sp<SkImageFilter> createImageFilter() override; | 50 sk_sp<SkImageFilter> createImageFilter() override; |
45 | 51 |
46 float m_stdX; | 52 float m_stdX; |
47 float m_stdY; | 53 float m_stdY; |
48 float m_dx; | 54 float m_dx; |
49 float m_dy; | 55 float m_dy; |
50 Color m_shadowColor; | 56 Color m_shadowColor; |
51 float m_shadowOpacity; | 57 float m_shadowOpacity; |
52 }; | 58 }; |
53 | 59 |
54 } // namespace blink | 60 } // namespace blink |
55 | 61 |
56 #endif // FEDropShadow_h | 62 #endif // FEDropShadow_h |
OLD | NEW |