mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Lottie optimization
This commit is contained in:
parent
920de21020
commit
ea4a203285
@ -38,55 +38,27 @@ static void processRenderTree(std::shared_ptr<RenderTreeNode> const &node, Vecto
|
|||||||
|
|
||||||
double alpha = node->alpha();
|
double alpha = node->alpha();
|
||||||
|
|
||||||
/*if (node->_contentItem) {
|
if (node->_contentItem) {
|
||||||
RenderTreeNodeContentItem *contentItem = node->_contentItem.get();
|
RenderTreeNodeContentItem *contentItem = node->_contentItem.get();
|
||||||
for (const auto &shadingVariant : contentItem->shadings) {
|
for (const auto &shadingVariant : contentItem->shadings) {
|
||||||
if (shadingVariant->stroke) {
|
|
||||||
CGRect shapeBounds = bezierPathsBoundingBoxParallel(bezierPathsBoundingBoxContext, shadingVariant->explicitPath.value());
|
CGRect shapeBounds = bezierPathsBoundingBoxParallel(bezierPathsBoundingBoxContext, shadingVariant->explicitPath.value());
|
||||||
|
if (shadingVariant->stroke) {
|
||||||
shapeBounds = shapeBounds.insetBy(-shadingVariant->stroke->lineWidth / 2.0, -shadingVariant->stroke->lineWidth / 2.0);
|
shapeBounds = shapeBounds.insetBy(-shadingVariant->stroke->lineWidth / 2.0, -shadingVariant->stroke->lineWidth / 2.0);
|
||||||
|
if (effectiveLocalBounds) {
|
||||||
|
effectiveLocalBounds = effectiveLocalBounds->unionWith(shapeBounds);
|
||||||
|
} else {
|
||||||
effectiveLocalBounds = shapeBounds;
|
effectiveLocalBounds = shapeBounds;
|
||||||
|
|
||||||
switch (shadingVariant->stroke->shading->type()) {
|
|
||||||
case RenderTreeNodeContent::ShadingType::Solid: {
|
|
||||||
RenderTreeNodeContent::SolidShading *solidShading = (RenderTreeNodeContent::SolidShading *)shadingVariant->stroke->shading.get();
|
|
||||||
|
|
||||||
alpha *= solidShading->opacity;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case RenderTreeNodeContent::ShadingType::Gradient: {
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else if (shadingVariant->fill) {
|
} else if (shadingVariant->fill) {
|
||||||
CGRect shapeBounds = bezierPathsBoundingBoxParallel(bezierPathsBoundingBoxContext, shadingVariant->explicitPath.value());
|
if (effectiveLocalBounds) {
|
||||||
|
effectiveLocalBounds = effectiveLocalBounds->unionWith(shapeBounds);
|
||||||
|
} else {
|
||||||
effectiveLocalBounds = shapeBounds;
|
effectiveLocalBounds = shapeBounds;
|
||||||
|
|
||||||
switch (shadingVariant->fill->shading->type()) {
|
|
||||||
case RenderTreeNodeContent::ShadingType::Solid: {
|
|
||||||
RenderTreeNodeContent::SolidShading *solidShading = (RenderTreeNodeContent::SolidShading *)shadingVariant->fill->shading.get();
|
|
||||||
|
|
||||||
alpha *= solidShading->opacity;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case RenderTreeNodeContent::ShadingType::Gradient: {
|
|
||||||
RenderTreeNodeContent::GradientShading *gradientShading = (RenderTreeNodeContent::GradientShading *)shadingVariant->fill->shading.get();
|
|
||||||
|
|
||||||
alpha *= gradientShading->opacity;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
if (node->content()) {
|
/*if (node->content()) {
|
||||||
RenderTreeNodeContent *shapeContent = node->content().get();
|
RenderTreeNodeContent *shapeContent = node->content().get();
|
||||||
|
|
||||||
CGRect shapeBounds = bezierPathsBoundingBoxParallel(bezierPathsBoundingBoxContext, shapeContent->paths);
|
CGRect shapeBounds = bezierPathsBoundingBoxParallel(bezierPathsBoundingBoxContext, shapeContent->paths);
|
||||||
@ -94,45 +66,10 @@ static void processRenderTree(std::shared_ptr<RenderTreeNode> const &node, Vecto
|
|||||||
if (shapeContent->stroke) {
|
if (shapeContent->stroke) {
|
||||||
shapeBounds = shapeBounds.insetBy(-shapeContent->stroke->lineWidth / 2.0, -shapeContent->stroke->lineWidth / 2.0);
|
shapeBounds = shapeBounds.insetBy(-shapeContent->stroke->lineWidth / 2.0, -shapeContent->stroke->lineWidth / 2.0);
|
||||||
effectiveLocalBounds = shapeBounds;
|
effectiveLocalBounds = shapeBounds;
|
||||||
|
|
||||||
/*switch (shapeContent->stroke->shading->type()) {
|
|
||||||
case RenderTreeNodeContent::ShadingType::Solid: {
|
|
||||||
RenderTreeNodeContent::SolidShading *solidShading = (RenderTreeNodeContent::SolidShading *)shapeContent->stroke->shading.get();
|
|
||||||
|
|
||||||
alpha *= solidShading->opacity;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case RenderTreeNodeContent::ShadingType::Gradient: {
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}*/
|
|
||||||
} else if (shapeContent->fill) {
|
} else if (shapeContent->fill) {
|
||||||
effectiveLocalBounds = shapeBounds;
|
effectiveLocalBounds = shapeBounds;
|
||||||
|
|
||||||
/*switch (shapeContent->fill->shading->type()) {
|
|
||||||
case RenderTreeNodeContent::ShadingType::Solid: {
|
|
||||||
RenderTreeNodeContent::SolidShading *solidShading = (RenderTreeNodeContent::SolidShading *)shapeContent->fill->shading.get();
|
|
||||||
|
|
||||||
alpha *= solidShading->opacity;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case RenderTreeNodeContent::ShadingType::Gradient: {
|
|
||||||
RenderTreeNodeContent::GradientShading *gradientShading = (RenderTreeNodeContent::GradientShading *)shapeContent->fill->shading.get();
|
|
||||||
|
|
||||||
alpha *= gradientShading->opacity;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}*/
|
}*/
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isInvertedMatte = isInvertedMask;
|
bool isInvertedMatte = isInvertedMask;
|
||||||
if (isInvertedMatte) {
|
if (isInvertedMatte) {
|
||||||
|
@ -78,7 +78,7 @@ private final class ReferenceCompareTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var continueFromName: String?
|
var continueFromName: String?
|
||||||
//continueFromName = "35707580709863498.json"
|
//continueFromName = "778160933443732778.json"
|
||||||
|
|
||||||
let _ = await processAnimationFolderAsync(basePath: bundlePath, path: "", stopOnFailure: true, process: { path, name, alwaysDraw in
|
let _ = await processAnimationFolderAsync(basePath: bundlePath, path: "", stopOnFailure: true, process: { path, name, alwaysDraw in
|
||||||
if let continueFromNameValue = continueFromName {
|
if let continueFromNameValue = continueFromName {
|
||||||
|
@ -1011,7 +1011,7 @@ public:
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
shadingVariant.renderTree = shadingRenderTree;
|
shadingVariant.renderTree = shadingRenderTree;
|
||||||
_renderTree->_subnodes.push_back(shadingRenderTree);
|
//_renderTree->_subnodes.push_back(shadingRenderTree);
|
||||||
|
|
||||||
auto itemShadingVariant = std::make_shared<RenderTreeNodeContentShadingVariant>();
|
auto itemShadingVariant = std::make_shared<RenderTreeNodeContentShadingVariant>();
|
||||||
if (shadingVariant.fill) {
|
if (shadingVariant.fill) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user