From baa18111b01c9593a77a510f5e0bdff6bcbebc4a Mon Sep 17 00:00:00 2001 From: avivian Date: Tue, 2 Jul 2024 13:49:18 +0000 Subject: [PATCH] use varuint for writing/reading objectid, total properties and property key in animation reset objectId, propertykey are definitely written as varuint, not sure if properties total needs to be, but doesn't hurt to have it that way either I think. I'm not sure if this is everything that needs to be updated. I tried to use `generate_core_runtime` to update the flutter runtime but that made a bunch of changes like unused imports all over the place... Diffs= 07cbce551 use varuint for writing/reading objectid, total properties and property key in animation reset (#7510) Co-authored-by: Arthur Vivian Co-authored-by: Hernan Torrisi --- .rive_head | 2 +- .../rive_core/animation/animation_reset_factory.dart | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.rive_head b/.rive_head index 853c9155..2cc54581 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -f9b1e8ec2ff7960990f87ef855c669f6a4a86b1d +07cbce5511e451396513f9d092a72193d41844f5 diff --git a/lib/src/rive_core/animation/animation_reset_factory.dart b/lib/src/rive_core/animation/animation_reset_factory.dart index dce4b61e..7840cade 100644 --- a/lib/src/rive_core/animation/animation_reset_factory.dart +++ b/lib/src/rive_core/animation/animation_reset_factory.dart @@ -33,15 +33,15 @@ class AnimationReset { } void writeObjectId(int id) { - _writer.writeInt8(id); + _writer.writeVarUint(id); } void writeTotalProperties(int totalProperties) { - _writer.writeInt8(totalProperties); + _writer.writeVarUint(totalProperties); } void writePropertyKey(int propertyKey) { - _writer.writeInt8(propertyKey); + _writer.writeVarUint(propertyKey); } void writeColor(int value) { @@ -74,15 +74,15 @@ class AnimationReset { reader.readIndex = 0; while (reader.readIndex < _dataSize) { // First we read the object's id - final objectIntId = reader.readInt8(); + final objectIntId = reader.readVarUint(); final objectId = resolveId(objectIntId); final object = core.resolve(objectId); // Second we read how many keyframed properties it has - final totalProperties = reader.readInt8(); + final totalProperties = reader.readVarUint(); int currentPropertyIndex = 0; while (currentPropertyIndex < totalProperties) { // Third we read the property key for each property - final propertyKey = reader.readInt8(); + final propertyKey = reader.readVarUint(); // Fourth we read the property value for each property if (_isDouble(propertyKey, object!)) { double value = reader.readFloat32();