Permalink
Browse files

added some explanations in rect

  • Loading branch information...
dod38fr committed Oct 15, 2011
1 parent d850194 commit 7e43aba3618249b2200e493c2cc0154b94b8789b
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/SDLx/Validate.h
View
@@ -9,6 +9,7 @@ SV *rect( SV *rect, int* new_rect_made)
if( !SvOK(rect) )
{
+ /* create a new zero sized rectangle */
SDL_Rect* r = safemalloc( sizeof(SDL_Rect) );
(*new_rect_made) = 1;
r->x = 0;
@@ -19,6 +20,7 @@ SV *rect( SV *rect, int* new_rect_made)
}
else if( sv_derived_from(rect, "ARRAY") )
{
+ /* create a new rectangle from the array */
SDL_Rect* r = safemalloc( sizeof(SDL_Rect) );
(*new_rect_made) = 1;
int ra[4];
@@ -39,6 +41,7 @@ SV *rect( SV *rect, int* new_rect_made)
}
else if( sv_isobject(rect) && sv_derived_from(rect, "SDL::Rect") )
{
+ /* we already had a good rect. Just pass it along */
(*new_rect_made) = 0;
retval = rect;
SvREFCNT_inc(rect);
@@ -50,16 +53,16 @@ SV *rect( SV *rect, int* new_rect_made)
return retval;
}
-SV *surface( SV *surface )
+void assert_surface( SV *surface )
{
if( sv_isobject(surface) && sv_derived_from(surface, "SDL::Surface"))
{
/* memory leak detected by Test::LeakTrace */
/* SvREFCNT_inc(surface); */
- return surface;
+ return ;
}
croak("Surface must be SDL::Surface or SDLx::Surface");
- return NULL;
+ /* does not return */
}
char *_color_format( SV *color )

0 comments on commit 7e43aba

Please sign in to comment.