Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renderer.fill_rect now takes an Option<Rect>. #561

Merged
merged 1 commit into from
Nov 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/sdl2/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,10 +739,11 @@ impl<'a> Renderer<'a> {

/// Fills a rectangle on the current rendering target with the drawing
/// color.
/// Passing None will fill the entire rendering target.
/// Errors if drawing fails for any reason (e.g. driver failure)
pub fn fill_rect(&mut self, rect: Rect) -> Result<(), String> {
pub fn fill_rect<R: Into<Option<Rect>>>(&mut self, rect: R) -> Result<(), String> {
let result = unsafe {
ll::SDL_RenderFillRect(self.raw, rect.raw())
ll::SDL_RenderFillRect(self.raw, rect.into().map(|r|{r.raw()}).unwrap_or(ptr::null()))
};
if result != 0 {
Err(get_error())
Expand Down