Skip to content

Commit 11a19cc

Browse files
committed
perf(core): avoid cloning emitted GIF frame indices
Session-Id: 79d370e4-6659-40e5-94e4-321776e55484
1 parent 96a95c3 commit 11a19cc

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

crates/maple-render-core/src/gif_anim.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,15 @@ impl GifAnim {
158158

159159
if change {
160160
let delay = step_pending.saturating_sub(step);
161+
let emitted_indices = std::mem::replace(&mut prev_indices, curr_indices);
161162
self.blocks.push(GifBlock {
162-
data: prev_indices.clone(),
163+
data: emitted_indices,
163164
delay,
164165
width: ww,
165166
height: hh,
166167
});
167168
step_pending = step;
168169
_emit_ct += 1;
169-
}
170-
171-
if change {
172-
let _ = std::mem::replace(&mut prev_indices, curr_indices);
173170
} else {
174171
prev_indices = curr_indices;
175172
pending_frame_number = i;

0 commit comments

Comments
 (0)