OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Sencha, Inc. All rights reserved. | 3 * Copyright (C) 2010 Sencha, Inc. All rights reserved. |
4 * Copyright (C) 2010 Igalia S.L. All rights reserved. | 4 * Copyright (C) 2010 Igalia S.L. All rights reserved. |
5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 { | 48 { |
49 updateShadowBlurValues(); | 49 updateShadowBlurValues(); |
50 } | 50 } |
51 | 51 |
52 void ShadowBlur::updateShadowBlurValues() | 52 void ShadowBlur::updateShadowBlurValues() |
53 { | 53 { |
54 // Limit blur radius to 128 to avoid lots of very expensive blurring. | 54 // Limit blur radius to 128 to avoid lots of very expensive blurring. |
55 m_blurRadius = m_blurRadius.shrunkTo(FloatSize(128, 128)); | 55 m_blurRadius = m_blurRadius.shrunkTo(FloatSize(128, 128)); |
56 | 56 |
57 // The type of shadow is decided by the blur radius, shadow offset, and shad
ow color. | 57 // The type of shadow is decided by the blur radius, shadow offset, and shad
ow color. |
58 if (!m_color.isValid() || !m_color.alpha()) { | 58 if (!m_color.alpha()) { |
59 // Can't paint the shadow with invalid or invisible color. | 59 // Can't paint the shadow with invalid or invisible color. |
60 m_type = NoShadow; | 60 m_type = NoShadow; |
61 } else if (m_blurRadius.width() > 0 || m_blurRadius.height() > 0) { | 61 } else if (m_blurRadius.width() > 0 || m_blurRadius.height() > 0) { |
62 // Shadow is always blurred, even the offset is zero. | 62 // Shadow is always blurred, even the offset is zero. |
63 m_type = BlurShadow; | 63 m_type = BlurShadow; |
64 } else if (!m_offset.width() && !m_offset.height()) { | 64 } else if (!m_offset.width() && !m_offset.height()) { |
65 // Without blur and zero offset means the shadow is fully hidden. | 65 // Without blur and zero offset means the shadow is fully hidden. |
66 m_type = NoShadow; | 66 m_type = NoShadow; |
67 } else | 67 } else |
68 m_type = SolidShadow; | 68 m_type = SolidShadow; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 if (!m_blurRadius.height()) | 189 if (!m_blurRadius.height()) |
190 break; | 190 break; |
191 | 191 |
192 if (m_blurRadius.width() != m_blurRadius.height()) | 192 if (m_blurRadius.width() != m_blurRadius.height()) |
193 calculateLobes(lobes, m_blurRadius.height(), m_shadowsIgnoreTransfor
ms); | 193 calculateLobes(lobes, m_blurRadius.height(), m_shadowsIgnoreTransfor
ms); |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 } // namespace WebCore | 197 } // namespace WebCore |
OLD | NEW |