projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
The code documents an unexplained crash in libpng, but was also leaking filehandles...
[synfig.git]
/
synfig-core
/
tags
/
stable
/
src
/
synfig
/
valuenode_bline.cpp
diff --git
a/synfig-core/tags/stable/src/synfig/valuenode_bline.cpp
b/synfig-core/tags/stable/src/synfig/valuenode_bline.cpp
index
ee0d831
..
82e5a42
100644
(file)
--- a/
synfig-core/tags/stable/src/synfig/valuenode_bline.cpp
+++ b/
synfig-core/tags/stable/src/synfig/valuenode_bline.cpp
@@
-6,6
+6,7
@@
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007 Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
@@
-340,13
+341,16
@@
ValueNode_BLine::operator()(Time t)const
BLinePoint prev,first;
first.set_origin(100.0f);
BLinePoint prev,first;
first.set_origin(100.0f);
+ // loop through all the list's entries
for(iter=list.begin();iter!=list.end();++iter,index++)
{
for(iter=list.begin();iter!=list.end();++iter,index++)
{
+ // how 'on' is this vertex?
float amount(iter->amount_at_time(t,&rising));
assert(amount>=0.0f);
assert(amount<=1.0f);
float amount(iter->amount_at_time(t,&rising));
assert(amount>=0.0f);
assert(amount<=1.0f);
+ // it's fully on
if(amount==1.0f)
{
if(first_flag)
if(amount==1.0f)
{
if(first_flag)
@@
-381,8
+385,8
@@
ValueNode_BLine::operator()(Time t)const
prev=curr;
}
prev=curr;
}
- else
- if(amount>0.0f)
+ // it's partly on
+
else
if(amount>0.0f)
{
std::vector<ListEntry>::const_iterator begin_iter,end_iter;
{
std::vector<ListEntry>::const_iterator begin_iter,end_iter;
@@
-417,34
+421,28
@@
ValueNode_BLine::operator()(Time t)const
blp_here_on=(*iter->value_node)(on_time).get(blp_here_on);
// blp_here_on=(*iter->value_node)(t).get(blp_here_on);
blp_here_on=(*iter->value_node)(on_time).get(blp_here_on);
// blp_here_on=(*iter->value_node)(t).get(blp_here_on);
- // Find "end" of dynamic group
+ // Find "end" of dynamic group - ie. search forward along
+ // the bline from the current point until we find a point
+ // which is more 'on'than the current one
end_iter=iter;
// for(++end_iter;begin_iter!=list.end();++end_iter)
for(++end_iter;end_iter!=list.end();++end_iter)
if(end_iter->amount_at_time(t)>amount)
end_iter=iter;
// for(++end_iter;begin_iter!=list.end();++end_iter)
for(++end_iter;end_iter!=list.end();++end_iter)
if(end_iter->amount_at_time(t)>amount)
- {
- blp_next_off=(*end_iter->value_node)(off_time).get(prev);
break;
break;
- }
// If we did not find an end of the dynamic group...
// If we did not find an end of the dynamic group...
+ // Writeme! at least now it doesn't crash if first_iter
+ // isn't set yet
if(end_iter==list.end())
{
if(end_iter==list.end())
{
- if(get_loop())
- {
+ if(get_loop() && !first_flag)
end_iter=first_iter;
end_iter=first_iter;
- blp_next_off=(*end_iter->value_node)(off_time).get(prev);
-// end=first;
- }
else
else
- {
- // Writeme!
- end_iter=first_iter;
- blp_next_off=(*end_iter->value_node)(off_time).get(prev);
-// end=first;
- }
+ end_iter=--list.end();
}
}
+ blp_next_off=(*end_iter->value_node)(off_time).get(prev);
+
// Find "begin" of dynamic group
begin_iter=iter;
blp_prev_off.set_origin(100.0f); // set the origin to 100 (which is crazy) so that we can check to see if it was found
// Find "begin" of dynamic group
begin_iter=iter;
blp_prev_off.set_origin(100.0f); // set the origin to 100 (which is crazy) so that we can check to see if it was found
@@
-461,6
+459,7
@@
ValueNode_BLine::operator()(Time t)const
--begin_iter;
dist_from_begin++;
--begin_iter;
dist_from_begin++;
+ // if we've gone all around the loop, give up
if(begin_iter==iter)
break;
if(begin_iter==iter)
break;
@@
-469,24
+468,18
@@
ValueNode_BLine::operator()(Time t)const
blp_prev_off=(*begin_iter->value_node)(off_time).get(prev);
break;
}
blp_prev_off=(*begin_iter->value_node)(off_time).get(prev);
break;
}
- }while(
begin_iter!=iter
);
+ }while(
true
);
// If we did not find a begin
if(blp_prev_off.get_origin()==100.0f)
{
// If we did not find a begin
if(blp_prev_off.get_origin()==100.0f)
{
- if(get_loop())
- {
- begin_iter=first_iter;
- blp_prev_off=(*begin_iter->value_node)(off_time).get(prev);
-// blp_prev_off=first;
- }
+ // Writeme! - this needs work, but at least now it
+ // doesn't crash
+ if(first_flag)
+ begin_iter=list.begin();
else
else
- {
- // Writeme!
begin_iter=first_iter;
begin_iter=first_iter;
- blp_prev_off=(*begin_iter->value_node)(off_time).get(prev);
-// blp_prev_off=first;
- }
+ blp_prev_off=(*begin_iter->value_node)(off_time).get(prev);
}
// this is how the curve looks when we have completely vanished
}
// this is how the curve looks when we have completely vanished