From: Kartik Thakore <thakore.kartik@gmail.com>
Date: Thu, 15 Oct 2009 23:36:48 +0000 (-0400)
Subject: added pitch, get and set of pixels capability
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=18ef5a29029b7dcecc4c1a38c276e12d9d227d31;p=sdlgit%2FSDL_perl.git

added pitch, get and set of pixels capability
---

diff --git a/MANIFEST b/MANIFEST
index 33bfbad..eb36d5b 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -8,8 +8,6 @@ lib/SDL/Cdrom.pm
 lib/SDL/Color.pm
 lib/SDL/Config.pm
 lib/SDL/Constants.pm
-lib/SDL/Constants.pm.orig
-lib/SDL/Constants.pm.rej
 lib/SDL/Cursor.pm
 lib/SDL/Event.pm
 lib/SDL/Font.pm
@@ -43,7 +41,8 @@ MacOSX/launcher.h
 MacOSX/launcher.m
 MacOSX/SDLPerl.icns
 make/lib/SDL/Utility.pm
-MANIFEST			This list of files
+MANIFEST
+MANIFEST.bak
 MANIFEST.SKIP
 META.yml
 README
@@ -55,19 +54,53 @@ scripts/README
 scripts/SDL/Constants.pm
 scripts/sdl_const.pl
 scripts/sdl_words.txt
-src/Color.xs
+src/Core/Audio.xs
+src/Core/CDROM.xs
+src/Core/Events.xs
+src/Core/Files.xs
+src/Core/Joystick.xs
+src/Core/Mouse.xs
+src/Core/MultiThread.xs
+src/Core/objects/Color.xs
+src/Core/objects/PixelFormat.xs
+src/Core/objects/Rect.xs
+src/Core/SDL.xs
+src/Core/Time.xs
+src/Core/Video.xs
+src/Core/WindowMangement.xs
 src/defines.h
+src/Mixer/Channels.xs
+src/Mixer/Effects.xs
+src/Mixer/Groups.xs
+src/Mixer/Mixer.xs
+src/Mixer/Music.xs
+src/Mixer/objects/chunk.xs
+src/Mixer/objects/effectDone.xs
+src/Mixer/objects/effectFunc.xs
+src/Mixer/objects/fading.xs
+src/Mixer/objects/music.xs
+src/Mixer/objects/musicType.xs
+src/Mixer/README
+src/Mixer/Samples.xs
+src/Net/README
 src/OpenGL.xs
-src/Rect.xs
 src/SDL.xs
 src/SFont.h
 src/SFont.xs
 src/support/darwin_support.h
 src/support/darwin_support.m
 src/support/win32.c
+src/Surface.xs
+src/TTF/Attributes.xs
+src/TTF/Management.xs
+src/TTF/objects/TTF_font.xs
+src/TTF/README
+src/TTF/Render.xs
+src/TTF/TTF.xs
 t/apppm.t
 t/cdrompm.t
 t/colorpm.t
+t/constantspm.t
 t/cursorpm.t
 t/eventpm.t
 t/extendingrect.t
diff --git a/src/Surface.xs b/src/Surface.xs
index 761d880..a9df9b4 100644
--- a/src/Surface.xs
+++ b/src/Surface.xs
@@ -117,6 +117,14 @@ surface_display ( surface )
 		RETVAL
 
 Uint16
+surface_pitch( surface )
+	SDL_Surface *surface
+	CODE:
+		RETVAL = surface->pitch;
+	OUTPUT:
+		RETVAL
+
+Uint16
 surface_w ( surface )
 	SDL_Surface *surface
 	CODE:
@@ -132,6 +140,31 @@ surface_h ( surface )
 	OUTPUT:
 		RETVAL
 
+IV
+surface_get_pixels(surface)
+	SDL_Surface *surface
+	CODE:
+	RETVAL = PTR2IV(surface->pixels);
+	OUTPUT:
+	RETVAL
+
+void
+surface_set_pixels(surface, pixels)
+	SDL_Surface *surface
+
+	SV *pixels
+
+	PREINIT:
+	  STRLEN len;
+	  void *p;
+
+	CODE:
+	  p = SvPV(pixels, len);
+	  if (len > surface->pitch*surface->h)
+		len = surface->pitch*surface->h;
+	  memcpy(surface->pixels, p, len);
+
+
 void
 surface_DESTROY(surface)
 	SDL_Surface *surface