We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b64d7a6 commit 53c8a40Copy full SHA for 53c8a40
src/sdl2/render.rs
@@ -739,10 +739,11 @@ impl<'a> Renderer<'a> {
739
740
/// Fills a rectangle on the current rendering target with the drawing
741
/// color.
742
+ /// Passing None will fill the entire rendering target.
743
/// Errors if drawing fails for any reason (e.g. driver failure)
- pub fn fill_rect(&mut self, rect: Rect) -> Result<(), String> {
744
+ pub fn fill_rect<R: Into<Option<Rect>>>(&mut self, rect: R) -> Result<(), String> {
745
let result = unsafe {
- ll::SDL_RenderFillRect(self.raw, rect.raw())
746
+ ll::SDL_RenderFillRect(self.raw, rect.into().map(|r|{r.raw()}).unwrap_or(ptr::null()))
747
};
748
if result != 0 {
749
Err(get_error())
0 commit comments