Skip to content

Commit

Permalink
Write colorbuffer directly to io if it fits in format (#4475)
Browse files Browse the repository at this point in the history
* Write colorbuffer directly to io if it fits in format

* add changelog
  • Loading branch information
jkrumbiegel authored Oct 14, 2024
1 parent beb39c5 commit e74adcb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased]

- Improved performance of `record` by avoiding unnecessary copying in common cases [#4475](https://github.com/MakieOrg/Makie.jl/pull/4475).

## [0.21.14] - 2024-10-11

- Fixed relocatability of GLMakie [#4461](https://github.com/MakieOrg/Makie.jl/pull/4461).
Expand Down
8 changes: 6 additions & 2 deletions src/ffmpeg-util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,12 @@ function recordframe!(io::VideoStream)
# Make no copy if already Matrix{RGB{N0f8}}
# There may be a 1px padding for odd dimensions
xdim, ydim = size(glnative)
copy!(view(io.buffer, 1:xdim, 1:ydim), glnative)
write(io.io, io.buffer)
if eltype(glnative) == eltype(io.buffer) && size(glnative) == size(io.buffer)
write(io.io, glnative)
else
copy!(view(io.buffer, 1:xdim, 1:ydim), glnative)
write(io.io, io.buffer)
end
next_tick!(io.tick_controller)
return
end
Expand Down

0 comments on commit e74adcb

Please sign in to comment.