mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Changed set_clip_rect parameter to an option
This commit is contained in:
+10
-2
@@ -422,8 +422,16 @@ impl Renderer {
|
||||
rect
|
||||
}
|
||||
|
||||
pub fn set_clip_rect(&self, rect: &Rect) -> SdlResult<()> {
|
||||
let ret = unsafe { ll::SDL_RenderSetClipRect(self.raw, rect) };
|
||||
pub fn set_clip_rect(&self, rect: Option<Rect>) -> SdlResult<()> {
|
||||
let ret = unsafe {
|
||||
ll::SDL_RenderSetClipRect(
|
||||
self.raw,
|
||||
match rect {
|
||||
Some(ref rect) => rect as *const _,
|
||||
None => ptr::null()
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
if ret == 0 { Ok(()) }
|
||||
else { Err(get_error()) }
|
||||
|
||||
Reference in New Issue
Block a user