mirror of
https://github.com/Ryujinx/SDL2-CS.git
synced 2025-02-02 09:01:01 +00:00
Merge pull request #37 from babelshift/sdl-locktexture-allow-null-rect
Adding overload for SDL_LockTexture to allow IntPtr.Zero for "rect" parameter
This commit is contained in:
commit
3f2eeba67f
34
src/SDL2.cs
34
src/SDL2.cs
|
@ -1658,7 +1658,18 @@ namespace SDL2
|
|||
out byte b
|
||||
);
|
||||
|
||||
/* texture refers to an SDL_Texture*, pixels to a void* */
|
||||
/// <summary>
|
||||
/// Use this function to lock a portion of the texture for write-only pixel access.
|
||||
/// </summary>
|
||||
/// <param name="texture">the texture to lock for access, which was created with
|
||||
/// SDL_TEXTUREACCESS_STREAMING (refers to a SDL_Texture*)</param>
|
||||
/// <param name="rect">an SDL_Rect structure representing the area to lock for access;
|
||||
/// NULL to lock the entire texture </param>
|
||||
/// <param name="pixels">this is filled in with a pointer to the locked pixels, appropriately
|
||||
/// offset by the locked area (refers to a void*)</param>
|
||||
/// <param name="pitch">this is filled in with the pitch of the locked pixels </param>
|
||||
/// <returns>Returns 0 on success or a negative error code if the texture is not valid or
|
||||
/// was not created with SDL_TEXTUREACCESS_STREAMING; call <see cref="SDL_GetError()"/> for more information. </returns>
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_LockTexture(
|
||||
IntPtr texture,
|
||||
|
@ -1666,6 +1677,27 @@ namespace SDL2
|
|||
out IntPtr pixels,
|
||||
out int pitch
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Use this function to lock a portion of the texture for write-only pixel access. This overload
|
||||
/// allows for passing an IntPtr.Zero (null) rect value to lock the entire texture.
|
||||
/// </summary>
|
||||
/// <param name="texture">the texture to lock for access, which was created with
|
||||
/// SDL_TEXTUREACCESS_STREAMING (refers to a SDL_Texture*)</param>
|
||||
/// <param name="rect">an SDL_Rect structure representing the area to lock for access;
|
||||
/// NULL to lock the entire texture </param>
|
||||
/// <param name="pixels">this is filled in with a pointer to the locked pixels, appropriately
|
||||
/// offset by the locked area (refers to a void*)</param>
|
||||
/// <param name="pitch">this is filled in with the pitch of the locked pixels </param>
|
||||
/// <returns>Returns 0 on success or a negative error code if the texture is not valid or
|
||||
/// was not created with SDL_TEXTUREACCESS_STREAMING; call <see cref="SDL_GetError()"/> for more information. </returns>
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_LockTexture(
|
||||
IntPtr texture,
|
||||
IntPtr rect,
|
||||
out IntPtr pixels,
|
||||
out int pitch
|
||||
);
|
||||
|
||||
/* texture refers to an SDL_Texture* */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
|
|
Loading…
Reference in a new issue