OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/rendering/style/ShadowList.h" | 32 #include "core/rendering/style/ShadowList.h" |
33 | 33 |
34 #include "platform/geometry/FloatRect.h" | 34 #include "platform/geometry/FloatRect.h" |
| 35 #include "wtf/OwnPtr.h" |
35 | 36 |
36 namespace WebCore { | 37 namespace WebCore { |
37 | 38 |
38 static inline void calculateShadowExtent(const ShadowList* shadowList, float add
itionalOutlineSize, float& shadowLeft, float& shadowRight, float& shadowTop, flo
at& shadowBottom) | 39 static inline void calculateShadowExtent(const ShadowList* shadowList, float add
itionalOutlineSize, float& shadowLeft, float& shadowRight, float& shadowTop, flo
at& shadowBottom) |
39 { | 40 { |
40 ASSERT(shadowList); | 41 ASSERT(shadowList); |
41 size_t shadowCount = shadowList->shadows().size(); | 42 size_t shadowCount = shadowList->shadows().size(); |
42 for (size_t i = 0; i < shadowCount; ++i) { | 43 for (size_t i = 0; i < shadowCount; ++i) { |
43 const ShadowData& shadow = shadowList->shadows()[i]; | 44 const ShadowData& shadow = shadowList->shadows()[i]; |
44 if (shadow.style() == Inset) | 45 if (shadow.style() == Inset) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (!fromShadow) | 91 if (!fromShadow) |
91 fromShadow = toShadow->style() == Inset ? &defaultInsetShadowData :
&defaultShadowData; | 92 fromShadow = toShadow->style() == Inset ? &defaultInsetShadowData :
&defaultShadowData; |
92 else if (!toShadow) | 93 else if (!toShadow) |
93 toShadow = fromShadow->style() == Inset ? &defaultInsetShadowData :
&defaultShadowData; | 94 toShadow = fromShadow->style() == Inset ? &defaultInsetShadowData :
&defaultShadowData; |
94 shadows.append(toShadow->blend(*fromShadow, progress)); | 95 shadows.append(toShadow->blend(*fromShadow, progress)); |
95 } | 96 } |
96 | 97 |
97 return ShadowList::adopt(shadows); | 98 return ShadowList::adopt(shadows); |
98 } | 99 } |
99 | 100 |
| 101 PassOwnPtr<DrawLooperBuilder> ShadowList::createDrawLooper(DrawLooperBuilder::Sh
adowAlphaMode alphaMode, bool isHorizontal) const |
| 102 { |
| 103 OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); |
| 104 for (size_t i = shadows().size(); i--; ) { |
| 105 const ShadowData& shadow = shadows()[i]; |
| 106 float shadowX = isHorizontal ? shadow.x() : shadow.y(); |
| 107 float shadowY = isHorizontal ? shadow.y() : -shadow.x(); |
| 108 drawLooperBuilder->addShadow(FloatSize(shadowX, shadowY), shadow.blur(),
shadow.color(), |
| 109 DrawLooperBuilder::ShadowRespectsTransforms, alphaMode); |
| 110 } |
| 111 drawLooperBuilder->addUnmodifiedContent(); |
| 112 return drawLooperBuilder.release(); |
| 113 } |
| 114 |
100 } // namespace WebCore | 115 } // namespace WebCore |
OLD | NEW |