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 11 matching lines...) Expand all Loading... | |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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/animation/AnimatableVisibility.h" | 32 #include "core/animation/AnimatableSVGPaint.h" |
33 | 33 |
34 namespace WebCore { | 34 namespace WebCore { |
35 | 35 |
36 PassRefPtr<AnimatableValue> AnimatableVisibility::interpolateTo(const Animatable Value* value, double fraction) const | 36 PassRefPtr<AnimatableValue> AnimatableSVGPaint::interpolateTo(const AnimatableVa lue* value, double fraction) const |
37 { | 37 { |
38 EVisibility from = m_visibility; | 38 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); |
39 EVisibility to = toAnimatableVisibility(value)->m_visibility; | 39 if (paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || svgPaint->paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR) |
40 if (from != VISIBLE && to != VISIBLE) | |
41 return defaultInterpolateTo(this, value, fraction); | 40 return defaultInterpolateTo(this, value, fraction); |
42 if (fraction <= 0) | 41 return AnimatableSVGPaint::create(this->paintType(), this->m_color.interpola teTo(svgPaint->m_color, fraction), this->uri()); |
Steve Block
2013/10/03 02:37:53
If you test for (paintType() == SVG_PAINTTYPE_RGBC
dstockwell
2013/10/03 05:01:07
Done.
| |
43 return takeConstRef(this); | |
44 if (fraction >= 1) | |
45 return takeConstRef(value); | |
46 return takeConstRef(from == VISIBLE ? this : value); | |
47 } | 42 } |
48 | 43 |
49 } // namespace WebCore | 44 PassRefPtr<AnimatableValue> AnimatableSVGPaint::addWith(const AnimatableValue* v alue) const |
45 { | |
46 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); | |
47 if (paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || svgPaint->paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR) | |
48 return defaultAddWith(this, value); | |
49 return AnimatableSVGPaint::create(this->paintType(), this->m_color.addWith(s vgPaint->m_color), this->uri()); | |
Steve Block
2013/10/03 02:37:53
Similar comments to above.
dstockwell
2013/10/03 05:01:07
Done.
| |
50 } | |
51 | |
52 } | |
OLD | NEW |