fna-workbench

fna-workbench Commit Details


Date:2016-01-14 10:30:57 (9 years 7 months ago)
Author:Ethan Lee
Branch:master
Commit:249a2974ccd034d1d8b17e1bb09b84c5579d7b0c
Parents: f49b718ddf49dfd8f8289d084b59540e05e9b45c
Message:Use SDL2#'s SDL_Surface struct

Changes:

File differences

src/SDL2/SDL2_FNAPlatform.cs
662662
663663
664664
665
665
666666
667667
668668
......
756756
757757
758758
759
759
760760
761761
762762
......
802802
803803
804804
805
805
806806
807807
808808
......
863863
864864
865865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885866
886867
887868
888869
889870
890
871
891872
892873
893874
int rh;
unsafe
{
SDL_Surface* surPtr = (SDL_Surface*) surface;
SDL.SDL_Surface* surPtr = (SDL.SDL_Surface*) surface;
rw = surPtr->w;
rh = surPtr->h;
}
// Copy surface data to output managed byte array
unsafe
{
SDL_Surface* surPtr = (SDL_Surface*) surface;
SDL.SDL_Surface* surPtr = (SDL.SDL_Surface*) surface;
width = surPtr->w;
height = surPtr->h;
pixels = new byte[width * height * 4]; // MUST be SurfaceFormat.Color!
SDL.SDL_LockSurface(surface);
unsafe
{
SDL_Surface* surPtr = (SDL_Surface*) surface;
SDL.SDL_Surface* surPtr = (SDL.SDL_Surface*) surface;
Marshal.Copy(
data,
0,
#region Private Static SDL_Surface Interop
[StructLayout(LayoutKind.Sequential)]
private struct SDL_Surface
{
#pragma warning disable 0169
UInt32 flags;
public IntPtr format;
public Int32 w;
public Int32 h;
Int32 pitch;
public IntPtr pixels;
IntPtr userdata;
Int32 locked;
IntPtr lock_data;
SDL.SDL_Rect clip_rect;
IntPtr map;
Int32 refcount;
#pragma warning restore 0169
}
private static unsafe IntPtr INTERNAL_convertSurfaceFormat(IntPtr surface)
{
IntPtr result = surface;
unsafe
{
SDL_Surface* surPtr = (SDL_Surface*) surface;
SDL.SDL_Surface* surPtr = (SDL.SDL_Surface*) surface;
SDL.SDL_PixelFormat* pixelFormatPtr = (SDL.SDL_PixelFormat*) surPtr->format;
// SurfaceFormat.Color is SDL_PIXELFORMAT_ABGR8888

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.56852s using 13 queries.