From: Kartik Thakore <thakore.kartik@gmail.com>
Date: Sat, 31 Oct 2009 00:21:36 +0000 (-0400)
Subject: Added CreateRGBSurfaceFrom as an new constructor of SDL::Surface. Need to test it
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=871d7fa3c7848a526b56537ff8e0381fd4dcb460;p=sdlgit%2FSDL_perl.git

Added CreateRGBSurfaceFrom as an new constructor of SDL::Surface. Need to test it
---

diff --git a/src/Core/objects/Surface.xs b/src/Core/objects/Surface.xs
index d0e96ac..74f5244 100644
--- a/src/Core/objects/Surface.xs
+++ b/src/Core/objects/Surface.xs
@@ -45,6 +45,30 @@ surface_new (CLASS, flags, width, height, depth, Rmask, Gmask, Bmask, Amask )
 	OUTPUT:
 		RETVAL
 
+SDL_Surface *
+surface_new_from (CLASS, pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask )
+	char *CLASS
+	char *pixels
+	int width
+	int height
+	int depth
+	int pitch
+	Uint32 Rmask
+	Uint32 Gmask
+	Uint32 Bmask
+	Uint32 Amask
+	CODE:
+		void* pixeldata;
+		int len = pitch * height;
+		Newx(pixeldata,len,Uint8);
+		Copy(pixels,pixeldata,len,Uint8);
+		RETVAL = SDL_CreateRGBSurfaceFrom ( pixeldata, width, height,
+				depth, pitch, Rmask, Gmask, Bmask, Amask );
+	OUTPUT:	
+		RETVAL
+
+
+
 SDL_PixelFormat *
 surface_format ( surface )
 	SDL_Surface *surface
diff --git a/t/core_surface.t b/t/core_surface.t
index 51913df..e006f60 100644
--- a/t/core_surface.t
+++ b/t/core_surface.t
@@ -21,6 +21,7 @@ use Test::More tests => 35;
 
 my $surface
     = SDL::Surface->new( SDL::SDL_ANYFORMAT(), 640, 320, 8, 0, 0, 0, 0 );
+    #TODO: test SDL::Surface->new_from
 isa_ok( $surface, 'SDL::Surface' );
 is( $surface->w,     640, 'surface has width' );
 is( $surface->h,     320, 'surface has height' );
diff --git a/t/core_video.t b/t/core_video.t
index 249a244..dcce70b 100644
--- a/t/core_video.t
+++ b/t/core_video.t
@@ -123,7 +123,6 @@ my @left = qw/
 	get_gamma_ramp
 	get_RGB
 	get_RGBA
-	create_RGB_surface_from
 	convert_surface
 	display_format
 	display_format_alpha