Skip to content

Commit 5ba0ecf

Browse files
committed
Keyframe::GetInt() and Keyframe::GetLong() use GetValue
GetInt(), GetLong() are exactly the same as GetValue() except that their result is rounded and converted to the repsective data type. Thus avoid code duplication and use GetValue().
1 parent 280504f commit 5ba0ecf

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

src/KeyFrame.cpp

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -251,45 +251,13 @@ double Keyframe::GetValue(int64_t index)
251251
// Get the rounded INT value at a specific index
252252
int Keyframe::GetInt(int64_t index)
253253
{
254-
// Check if it needs to be processed
255-
if (needs_update)
256-
Process();
257-
258-
// Is index a valid point?
259-
if (index >= 0 && index < Values.size())
260-
// Return value
261-
return int(round(Values[index].Y));
262-
else if (index < 0 && Values.size() > 0)
263-
// Return the minimum value
264-
return int(round(Values[0].Y));
265-
else if (index >= Values.size() && Values.size() > 0)
266-
// return the maximum value
267-
return int(round(Values[Values.size() - 1].Y));
268-
else
269-
// return a blank coordinate (0,0)
270-
return 0;
254+
return int(round(GetValue(index)));
271255
}
272256

273257
// Get the rounded INT value at a specific index
274258
int64_t Keyframe::GetLong(int64_t index)
275259
{
276-
// Check if it needs to be processed
277-
if (needs_update)
278-
Process();
279-
280-
// Is index a valid point?
281-
if (index >= 0 && index < Values.size())
282-
// Return value
283-
return long(round(Values[index].Y));
284-
else if (index < 0 && Values.size() > 0)
285-
// Return the minimum value
286-
return long(round(Values[0].Y));
287-
else if (index >= Values.size() && Values.size() > 0)
288-
// return the maximum value
289-
return long(round(Values[Values.size() - 1].Y));
290-
else
291-
// return a blank coordinate (0,0)
292-
return 0;
260+
return long(round(GetValue(index)));
293261
}
294262

295263
// Get the direction of the curve at a specific index (increasing or decreasing)

0 commit comments

Comments
 (0)