Skip to content

Commit

Permalink
Optimization 🔥
Browse files Browse the repository at this point in the history
	modified:   src/frame.rs
  • Loading branch information
NiiightmareXD committed Nov 24, 2023
1 parent 73cecbe commit 97021e5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ impl<'a> FrameBuffer<'a> {
/// Get The Raw Pixel Data Without Padding
#[allow(clippy::type_complexity)]
pub fn as_raw_nopadding_buffer(&'a mut self) -> Result<&'a [u8], Box<dyn Error + Send + Sync>> {
if !self.has_padding() {
return Ok(self.raw_buffer);
}

let frame_size = (self.width * self.height * 4) as usize;
if self.buffer.capacity() < frame_size {
trace!("Resizing Preallocated Buffer");
Expand Down

0 comments on commit 97021e5

Please sign in to comment.