mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
common array: ++enhance the usability.
add last() which indicates the last element pointer.
This commit is contained in:
parent
3fa33c0315
commit
bd87f1398c
2 changed files with 6 additions and 1 deletions
|
@ -73,6 +73,11 @@ struct Array
|
|||
return data + count;
|
||||
}
|
||||
|
||||
T* last()
|
||||
{
|
||||
return data + count - 1;
|
||||
}
|
||||
|
||||
void pop()
|
||||
{
|
||||
if (count > 0) --count;
|
||||
|
|
|
@ -674,7 +674,7 @@ TvgBinCounter TvgSaver::serializeChildren(Iterator* it, const Matrix* pTransform
|
|||
while (auto child = it->next()) {
|
||||
if (child->identifier() == TVG_CLASS_ID_SHAPE) {
|
||||
//only dosable if the previous child is a shape.
|
||||
auto target = children.ptr() - 1;
|
||||
auto target = children.last();
|
||||
if ((*target)->identifier() == TVG_CLASS_ID_SHAPE) {
|
||||
if (_merge((Shape*)child, (Shape*)*target)) {
|
||||
continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue