mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-24 00:06:10 +00:00
Added colorspace to SDL_CameraSpec
This commit is contained in:
@@ -274,8 +274,18 @@ int SDL_AppIterate(void *appstate)
|
||||
SDL_DestroyTexture(texture);
|
||||
}
|
||||
|
||||
SDL_Colorspace colorspace = SDL_COLORSPACE_UNKNOWN;
|
||||
SDL_GetSurfaceColorspace(frame_current, &colorspace);
|
||||
|
||||
/* Create texture with appropriate format */
|
||||
texture = SDL_CreateTexture(renderer, frame_current->format->format, SDL_TEXTUREACCESS_STREAMING, frame_current->w, frame_current->h);
|
||||
SDL_PropertiesID props = SDL_CreateProperties();
|
||||
SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER, frame_current->format->format);
|
||||
SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER, colorspace);
|
||||
SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER, SDL_TEXTUREACCESS_STREAMING);
|
||||
SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER, frame_current->w);
|
||||
SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER, frame_current->h);
|
||||
texture = SDL_CreateTextureWithProperties(renderer, props);
|
||||
SDL_DestroyProperties(props);
|
||||
if (!texture) {
|
||||
SDL_Log("Couldn't create texture: %s", SDL_GetError());
|
||||
return SDL_APP_FAILURE;
|
||||
|
||||
Reference in New Issue
Block a user