Changeset 76358 in webkit
- Timestamp:
- Jan 21, 2011 10:31:02 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76357 r76358 1 2011-01-21 Adam Roben <aroben@apple.com> 2 3 Clean up PlatformCAAnimationWin 4 5 Fixes <http://webkit.org/b/52904> PlatformCAAnimationWin is leaky and inefficient 6 7 Reviewed by Simon Fraser. 8 9 * platform/graphics/ca/win/PlatformCAAnimationWin.cpp: 10 (toCACFFillModeType): 11 (fromCACFFillModeType): 12 (toCACFValueFunctionType): 13 (fromCACFValueFunctionType): 14 Changed to take and return CFStringRefs. There's no need to convert to WebCore::String just 15 so we can later convert back to CFStringRef. 16 17 (toCACFTimingFunction): Fixed leaks by changing this to return a RetainPtr and adopting the 18 results of CACFTimingFunctionCreate. 19 (PlatformCAAnimation::PlatformCAAnimation): Changed not to needlessly roundtrip through 20 WebCore::String. Also changed an ASSERT(0) to ASSERT_NOT_REACHED(). 21 22 (PlatformCAAnimation::setFillMode): 23 (PlatformCAAnimation::setTimingFunction): 24 (PlatformCAAnimation::setValueFunction): 25 (PlatformCAAnimation::setTimingFunctions): 26 Updated for changes to the above conversion functions. 27 1 28 2011-01-21 Charlie Reis <creis@chromium.org> 2 29 -
trunk/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp
r75262 r76358 42 42 using namespace WebCore; 43 43 44 static StringtoCACFFillModeType(PlatformCAAnimation::FillModeType type)44 static CFStringRef toCACFFillModeType(PlatformCAAnimation::FillModeType type) 45 45 { 46 46 switch (type) { … … 50 50 case PlatformCAAnimation::Both: return kCACFFillModeBoth; 51 51 } 52 return ""; 53 } 54 55 static PlatformCAAnimation::FillModeType fromCACFFillModeType(const String& string) 52 ASSERT_NOT_REACHED(); 53 return 0; 54 } 55 56 static PlatformCAAnimation::FillModeType fromCACFFillModeType(CFStringRef string) 56 57 { 57 58 if (string == kCACFFillModeBackwards) … … 64 65 } 65 66 66 static StringtoCACFValueFunctionType(PlatformCAAnimation::ValueFunctionType type)67 static CFStringRef toCACFValueFunctionType(PlatformCAAnimation::ValueFunctionType type) 67 68 { 68 69 switch (type) { 69 case PlatformCAAnimation::NoValueFunction: return "";70 case PlatformCAAnimation::NoValueFunction: return 0; 70 71 case PlatformCAAnimation::RotateX: return kCACFValueFunctionRotateX; 71 72 case PlatformCAAnimation::RotateY: return kCACFValueFunctionRotateY; … … 80 81 case PlatformCAAnimation::Translate: return kCACFValueFunctionTranslate; 81 82 } 82 return ""; 83 } 84 85 static PlatformCAAnimation::ValueFunctionType fromCACFValueFunctionType(const String string) 83 ASSERT_NOT_REACHED(); 84 return 0; 85 } 86 87 static PlatformCAAnimation::ValueFunctionType fromCACFValueFunctionType(CFStringRef string) 86 88 { 87 89 if (string == kCACFValueFunctionRotateX) … … 121 123 } 122 124 123 static CACFTimingFunctionReftoCACFTimingFunction(const TimingFunction* timingFunction)125 static RetainPtr<CACFTimingFunctionRef> toCACFTimingFunction(const TimingFunction* timingFunction) 124 126 { 125 127 if (!timingFunction) 126 return CACFTimingFunctionCreate(0.25f, 0.1f, 0.25f, 0.1f);128 return RetainPtr<CACFTimingFunctionRef>(AdoptCF, CACFTimingFunctionCreate(0.25f, 0.1f, 0.25f, 0.1f)); 127 129 128 130 if (timingFunction->isCubicBezierTimingFunction()) { 129 131 const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(timingFunction); 130 return CACFTimingFunctionCreate(static_cast<float>(ctf->x1()), static_cast<float>(ctf->y1()), static_cast<float>(ctf->x2()), static_cast<float>(ctf->y2()));132 return RetainPtr<CACFTimingFunctionRef>(AdoptCF, CACFTimingFunctionCreate(static_cast<float>(ctf->x1()), static_cast<float>(ctf->y1()), static_cast<float>(ctf->x2()), static_cast<float>(ctf->y2()))); 131 133 } 132 134 … … 163 165 PlatformCAAnimation::PlatformCAAnimation(PlatformAnimationRef animation) 164 166 { 165 if ( String(CACFAnimationGetClass(animation)) == kCACFBasicAnimation)167 if (CACFAnimationGetClass(animation) == kCACFBasicAnimation) 166 168 m_type = Basic; 167 else if ( String(CACFAnimationGetClass(animation)) == kCACFKeyframeAnimation)169 else if (CACFAnimationGetClass(animation) == kCACFKeyframeAnimation) 168 170 m_type = Keyframe; 169 171 else { 170 ASSERT (0);172 ASSERT_NOT_REACHED(); 171 173 return; 172 174 } … … 290 292 void PlatformCAAnimation::setFillMode(FillModeType value) 291 293 { 292 RetainPtr<CFStringRef> keyPath(AdoptCF, toCACFFillModeType(value).createCFString()); 293 CACFAnimationSetFillMode(m_animation.get(), keyPath.get()); 294 CACFAnimationSetFillMode(m_animation.get(), toCACFFillModeType(value)); 294 295 } 295 296 296 297 void PlatformCAAnimation::setTimingFunction(const TimingFunction* value) 297 298 { 298 CACFAnimationSetTimingFunction(m_animation.get(), toCACFTimingFunction(value) );299 CACFAnimationSetTimingFunction(m_animation.get(), toCACFTimingFunction(value).get()); 299 300 } 300 301 … … 331 332 void PlatformCAAnimation::setValueFunction(ValueFunctionType value) 332 333 { 333 RetainPtr<CFStringRef> keyPath(AdoptCF, toCACFValueFunctionType(value).createCFString()); 334 CACFAnimationSetValueFunction(m_animation.get(), CACFValueFunctionGetFunctionWithName(keyPath.get())); 334 CACFAnimationSetValueFunction(m_animation.get(), CACFValueFunctionGetFunctionWithName(toCACFValueFunctionType(value))); 335 335 } 336 336 … … 525 525 for (size_t i = 0; i < value.size(); ++i) { 526 526 RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value[i])); 527 CFArrayAppendValue(array.get(), toCACFTimingFunction(value[i]) );527 CFArrayAppendValue(array.get(), toCACFTimingFunction(value[i]).get()); 528 528 } 529 529
Note: See TracChangeset
for help on using the changeset viewer.