mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 03:54:25 +00:00
tvg_saver: skip the invisible paint as possible.
This commit is contained in:
parent
41ad6e16e9
commit
5b89389161
2 changed files with 6 additions and 3 deletions
|
@ -412,7 +412,7 @@ TvgBinCounter TvgSaver::serializeComposite(const Paint* cmpTarget, CompositeMeth
|
|||
auto flag = static_cast<TvgBinFlag>(cmpMethod);
|
||||
auto cnt = writeTagProperty(TVG_TAG_PAINT_CMP_METHOD, SIZE(TvgBinFlag), &flag);
|
||||
|
||||
cnt += serialize(cmpTarget, nullptr);
|
||||
cnt += serialize(cmpTarget, nullptr, true);
|
||||
|
||||
writeReservedCount(cnt);
|
||||
|
||||
|
@ -436,10 +436,13 @@ TvgBinCounter TvgSaver::serializeChildren(const Paint* paint, const Matrix* tran
|
|||
}
|
||||
|
||||
|
||||
TvgBinCounter TvgSaver::serialize(const Paint* paint, const Matrix* transform)
|
||||
TvgBinCounter TvgSaver::serialize(const Paint* paint, const Matrix* transform, bool compTarget)
|
||||
{
|
||||
if (!paint) return 0;
|
||||
|
||||
//Invisible paint, no point to save it if the paint is not the composition target...
|
||||
if (!compTarget && paint->opacity() == 0) return 0;
|
||||
|
||||
auto m = const_cast<Paint*>(paint)->transform();
|
||||
if (transform) m = _multiply(transform, &m);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ private:
|
|||
TvgBinCounter writeTagProperty(TvgBinTag tag, TvgBinCounter cnt, const void* data);
|
||||
TvgBinCounter writeTransform(const Matrix* transform);
|
||||
|
||||
TvgBinCounter serialize(const Paint* paint, const Matrix* transform);
|
||||
TvgBinCounter serialize(const Paint* paint, const Matrix* transform, bool compTarget = false);
|
||||
TvgBinCounter serializeScene(const Scene* scene, const Matrix* transform);
|
||||
TvgBinCounter serializeShape(const Shape* shape, const Matrix* transform);
|
||||
TvgBinCounter serializePicture(const Picture* picture, const Matrix* transform);
|
||||
|
|
Loading…
Add table
Reference in a new issue