Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1293)

Side by Side Diff: third_party/WebKit/Source/platform/animation/AnimationUtilities.h

Issue 1648573002: Transition to explicit constructors in LayoutUnit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove int constructors for size/point... they result in incorrect conversions until LayoutUnit is … Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return from + (to - from) * progress; 54 return from + (to - from) * progress;
55 } 55 }
56 56
57 inline float blend(float from, float to, double progress) 57 inline float blend(float from, float to, double progress)
58 { 58 {
59 return static_cast<float>(from + (to - from) * progress); 59 return static_cast<float>(from + (to - from) * progress);
60 } 60 }
61 61
62 inline LayoutUnit blend(LayoutUnit from, LayoutUnit to, double progress) 62 inline LayoutUnit blend(LayoutUnit from, LayoutUnit to, double progress)
63 { 63 {
64 return from + (to - from) * progress; 64 return LayoutUnit(from + (to - from) * progress);
65 } 65 }
66 66
67 inline IntPoint blend(const IntPoint& from, const IntPoint& to, double progress) 67 inline IntPoint blend(const IntPoint& from, const IntPoint& to, double progress)
68 { 68 {
69 return IntPoint(blend(from.x(), to.x(), progress), blend(from.y(), to.y(), p rogress)); 69 return IntPoint(blend(from.x(), to.x(), progress), blend(from.y(), to.y(), p rogress));
70 } 70 }
71 71
72 inline FloatPoint blend(const FloatPoint& from, const FloatPoint& to, double pro gress) 72 inline FloatPoint blend(const FloatPoint& from, const FloatPoint& to, double pro gress)
73 { 73 {
74 return FloatPoint(blend(from.x(), to.x(), progress), blend(from.y(), to.y(), progress)); 74 return FloatPoint(blend(from.x(), to.x(), progress), blend(from.y(), to.y(), progress));
75 } 75 }
76 76
77 // Calculates the accuracy for evaluating a timing function for an animation wit h the specified duration. 77 // Calculates the accuracy for evaluating a timing function for an animation wit h the specified duration.
78 inline double accuracyForDuration(double duration) 78 inline double accuracyForDuration(double duration)
79 { 79 {
80 return 1.0 / (200.0 * duration); 80 return 1.0 / (200.0 * duration);
81 } 81 }
82 82
83 } // namespace blink 83 } // namespace blink
84 84
85 #endif // AnimationUtilities_h 85 #endif // AnimationUtilities_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/LengthFunctions.cpp ('k') | third_party/WebKit/Source/platform/geometry/LayoutPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698