Skip to content

Commit 6d458da

Browse files
Make Texture::update_from_pixels allow a pixel buffer larger than
width * height
1 parent 1aec020 commit 6d458da

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/graphics/texture.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@ impl Texture {
315315

316316
/// Update a part of the texture from an array of pixels.
317317
///
318-
/// The size of the pixel array must match the width and height arguments,
319-
/// and it must contain 32-bits RGBA pixels.
318+
/// `pixels` must contain at least `width * height` 32 bit RGBA pixels.
320319
///
321320
/// This function does nothing if the texture was not previously created.
322321
///
@@ -328,7 +327,7 @@ impl Texture {
328327
assert!(
329328
x + width <= my_dims.x
330329
&& y + height <= my_dims.y
331-
&& pixels.len() == (width * height * 4) as usize
330+
&& pixels.len() >= (width * height * 4) as usize
332331
);
333332
unsafe { ffi::sfTexture_updateFromPixels(self, pixels.as_ptr(), width, height, x, y) }
334333
}

0 commit comments

Comments
 (0)