mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
common array: revise the interface.
Implement a pair of access methods: last() and first().
This commit is contained in:
parent
65f178620e
commit
b876427325
2 changed files with 9 additions and 4 deletions
|
@ -73,9 +73,14 @@ struct Array
|
|||
return data + count;
|
||||
}
|
||||
|
||||
T* last() const
|
||||
T& last() const
|
||||
{
|
||||
return data + count - 1;
|
||||
return data[count - 1];
|
||||
}
|
||||
|
||||
T& first() const
|
||||
{
|
||||
return data[0];
|
||||
}
|
||||
|
||||
void pop()
|
||||
|
|
|
@ -675,8 +675,8 @@ TvgBinCounter TvgSaver::serializeChildren(Iterator* it, const Matrix* pTransform
|
|||
if (child->identifier() == TVG_CLASS_ID_SHAPE) {
|
||||
//only dosable if the previous child is a shape.
|
||||
auto target = children.last();
|
||||
if ((*target)->identifier() == TVG_CLASS_ID_SHAPE) {
|
||||
if (_merge((Shape*)child, (Shape*)*target)) {
|
||||
if (target->identifier() == TVG_CLASS_ID_SHAPE) {
|
||||
if (_merge((Shape*)child, (Shape*)target)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue