mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-28 07:29:09 +00:00
Removed SDL_RenderGeometryRawFloat()
After discussion with @ocornut, SDL_RenderGeometryRaw() will take floating point colors and conversion from 8-bit color can happen on the application side. We can always add an 8-bit color fast path in the future if we need it on handheld platforms. If you need code to do this in your application, you can use the following: int SDL_RenderGeometryRaw8BitColor(SDL_Renderer *renderer, SDL_Texture *texture, const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride, int num_vertices, const void *indices, int num_indices, int size_indices) { int i, retval, isstack; const Uint8 *color2 = (const Uint8 *)color; SDL_FColor *color3; if (num_vertices <= 0) { return SDL_InvalidParamError("num_vertices"); } if (!color) { return SDL_InvalidParamError("color"); } color3 = (SDL_FColor *)SDL_small_alloc(SDL_FColor, num_vertices, &isstack); if (!color3) { return -1; } for (i = 0; i < num_vertices; ++i) { color3[i].r = color->r / 255.0f; color3[i].g = color->g / 255.0f; color3[i].b = color->b / 255.0f; color3[i].a = color->a / 255.0f; color2 += color_stride; color = (const SDL_Color *)color2; } retval = SDL_RenderGeometryRaw(renderer, texture, xy, xy_stride, color3, sizeof(*color3), uv, uv_stride, num_vertices, indices, num_indices, size_indices); SDL_small_free(color3, isstack); return retval; } Fixes https://github.com/libsdl-org/SDL/issues/9009
This commit is contained in:
parent
22bca55d84
commit
6f199eabb8
6 changed files with 5 additions and 76 deletions
|
@ -1886,7 +1886,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
|
|||
* \param texture (optional) The SDL texture to use.
|
||||
* \param xy vertex positions.
|
||||
* \param xy_stride byte size to move from one element to the next element.
|
||||
* \param color vertex colors (as SDL_Color).
|
||||
* \param color vertex colors (as SDL_FColor).
|
||||
* \param color_stride byte size to move from one element to the next element.
|
||||
* \param uv vertex normalized texture coordinates.
|
||||
* \param uv_stride byte size to move from one element to the next element.
|
||||
|
@ -1903,40 +1903,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
|
|||
* \sa SDL_RenderGeometry
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
|
||||
SDL_Texture *texture,
|
||||
const float *xy, int xy_stride,
|
||||
const SDL_Color *color, int color_stride,
|
||||
const float *uv, int uv_stride,
|
||||
int num_vertices,
|
||||
const void *indices, int num_indices, int size_indices);
|
||||
|
||||
/**
|
||||
* Render a list of triangles, optionally using a texture and indices into the
|
||||
* vertex arrays Color and alpha modulation is done per vertex
|
||||
* (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
|
||||
*
|
||||
* \param renderer the rendering context.
|
||||
* \param texture (optional) The SDL texture to use.
|
||||
* \param xy vertex positions.
|
||||
* \param xy_stride byte size to move from one element to the next element.
|
||||
* \param color vertex colors (as SDL_FColor).
|
||||
* \param color_stride byte size to move from one element to the next element.
|
||||
* \param uv vertex normalized texture coordinates.
|
||||
* \param uv_stride byte size to move from one element to the next element.
|
||||
* \param num_vertices number of vertices.
|
||||
* \param indices (optional) An array of indices into the 'vertices' arrays,
|
||||
* if NULL all vertices will be rendered in sequential order.
|
||||
* \param num_indices number of indices.
|
||||
* \param size_indices index size: 1 (byte), 2 (short), 4 (int).
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_RenderGeometry
|
||||
* \sa SDL_RenderGeometryRaw
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_RenderGeometryRawFloat(SDL_Renderer *renderer,
|
||||
SDL_Texture *texture,
|
||||
const float *xy, int xy_stride,
|
||||
const SDL_FColor *color, int color_stride,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue