Lines Matching +full:- +full:r

2  * Copyright (c) 2023 - 2024 the ThorVG project. All rights reserved.
53 m->e11 = cy * cz; in _rotationXYZ()
54 m->e12 = -cy * sz; in _rotationXYZ()
55 m->e21 = sx * sy * cz + cx * sz; in _rotationXYZ()
56 m->e22 = -sx * sy * sz + cx * cz; in _rotationXYZ()
64 m->e11 = cosf(radian); in _rotationZ()
65 m->e12 = -sinf(radian); in _rotationZ()
66 m->e21 = sinf(radian); in _rotationZ()
67 m->e22 = cosf(radian); in _rotationZ()
73 auto angle = -deg2rad(angleDeg); in _skew()
77 …if (fabsf(axisDeg) < 0.01f || fabsf(axisDeg - 180.0f) < 0.01f || fabsf(axisDeg + 180.0f) < 0.01f) { in _skew()
80 m->e12 += B * m->e11; in _skew()
81 m->e22 += B * m->e21; in _skew()
83 } else if (fabsf(axisDeg - 90.0f) < 0.01f || fabsf(axisDeg + 90.0f) < 0.01f) { in _skew()
84 float sinVal = -sinf(deg2rad(axisDeg)); in _skew()
86 m->e11 -= C * m->e12; in _skew()
87 m->e21 -= C * m->e22; in _skew()
91 auto axis = -deg2rad(axisDeg); in _skew()
98 auto e11 = m->e11; in _skew()
99 auto e21 = m->e21; in _skew()
100 m->e11 = (1.0f - A) * e11 - C * m->e12; in _skew()
101 m->e12 = B * e11 + (1.0f + A) * m->e12; in _skew()
102 m->e21 = (1.0f - A) * e21 - C * m->e22; in _skew()
103 m->e22 = B * e21 + (1.0f + A) * m->e22; in _skew()
116 if (transform->coords) { in _updateTransform()
117 … translate(&matrix, transform->coords->x(frameNo, exps), transform->coords->y(frameNo, exps)); in _updateTransform()
119 auto position = transform->position(frameNo, exps); in _updateTransform()
124 if (autoOrient) angle = transform->position.angle(frameNo); in _updateTransform()
125 …f (transform->rotationEx) _rotationXYZ(&matrix, transform->rotationEx->x(frameNo, exps), transform in _updateTransform()
126 else _rotationZ(&matrix, transform->rotation(frameNo, exps) + angle); in _updateTransform()
129 auto skewAngle = transform->skewAngle(frameNo, exps); in _updateTransform()
134 if (fabsf(skewAngle - 90.0f) < 0.01f || fabsf(skewAngle + 90.0f) < 0.01f) return false; in _updateTransform()
135 _skew(&matrix, skewAngle, transform->skewAxis(frameNo, exps)); in _updateTransform()
138 auto scale = transform->scale(frameNo, exps); in _updateTransform()
142 auto anchor = transform->anchor(frameNo, exps); in _updateTransform()
143 translateR(&matrix, -anchor.x, -anchor.y); in _updateTransform()
147 else opacity = transform->opacity(frameNo, exps); in _updateTransform()
155 if (!layer || tvg::equal(layer->cache.frameNo, frameNo)) return; in updateTransform()
157 auto transform = layer->transform; in updateTransform()
158 auto parent = layer->parent; in updateTransform()
162 auto& matrix = layer->cache.matrix; in updateTransform()
164 _updateTransform(transform, frameNo, layer->autoOrient, matrix, layer->cache.opacity, exps); in updateTransform()
167 if (!identity((const Matrix*) &parent->cache.matrix)) { in updateTransform()
168 if (identity((const Matrix*) &matrix)) layer->cache.matrix = parent->cache.matrix; in updateTransform()
169 else layer->cache.matrix = parent->cache.matrix * matrix; in updateTransform()
172 layer->cache.frameNo = frameNo; in updateTransform()
183 if (parent->mergeable()) { in updateTransform()
184 if (!ctx->transform) ctx->transform = (Matrix*)malloc(sizeof(Matrix)); in updateTransform()
185 _updateTransform(transform, frameNo, false, *ctx->transform, opacity, exps); in updateTransform()
189 ctx->merging = nullptr; in updateTransform()
194 ctx->propagator->transform(PP(ctx->propagator)->transform() * matrix); in updateTransform()
195 ctx->propagator->opacity(MULTIPLY(opacity, PP(ctx->propagator)->opacity)); in updateTransform()
198 if (P(ctx->propagator)->rs.strokeWidth() > 0.0f) { in updateTransform()
200 … if (denominator > 1.0f) ctx->propagator->stroke(ctx->propagator->strokeWidth() / denominator); in updateTransform()
209 if (!group->visible) return; in updateGroup()
212 group->scene = parent->scene; in updateGroup()
213 group->reqFragment |= ctx->reqFragment; in updateGroup()
216 if (group->mergeable()) _draw(parent, nullptr, ctx); in updateGroup()
219 …auto propagator = group->mergeable() ? ctx->propagator : static_cast<Shape*>(PP(ctx->propagator)->… in updateGroup()
220 contexts.back(new RenderContext(*ctx, propagator, group->mergeable())); in updateGroup()
230 ctx->propagator->stroke(stroke->width(frameNo, exps)); in _updateStroke()
231 ctx->propagator->stroke(stroke->cap); in _updateStroke()
232 ctx->propagator->stroke(stroke->join); in _updateStroke()
233 ctx->propagator->strokeMiterlimit(stroke->miterLimit); in _updateStroke()
235 if (stroke->dashattr) { in _updateStroke()
237 dashes[0] = stroke->dashSize(frameNo, exps); in _updateStroke()
238 dashes[1] = dashes[0] + stroke->dashGap(frameNo, exps); in _updateStroke()
239 P(ctx->propagator)->strokeDash(dashes, 2, stroke->dashOffset(frameNo, exps)); in _updateStroke()
241 ctx->propagator->stroke(nullptr, 0); in _updateStroke()
248 if (!ctx->reqFragment) return false; in _fragmented()
249 if (ctx->fragmenting) return true; in _fragmented()
251 …exts.back(new RenderContext(*ctx, static_cast<Shape*>(PP(ctx->propagator)->duplicate(parent->pooli… in _fragmented()
253 fragment->begin = child - 1; in _fragmented()
254 ctx->fragmenting = true; in _fragmented()
266 ctx->merging = nullptr; in updateSolidStroke()
267 auto color = stroke->color(frameNo, exps); in updateSolidStroke()
268 … ctx->propagator->stroke(color.rgb[0], color.rgb[1], color.rgb[2], stroke->opacity(frameNo, exps)); in updateSolidStroke()
279 ctx->merging = nullptr; in updateGradientStroke()
280 ctx->propagator->stroke(unique_ptr<Fill>(stroke->fill(frameNo, exps))); in updateGradientStroke()
291 ctx->merging = nullptr; in updateSolidFill()
292 auto color = fill->color(frameNo, exps); in updateSolidFill()
293 ctx->propagator->fill(color.rgb[0], color.rgb[1], color.rgb[2], fill->opacity(frameNo, exps)); in updateSolidFill()
294 ctx->propagator->fill(fill->rule); in updateSolidFill()
296 if (ctx->propagator->strokeWidth() > 0) ctx->propagator->order(true); in updateSolidFill()
306 ctx->merging = nullptr; in updateGradientFill()
308 ctx->propagator->fill(unique_ptr<Fill>(fill->fill(frameNo, exps))); in updateGradientFill()
309 ctx->propagator->fill(fill->rule); in updateGradientFill()
311 if (ctx->propagator->strokeWidth() > 0) ctx->propagator->order(true); in updateGradientFill()
317 if (ctx->merging) return false; in _draw()
320 ctx->merging = shape->pooling(); in _draw()
321 PP(ctx->propagator)->duplicate(ctx->merging); in _draw()
323 ctx->merging = static_cast<Shape*>(ctx->propagator->duplicate()); in _draw()
326 parent->scene->push(cast(ctx->merging)); in _draw()
335 propagators.push(ctx->propagator); in _repeat()
338 for (auto repeater = ctx->repeaters.end() - 1; repeater >= ctx->repeaters.begin(); --repeater) { in _repeat()
339 shapes.reserve(repeater->cnt); in _repeat()
341 for (int i = 0; i < repeater->cnt; ++i) { in _repeat()
342 auto multiplier = repeater->offset + static_cast<float>(i); in _repeat()
345 auto shape = static_cast<Shape*>((*propagator)->duplicate()); in _repeat()
346 P(shape)->rs.path = P(path)->rs.path; in _repeat()
348 …= repeater->interpOpacity ? lerp<uint8_t>(repeater->startOpacity, repeater->endOpacity, static_cas… in _repeat()
349 shape->opacity(opacity); in _repeat()
353 …translate(&m, repeater->position.x * multiplier + repeater->anchor.x, repeater->position.y * multi… in _repeat()
354 …scale(&m, powf(repeater->scale.x * 0.01f, multiplier), powf(repeater->scale.y * 0.01f, multiplier)… in _repeat()
355 rotate(&m, repeater->rotation * multiplier); in _repeat()
356 translateR(&m, -repeater->anchor.x, -repeater->anchor.y); in _repeat()
357 m = repeater->transform * m; in _repeat()
360 inverse(&repeater->transform, &inv); in _repeat()
361 shape->transform(m * (inv * PP(shape)->transform())); in _repeat()
370 if (repeater->inorder) { in _repeat()
372 parent->scene->push(cast(*shape)); in _repeat()
376 for (auto shape = shapes.end() - 1; shape >= shapes.begin(); --shape) { in _repeat()
377 parent->scene->push(cast(*shape)); in _repeat()
386 static void _appendRect(Shape* shape, float x, float y, float w, float h, float r, const LottieOffs… in _appendRect() argument
389 if (tvg::zero(r)) { in _appendRect()
413 …if (offsetPath) offsetPath->modifyRect(commands, 5, points, 4, P(shape)->rs.path.cmds, P(shape)->r… in _appendRect()
414 else shape->appendPath(commands, 5, points, 4); in _appendRect()
422 auto rx = r > halfW ? halfW : r; in _appendRect()
423 auto ry = r > halfH ? halfH : r; in _appendRect()
436 points[1] = {x + w, y + h - ry}; //lineTo in _appendRect()
437 …points[2] = {x + w, y + h - ry + hry}; points[3] = {x + w - rx + hrx, y + h}; points[4] = {x + w - in _appendRect()
439 …points[6] = {x + rx - hrx, y + h}; points[7] = {x, y + h - ry + hry}; points[8] = {x, y + h - ry};… in _appendRect()
441 …points[10] = {x, y + ry - hry}; points[11] = {x + rx - hrx, y}; points[12] = {x + rx, y}; //cubicTo in _appendRect()
442 points[13] = {x + w - rx, y}; //lineTo in _appendRect()
443 …points[14] = {x + w - rx + hrx, y}; points[15] = {x + w, y + ry - hry}; points[16] = {x + w, y + r… in _appendRect()
451 …points[1] = {x + w, y + ry - hry}; points[2] = {x + w - rx + hrx, y}; points[3] = {x + w - rx, y};… in _appendRect()
453 … points[5] = {x + rx - hrx, y}; points[6] = {x, y + ry - hry}; points[7] = {x, y + ry}; //cubicTo in _appendRect()
454 points[8] = {x, y + h - ry}; //lineTo in _appendRect()
455 …points[9] = {x, y + h - ry + hry}; points[10] = {x + rx - hrx, y + h}; points[11] = {x + rx, y + h… in _appendRect()
456 points[12] = {x + w - rx, y + h}; //lineTo in _appendRect()
457 …points[13] = {x + w - rx + hrx, y + h}; points[14] = {x + w, y + h - ry + hry}; points[15] = {x + … in _appendRect()
466 …if (offsetPath) offsetPath->modifyRect(commands, cmdCnt, points, ptsCnt, P(shape)->rs.path.cmds, P… in _appendRect()
467 else shape->appendPath(commands, cmdCnt, points, ptsCnt); in _appendRect()
476 auto position = rect->position(frameNo, exps); in updateRect()
477 auto size = rect->size(frameNo, exps); in updateRect()
478 auto r = rect->radius(frameNo, exps); in updateRect() local
479 if (r == 0.0f) { in updateRect()
480 if (ctx->roundness) ctx->roundness->modifyRect(size, r); in updateRect()
482 r = std::min({r, size.x * 0.5f, size.y * 0.5f}); in updateRect()
485 if (!ctx->repeaters.empty()) { in updateRect()
486 auto shape = rect->pooling(); in updateRect()
487 shape->reset(); in updateRect()
488 …ndRect(shape, position.x - size.x * 0.5f, position.y - size.y * 0.5f, size.x, size.y, r, ctx->offs… in updateRect()
492 …appendRect(ctx->merging, position.x - size.x * 0.5f, position.y - size.y * 0.5f, size.x, size.y, r in updateRect()
499 if (offsetPath) offsetPath->modifyEllipse(rx, ry); in _appendCircle()
516 points[0] = {cx, cy - ry}; //moveTo in _appendCircle()
517 …points[1] = {cx + rxKappa, cy - ry}; points[2] = {cx + rx, cy - ryKappa}; points[3] = {cx + rx, cy… in _appendCircle()
519 …points[7] = {cx - rxKappa, cy + ry}; points[8] = {cx - rx, cy + ryKappa}; points[9] = {cx - rx, cy… in _appendCircle()
520 …points[10] = {cx - rx, cy - ryKappa}; points[11] = {cx - rxKappa, cy - ry}; points[12] = {cx, cy - in _appendCircle()
522 points[0] = {cx, cy - ry}; //moveTo in _appendCircle()
523 …points[1] = {cx - rxKappa, cy - ry}; points[2] = {cx - rx, cy - ryKappa}; points[3] = {cx - rx, cy… in _appendCircle()
524 …points[4] = {cx - rx, cy + ryKappa}; points[5] = {cx - rxKappa, cy + ry}; points[6] = {cx, cy + ry… in _appendCircle()
526 …points[10] = {cx + rx, cy - ryKappa}; points[11] = {cx + rxKappa, cy - ry}; points[12] = {cx, cy - in _appendCircle()
535 shape->appendPath(commands, cmdsCnt, points, ptsCnt); in _appendCircle()
543 auto position = ellipse->position(frameNo, exps); in updateEllipse()
544 auto size = ellipse->size(frameNo, exps); in updateEllipse()
546 if (!ctx->repeaters.empty()) { in updateEllipse()
547 auto shape = ellipse->pooling(); in updateEllipse()
548 shape->reset(); in updateEllipse()
549 …position.x, position.y, size.x * 0.5f, size.y * 0.5f, ctx->offsetPath, ctx->transform, ellipse->cl… in updateEllipse()
553 …_appendCircle(ctx->merging, position.x, position.y, size.x * 0.5f, size.y * 0.5f, ctx->offsetPath,… in updateEllipse()
562 if (!ctx->repeaters.empty()) { in updatePath()
563 auto shape = path->pooling(); in updatePath()
564 shape->reset(); in updatePath()
565 …path->pathset(frameNo, P(shape)->rs.path.cmds, P(shape)->rs.path.pts, ctx->transform, ctx->roundne… in updatePath()
569 …if (path->pathset(frameNo, P(ctx->merging)->rs.path.cmds, P(ctx->merging)->rs.path.pts, ctx->trans… in updatePath()
570 P(ctx->merging)->update(RenderUpdateFlag::Path); in updatePath()
580 auto ptsCnt = star->ptsCnt(frameNo, exps); in _updateStar()
581 auto innerRadius = star->innerRadius(frameNo, exps); in _updateStar()
582 auto outerRadius = star->outerRadius(frameNo, exps); in _updateStar()
583 auto innerRoundness = star->innerRoundness(frameNo, exps) * 0.01f; in _updateStar()
584 auto outerRoundness = star->outerRoundness(frameNo, exps) * 0.01f; in _updateStar()
586 auto angle = deg2rad(-90.0f); in _updateStar()
590 auto partialPointAmount = ptsCnt - floorf(ptsCnt); in _updateStar()
593 auto direction = star->clockwise ? 1.0f : -1.0f; in _updateStar()
599 shape = star->pooling(); in _updateStar()
600 shape->reset(); in _updateStar()
608 angle += halfAnglePerPoint * (1.0f - partialPointAmount) * direction; in _updateStar()
612 partialPointRadius = innerRadius + partialPointAmount * (outerRadius - innerRadius); in _updateStar()
623 P(shape)->rs.path.pts.reserve(numPoints + 2); in _updateStar()
624 P(shape)->rs.path.cmds.reserve(numPoints + 3); in _updateStar()
626 P(shape)->rs.path.pts.reserve(numPoints * 3 + 2); in _updateStar()
627 P(shape)->rs.path.cmds.reserve(numPoints + 3); in _updateStar()
633 shape->moveTo(in.x, in.y); in _updateStar()
638 if (!tvg::zero(partialPointRadius) && i == numPoints - 2) { in _updateStar()
641 if (!tvg::zero(partialPointRadius) && i == numPoints - 1) { in _updateStar()
650 auto cp1Theta = (tvg::atan2(previousY, previousX) - MATH_PI2 * direction); in _updateStar()
653 auto cp2Theta = (tvg::atan2(y, x) - MATH_PI2 * direction); in _updateStar()
667 if (!tvg::zero(partialPointAmount) && ((i == 0) || (i == numPoints - 1))) { in _updateStar()
673 Point in2 = {previousX - cp1x, previousY - cp1y}; in _updateStar()
681 shape->cubicTo(in2.x, in2.y, in3.x, in3.y, in4.x, in4.y); in _updateStar()
685 shape->lineTo(in.x, in.y); in _updateStar()
690 shape->close(); in _updateStar()
695 …roundness->modifyPolystar(P(shape)->rs.path.cmds, P(shape)->rs.path.pts, P(intermediate)->rs.path.… in _updateStar()
696 …offsetPath->modifyPolystar(P(intermediate)->rs.path.cmds, P(intermediate)->rs.path.pts, P(merging) in _updateStar()
698 …roundness->modifyPolystar(P(shape)->rs.path.cmds, P(shape)->rs.path.pts, P(merging)->rs.path.cmds,… in _updateStar()
700 …if (offsetPath) offsetPath->modifyPolystar(P(shape)->rs.path.cmds, P(shape)->rs.path.pts, P(mergin… in _updateStar()
708 auto ptsCnt = size_t(floor(star->ptsCnt(frameNo, exps))); in _updatePolygon()
709 auto radius = star->outerRadius(frameNo, exps); in _updatePolygon()
710 auto outerRoundness = star->outerRoundness(frameNo, exps) * 0.01f; in _updatePolygon()
712 auto angle = deg2rad(-90.0f); in _updatePolygon()
714 auto direction = star->clockwise ? 1.0f : -1.0f; in _updatePolygon()
724 shape = star->pooling(); in _updatePolygon()
725 shape->reset(); in _updatePolygon()
729 P(shape)->rs.path.pts.reserve(ptsCnt * 3 + 2); in _updatePolygon()
730 P(shape)->rs.path.cmds.reserve(ptsCnt + 3); in _updatePolygon()
732 P(shape)->rs.path.pts.reserve(ptsCnt + 2); in _updatePolygon()
733 P(shape)->rs.path.cmds.reserve(ptsCnt + 3); in _updatePolygon()
739 shape->moveTo(in.x, in.y); in _updatePolygon()
748 auto cp1Theta = tvg::atan2(previousY, previousX) - MATH_PI2 * direction; in _updatePolygon()
751 auto cp2Theta = tvg::atan2(y, x) - MATH_PI2 * direction; in _updatePolygon()
760 Point in2 = {previousX - cp1x, previousY - cp1y}; in _updatePolygon()
768 shape->cubicTo(in2.x, in2.y, in3.x, in3.y, in4.x, in4.y); in _updatePolygon()
772 shape->lineTo(in.x, in.y); in _updatePolygon()
776 shape->close(); in _updatePolygon()
781 …roundness->modifyPolystar(P(shape)->rs.path.cmds, P(shape)->rs.path.pts, P(intermediate)->rs.path.… in _updatePolygon()
782 …offsetPath->modifyPolystar(P(intermediate)->rs.path.cmds, P(intermediate)->rs.path.pts, P(merging) in _updatePolygon()
784 …roundness->modifyPolystar(P(shape)->rs.path.cmds, P(shape)->rs.path.pts, P(merging)->rs.path.cmds,… in _updatePolygon()
786 …if (offsetPath) offsetPath->modifyPolystar(P(shape)->rs.path.cmds, P(shape)->rs.path.pts, P(mergin… in _updatePolygon()
797 auto position = star->position(frameNo, exps); in updatePolystar()
799 rotate(&matrix, star->rotation(frameNo, exps)); in updatePolystar()
801 if (ctx->transform) matrix = *ctx->transform * matrix; in updatePolystar()
805 if (!ctx->repeaters.empty()) { in updatePolystar()
806 auto shape = star->pooling(); in updatePolystar()
807 shape->reset(); in updatePolystar()
808 …if (star->type == LottiePolyStar::Star) _updateStar(parent, star, identity ? nullptr : &matrix, ct… in updatePolystar()
809 …else _updatePolygon(parent, star, identity ? nullptr : &matrix, ctx->roundness, ctx->offsetPath, … in updatePolystar()
813 …if (star->type == LottiePolyStar::Star) _updateStar(parent, star, identity ? nullptr : &matrix, ct… in updatePolystar()
814 …olygon(parent, star, identity ? nullptr : &matrix, ctx->roundness, ctx->offsetPath, frameNo, ctx- in updatePolystar()
815 P(ctx->merging)->update(RenderUpdateFlag::Path); in updatePolystar()
823 auto r = roundedCorner->radius(frameNo, exps); in updateRoundedCorner() local
824 if (r < LottieRoundnessModifier::ROUNDNESS_EPSILON) return; in updateRoundedCorner()
826 if (!ctx->roundness) ctx->roundness = new LottieRoundnessModifier(r); in updateRoundedCorner()
827 else if (ctx->roundness->r < r) ctx->roundness->r = r; in updateRoundedCorner()
834 …(!ctx->offsetPath) ctx->offsetPath = new LottieOffsetModifier(offsetPath->offset(frameNo, exps), o… in updateOffsetPath()
842 RenderRepeater r; in updateRepeater() local
843 r.cnt = static_cast<int>(repeater->copies(frameNo, exps)); in updateRepeater()
844 r.transform = PP(ctx->propagator)->transform(); in updateRepeater()
845 r.offset = repeater->offset(frameNo, exps); in updateRepeater()
846 r.position = repeater->position(frameNo, exps); in updateRepeater()
847 r.anchor = repeater->anchor(frameNo, exps); in updateRepeater()
848 r.scale = repeater->scale(frameNo, exps); in updateRepeater()
849 r.rotation = repeater->rotation(frameNo, exps); in updateRepeater()
850 r.startOpacity = repeater->startOpacity(frameNo, exps); in updateRepeater()
851 r.endOpacity = repeater->endOpacity(frameNo, exps); in updateRepeater()
852 r.inorder = repeater->inorder; in updateRepeater()
853 r.interpOpacity = (r.startOpacity == r.endOpacity) ? false : true; in updateRepeater()
854 ctx->repeaters.push(r); in updateRepeater()
856 ctx->merging = nullptr; in updateRepeater()
865 trimpath->segment(frameNo, begin, end, exps); in updateTrimpath()
867 if (P(ctx->propagator)->rs.stroke) { in updateTrimpath()
868 auto pbegin = P(ctx->propagator)->rs.stroke->trim.begin; in updateTrimpath()
869 auto pend = P(ctx->propagator)->rs.stroke->trim.end; in updateTrimpath()
870 auto length = fabsf(pend - pbegin); in updateTrimpath()
875 … P(ctx->propagator)->strokeTrim(begin, end, trimpath->type == LottieTrimpath::Type::Simultaneous); in updateTrimpath()
876 ctx->merging = nullptr; in updateTrimpath()
882 contexts.head->begin = parent->children.end() - 1; in updateChildren()
886 ctx->reqFragment = parent->reqFragment; in updateChildren()
887 for (auto child = ctx->begin; child >= parent->children.data; --child) { in updateChildren()
888 //Here switch-case statements are more performant than virtual methods. in updateChildren()
889 switch ((*child)->type) { in updateChildren()
948 if (ctx->propagator->opacity() == 0) break; in updateChildren()
957 if (precomp->children.empty()) return; in updatePrecomp()
959 frameNo = precomp->remap(comp, frameNo, exps); in updatePrecomp()
961 for (auto c = precomp->children.end() - 1; c >= precomp->children.begin(); --c) { in updatePrecomp()
963 if (!child->matteSrc) updateLayer(comp, precomp->scene, child, frameNo); in updatePrecomp()
967 auto clipper = precomp->statical.pooling(true); in updatePrecomp()
968 clipper->transform(precomp->cache.matrix); in updatePrecomp()
969 precomp->scene->clip(cast(clipper)); in updatePrecomp()
975 auto solidFill = layer->statical.pooling(true); in updateSolid()
976 solidFill->opacity(layer->cache.opacity); in updateSolid()
977 layer->scene->push(cast(solidFill)); in updateSolid()
983 auto image = static_cast<LottieImage*>(layer->children.first()); in updateImage()
984 layer->scene->push(tvg::cast(image->pooling(true))); in updateImage()
990 auto text = static_cast<LottieText*>(layer->children.first()); in updateText()
991 auto& doc = text->doc(frameNo); in updateText()
994 if (!p || !text->font) return; in updateText()
1012 auto ascent = text->font->ascent * scale; in updateText()
1014 Point layout = {doc.bbox.pos.x, doc.bbox.pos.y + ascent - doc.shift}; in updateText()
1017 if (doc.justify == 1) layout.x += doc.bbox.size.x - (cursor.x * scale); //right aligned in updateText()
1018 …else if (doc.justify == 2) layout.x += (doc.bbox.size.x * 0.5f) - (cursor.x * 0.5f * scale); //ce… in updateText()
1020 scene->translate(layout.x, layout.y); in updateText()
1021 scene->scale(scale); in updateText()
1023 layer->scene->push(std::move(scene)); in updateText()
1042 for (auto g = text->font->chars.begin(); g < text->font->chars.end(); ++g) { in updateText()
1045 if (!strncmp(glyph->code, p, glyph->len)) { in updateText()
1046 auto shape = text->pooling(); in updateText()
1047 shape->reset(); in updateText()
1048 for (auto g = glyph->children.begin(); g < glyph->children.end(); ++g) { in updateText()
1050 for (auto p = group->children.begin(); p < group->children.end(); ++p) { in updateText()
1051 …if (static_cast<LottiePath*>(*p)->pathset(frameNo, P(shape)->rs.path.cmds, P(shape)->rs.path.pts, … in updateText()
1052 P(shape)->update(RenderUpdateFlag::Path); in updateText()
1056 shape->fill(doc.color.rgb[0], doc.color.rgb[1], doc.color.rgb[2]); in updateText()
1057 shape->translate(cursor.x, cursor.y); in updateText()
1058 shape->opacity(255); in updateText()
1061 shape->stroke(StrokeJoin::Round); in updateText()
1062 shape->stroke(doc.stroke.width / scale); in updateText()
1063 … shape->stroke(doc.stroke.color.rgb[0], doc.stroke.color.rgb[1], doc.stroke.color.rgb[2]); in updateText()
1066 if (!text->ranges.empty()) { in updateText()
1072 for (auto s = text->ranges.begin(); s < text->ranges.end(); ++s) { in updateText()
1074 (*s)->range(frameNo, float(totalChars), start, end); in updateText()
1077 … if ((*s)->based == LottieTextRange::Based::CharsExcludingSpaces) basedIdx = idx - space; in updateText()
1078 … else if ((*s)->based == LottieTextRange::Based::Words) basedIdx = line + space; in updateText()
1079 else if ((*s)->based == LottieTextRange::Based::Lines) basedIdx = line; in updateText()
1083 translation = translation + (*s)->style.position(frameNo); in updateText()
1084 auto temp = (*s)->style.scale(frameNo); in updateText()
1087 rotation += (*s)->style.rotation(frameNo); in updateText()
1089 shape->opacity((*s)->style.opacity(frameNo)); in updateText()
1091 auto color = (*s)->style.fillColor(frameNo); in updateText()
1092 … shape->fill(color.rgb[0], color.rgb[1], color.rgb[2], (*s)->style.fillOpacity(frameNo)); in updateText()
1095 auto strokeColor = (*s)->style.strokeColor(frameNo); in updateText()
1096 shape->stroke((*s)->style.strokeWidth(frameNo) / scale); in updateText()
1097 …shape->stroke(strokeColor.rgb[0], strokeColor.rgb[1], strokeColor.rgb[2], (*s)->style.strokeOpacit… in updateText()
1099 cursor.x += (*s)->style.letterSpacing(frameNo); in updateText()
1101 auto spacing = (*s)->style.lineSpacing(frameNo); in updateText()
1109 shape->transform(matrix); in updateText()
1112 scene->push(cast(shape)); in updateText()
1114 p += glyph->len; in updateText()
1115 idx += glyph->len; in updateText()
1118 cursor.x += glyph->width + doc.tracking; in updateText()
1135 if (layer->masks.count == 0) return; in updateMaskings()
1138 auto pMask = static_cast<LottieMask*>(layer->masks[0]); in updateMaskings()
1139 auto pMethod = pMask->method; in updateMaskings()
1140 auto opacity = pMask->opacity(frameNo); in updateMaskings()
1141 auto expand = pMask->expand(frameNo); in updateMaskings()
1143 auto pShape = layer->pooling(); in updateMaskings()
1144 pShape->reset(); in updateMaskings()
1145 pShape->fill(255, 255, 255, opacity); in updateMaskings()
1146 pShape->transform(layer->cache.matrix); in updateMaskings()
1150 …pMask->pathset(frameNo, P(pShape)->rs.path.cmds, P(pShape)->rs.path.pts, nullptr, nullptr, nullptr… in updateMaskings()
1153 auto offset = LottieOffsetModifier(pMask->expand(frameNo)); in updateMaskings()
1154 …pMask->pathset(frameNo, P(pShape)->rs.path.cmds, P(pShape)->rs.path.pts, nullptr, nullptr, &offset… in updateMaskings()
1160 if (layer->masks.count == 1 && compMethod == CompositeMethod::AlphaMask && opacity == 255) { in updateMaskings()
1161 layer->scene->clip(tvg::cast(pShape)); in updateMaskings()
1166 if (layer->matteTarget) { in updateMaskings()
1168 scene->push(cast(layer->scene)); in updateMaskings()
1169 layer->scene = scene; in updateMaskings()
1172 layer->scene->composite(tvg::cast(pShape), compMethod); in updateMaskings()
1175 for (auto m = layer->masks.begin() + 1; m < layer->masks.end(); ++m) { in updateMaskings()
1177 auto method = mask->method; in updateMaskings()
1182 …mask->pathset(frameNo, P(pShape)->rs.path.cmds, P(pShape)->rs.path.pts, nullptr, nullptr, nullptr,… in updateMaskings()
1185 auto shape = layer->pooling(); in updateMaskings()
1186 shape->reset(); in updateMaskings()
1187 shape->fill(255, 255, 255, mask->opacity(frameNo)); in updateMaskings()
1188 shape->transform(layer->cache.matrix); in updateMaskings()
1189 …mask->pathset(frameNo, P(shape)->rs.path.cmds, P(shape)->rs.path.pts, nullptr, nullptr, nullptr, e… in updateMaskings()
1190 pShape->composite(tvg::cast(shape), method); in updateMaskings()
1200 auto target = layer->matteTarget; in updateMatte()
1205 if (target->scene) { in updateMatte()
1206 layer->scene->composite(cast(target->scene), layer->matteType); in updateMatte()
1207 …} else if (layer->matteType == CompositeMethod::AlphaMask || layer->matteType == CompositeMethod::… in updateMatte()
1209 delete(layer->scene); in updateMatte()
1210 layer->scene = nullptr; in updateMatte()
1219 if (layer->effects.count == 0) return; in updateEffect()
1221 for (auto ef = layer->effects.begin(); ef < layer->effects.end(); ++ef) { in updateEffect()
1222 if (!(*ef)->enable) continue; in updateEffect()
1223 switch ((*ef)->type) { in updateEffect()
1226 …layer->scene->push(SceneEffect::GaussianBlur, sqrt(effect->blurness(frameNo)), effect->direction(f… in updateEffect()
1237 layer->scene = nullptr; in updateLayer()
1240 if (frameNo < layer->inFrame || frameNo >= layer->outFrame) return; in updateLayer()
1245 if (layer->type != LottieLayer::Null && layer->cache.opacity == 0) return; in updateLayer()
1248 layer->scene = Scene::gen().release(); in updateLayer()
1249 layer->scene->id = layer->id; in updateLayer()
1252 if (layer->type != LottieLayer::Null) layer->scene->opacity(layer->cache.opacity); in updateLayer()
1254 layer->scene->transform(layer->cache.matrix); in updateLayer()
1258 switch (layer->type) { in updateLayer()
1276 if (!layer->children.empty()) { in updateLayer()
1278 contexts.back(new RenderContext(layer->pooling())); in updateLayer()
1288 layer->scene->blend(layer->blendMethod); in updateLayer()
1293 if (!layer->matteSrc) scene->push(cast(layer->scene)); in updateLayer()
1299 for (auto asset = comp->assets.begin(); asset < comp->assets.end(); ++asset) { in _buildReference()
1300 if (layer->rid != (*asset)->id) continue; in _buildReference()
1301 if (layer->type == LottieLayer::Precomp) { in _buildReference()
1304 layer->children = assetLayer->children; in _buildReference()
1305 layer->reqFragment = assetLayer->reqFragment; in _buildReference()
1307 } else if (layer->type == LottieLayer::Image) { in _buildReference()
1308 layer->children.push(*asset); in _buildReference()
1317 if (child->pidx == -1) return; in _buildHierarchy()
1319 if (child->matteTarget && child->pidx == child->matteTarget->idx) { in _buildHierarchy()
1320 child->parent = child->matteTarget; in _buildHierarchy()
1324 for (auto p = parent->children.begin(); p < parent->children.end(); ++p) { in _buildHierarchy()
1327 if (child->pidx == parent->idx) { in _buildHierarchy()
1328 child->parent = parent; in _buildHierarchy()
1331 if (parent->matteTarget && parent->matteTarget->idx == child->pidx) { in _buildHierarchy()
1332 child->parent = parent->matteTarget; in _buildHierarchy()
1342 for (auto c = parent->children.begin(); c < parent->children.end(); ++c) { in _attachFont()
1344 auto& doc = text->doc(0); in _attachFont()
1347 for (uint32_t i = 0; i < comp->fonts.count; ++i) { in _attachFont()
1348 auto font = comp->fonts[i]; in _attachFont()
1349 auto len2 = strlen(font->name); in _attachFont()
1350 if (len == len2 && !strcmp(font->name, doc.name)) { in _attachFont()
1351 text->font = font; in _attachFont()
1361 if (parent->children.count == 0) return false; in _buildComposition()
1362 if (parent->buildDone) return true; in _buildComposition()
1363 parent->buildDone = true; in _buildComposition()
1365 for (auto c = parent->children.begin(); c < parent->children.end(); ++c) { in _buildComposition()
1369 if (child->rid) _buildReference(comp, child); in _buildComposition()
1371 if (child->matteType != CompositeMethod::None) { in _buildComposition()
1373 if (child->mid == -1) { in _buildComposition()
1374 if (c > parent->children.begin()) { in _buildComposition()
1375 child->matteTarget = static_cast<LottieLayer*>(*(c - 1)); in _buildComposition()
1378 } else child->matteTarget = parent->layerByIdx(child->mid); in _buildComposition()
1381 if (child->matteTarget) { in _buildComposition()
1383 _buildHierarchy(parent, child->matteTarget); in _buildComposition()
1385 if (child->matteTarget->rid) _buildReference(comp, child->matteTarget); in _buildComposition()
1390 if (child->type == LottieLayer::Text) _attachFont(comp, child); in _buildComposition()
1402 if (comp->root->children.empty()) return false; in update()
1404 frameNo += comp->root->inFrame; in update()
1405 if (frameNo <comp->root->inFrame) frameNo = comp->root->inFrame; in update()
1406 if (frameNo >= comp->root->outFrame) frameNo = (comp->root->outFrame - 1); in update()
1409 auto root = comp->root; in update()
1410 root->scene->clear(); in update()
1412 if (exps && comp->expressions) exps->update(comp->timeAtFrame(frameNo)); in update()
1414 for (auto child = root->children.end() - 1; child >= root->children.begin(); --child) { in update()
1416 if (!layer->matteSrc) updateLayer(comp, root->scene, layer, frameNo); in update()
1427 comp->root->scene = Scene::gen().release(); in build()
1429 _buildComposition(comp, comp->root); in build()
1435 clip->appendRect(0, 0, comp->w, comp->h); in build()
1436 comp->root->scene->clip(std::move(clip)); in build()