mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-27 23:35:45 +00:00
Updated SDL, Bullet and OpenAL soft libs
Fixed case sensitivity problem Fixed clang compiler problem with having the class namespace used in an inline for the == operator Tweaked some theme stuff to be more consistent. Added initial test of no-pie for linux test sidestep of getTexCoord in shadergen hlsl feature so we don't assert when getting the terrain's shaderstuffs(which uses float3 instead of normal float2)
This commit is contained in:
parent
e87dc787ee
commit
f8750dd8ed
1102 changed files with 205083 additions and 62836 deletions
|
|
@ -132,6 +132,16 @@ SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void GetWindowViewportValues(SDL_Renderer *renderer, int *logical_w, int *logical_h, SDL_Rect *viewport, SDL_FPoint *scale)
|
||||
{
|
||||
SDL_LockMutex(renderer->target_mutex);
|
||||
*logical_w = renderer->target ? renderer->logical_w_backup : renderer->logical_w;
|
||||
*logical_h = renderer->target ? renderer->logical_h_backup : renderer->logical_h;
|
||||
*viewport = renderer->target ? renderer->viewport_backup : renderer->viewport;
|
||||
*scale = renderer->target ? renderer->scale_backup : renderer->scale;
|
||||
SDL_UnlockMutex(renderer->target_mutex);
|
||||
}
|
||||
|
||||
static int SDLCALL
|
||||
SDL_RendererEventWatch(void *userdata, SDL_Event *event)
|
||||
{
|
||||
|
|
@ -197,35 +207,51 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event)
|
|||
}
|
||||
} else if (event->type == SDL_MOUSEMOTION) {
|
||||
SDL_Window *window = SDL_GetWindowFromID(event->motion.windowID);
|
||||
if (renderer->logical_w && window == renderer->window) {
|
||||
event->motion.x -= (int)(renderer->viewport.x * renderer->dpi_scale.x);
|
||||
event->motion.y -= (int)(renderer->viewport.y * renderer->dpi_scale.y);
|
||||
event->motion.x = (int)(event->motion.x / (renderer->scale.x * renderer->dpi_scale.x));
|
||||
event->motion.y = (int)(event->motion.y / (renderer->scale.y * renderer->dpi_scale.y));
|
||||
if (event->motion.xrel > 0) {
|
||||
event->motion.xrel = SDL_max(1, (int)(event->motion.xrel / (renderer->scale.x * renderer->dpi_scale.x)));
|
||||
} else if (event->motion.xrel < 0) {
|
||||
event->motion.xrel = SDL_min(-1, (int)(event->motion.xrel / (renderer->scale.x * renderer->dpi_scale.x)));
|
||||
}
|
||||
if (event->motion.yrel > 0) {
|
||||
event->motion.yrel = SDL_max(1, (int)(event->motion.yrel / (renderer->scale.y * renderer->dpi_scale.y)));
|
||||
} else if (event->motion.yrel < 0) {
|
||||
event->motion.yrel = SDL_min(-1, (int)(event->motion.yrel / (renderer->scale.y * renderer->dpi_scale.y)));
|
||||
if (window == renderer->window) {
|
||||
int logical_w, logical_h;
|
||||
SDL_Rect viewport;
|
||||
SDL_FPoint scale;
|
||||
GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale);
|
||||
if (logical_w) {
|
||||
event->motion.x -= (int)(viewport.x * renderer->dpi_scale.x);
|
||||
event->motion.y -= (int)(viewport.y * renderer->dpi_scale.y);
|
||||
event->motion.x = (int)(event->motion.x / (scale.x * renderer->dpi_scale.x));
|
||||
event->motion.y = (int)(event->motion.y / (scale.y * renderer->dpi_scale.y));
|
||||
if (event->motion.xrel > 0) {
|
||||
event->motion.xrel = SDL_max(1, (int)(event->motion.xrel / (scale.x * renderer->dpi_scale.x)));
|
||||
} else if (event->motion.xrel < 0) {
|
||||
event->motion.xrel = SDL_min(-1, (int)(event->motion.xrel / (scale.x * renderer->dpi_scale.x)));
|
||||
}
|
||||
if (event->motion.yrel > 0) {
|
||||
event->motion.yrel = SDL_max(1, (int)(event->motion.yrel / (scale.y * renderer->dpi_scale.y)));
|
||||
} else if (event->motion.yrel < 0) {
|
||||
event->motion.yrel = SDL_min(-1, (int)(event->motion.yrel / (scale.y * renderer->dpi_scale.y)));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (event->type == SDL_MOUSEBUTTONDOWN ||
|
||||
event->type == SDL_MOUSEBUTTONUP) {
|
||||
SDL_Window *window = SDL_GetWindowFromID(event->button.windowID);
|
||||
if (renderer->logical_w && window == renderer->window) {
|
||||
event->button.x -= (int)(renderer->viewport.x * renderer->dpi_scale.x);
|
||||
event->button.y -= (int)(renderer->viewport.y * renderer->dpi_scale.y);
|
||||
event->button.x = (int)(event->button.x / (renderer->scale.x * renderer->dpi_scale.x));
|
||||
event->button.y = (int)(event->button.y / (renderer->scale.y * renderer->dpi_scale.y));
|
||||
if (window == renderer->window) {
|
||||
int logical_w, logical_h;
|
||||
SDL_Rect viewport;
|
||||
SDL_FPoint scale;
|
||||
GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale);
|
||||
if (logical_w) {
|
||||
event->button.x -= (int)(viewport.x * renderer->dpi_scale.x);
|
||||
event->button.y -= (int)(viewport.y * renderer->dpi_scale.y);
|
||||
event->button.x = (int)(event->button.x / (scale.x * renderer->dpi_scale.x));
|
||||
event->button.y = (int)(event->button.y / (scale.y * renderer->dpi_scale.y));
|
||||
}
|
||||
}
|
||||
} else if (event->type == SDL_FINGERDOWN ||
|
||||
event->type == SDL_FINGERUP ||
|
||||
event->type == SDL_FINGERMOTION) {
|
||||
if (renderer->logical_w) {
|
||||
int logical_w, logical_h;
|
||||
SDL_Rect viewport;
|
||||
SDL_FPoint scale;
|
||||
GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale);
|
||||
if (logical_w) {
|
||||
int w = 1;
|
||||
int h = 1;
|
||||
SDL_GetRendererOutputSize(renderer, &w, &h);
|
||||
|
|
@ -233,18 +259,18 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event)
|
|||
event->tfinger.x *= (w - 1);
|
||||
event->tfinger.y *= (h - 1);
|
||||
|
||||
event->tfinger.x -= (renderer->viewport.x * renderer->dpi_scale.x);
|
||||
event->tfinger.y -= (renderer->viewport.y * renderer->dpi_scale.y);
|
||||
event->tfinger.x = (event->tfinger.x / (renderer->scale.x * renderer->dpi_scale.x));
|
||||
event->tfinger.y = (event->tfinger.y / (renderer->scale.y * renderer->dpi_scale.y));
|
||||
event->tfinger.x -= (viewport.x * renderer->dpi_scale.x);
|
||||
event->tfinger.y -= (viewport.y * renderer->dpi_scale.y);
|
||||
event->tfinger.x = (event->tfinger.x / (scale.x * renderer->dpi_scale.x));
|
||||
event->tfinger.y = (event->tfinger.y / (scale.y * renderer->dpi_scale.y));
|
||||
|
||||
if (renderer->logical_w > 1) {
|
||||
event->tfinger.x = event->tfinger.x / (renderer->logical_w - 1);
|
||||
if (logical_w > 1) {
|
||||
event->tfinger.x = event->tfinger.x / (logical_w - 1);
|
||||
} else {
|
||||
event->tfinger.x = 0.5f;
|
||||
}
|
||||
if (renderer->logical_h > 1) {
|
||||
event->tfinger.y = event->tfinger.y / (renderer->logical_h - 1);
|
||||
if (logical_h > 1) {
|
||||
event->tfinger.y = event->tfinger.y / (logical_h - 1);
|
||||
} else {
|
||||
event->tfinger.y = 0.5f;
|
||||
}
|
||||
|
|
@ -345,6 +371,7 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
|
|||
if (renderer) {
|
||||
renderer->magic = &renderer_magic;
|
||||
renderer->window = window;
|
||||
renderer->target_mutex = SDL_CreateMutex();
|
||||
renderer->scale.x = 1.0f;
|
||||
renderer->scale.y = 1.0f;
|
||||
renderer->dpi_scale.x = 1.0f;
|
||||
|
|
@ -392,6 +419,7 @@ SDL_CreateSoftwareRenderer(SDL_Surface * surface)
|
|||
|
||||
if (renderer) {
|
||||
renderer->magic = &renderer_magic;
|
||||
renderer->target_mutex = SDL_CreateMutex();
|
||||
renderer->scale.x = 1.0f;
|
||||
renderer->scale.y = 1.0f;
|
||||
|
||||
|
|
@ -493,6 +521,22 @@ GetClosestSupportedFormat(SDL_Renderer * renderer, Uint32 format)
|
|||
return renderer->info.texture_formats[0];
|
||||
}
|
||||
|
||||
|
||||
static SDL_ScaleMode SDL_GetScaleMode(void)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
|
||||
if (!hint || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
return SDL_ScaleModeNearest;
|
||||
} else if (SDL_strcasecmp(hint, "linear") == 0) {
|
||||
return SDL_ScaleModeLinear;
|
||||
} else if (SDL_strcasecmp(hint, "best") == 0) {
|
||||
return SDL_ScaleModeBest;
|
||||
} else {
|
||||
return (SDL_ScaleMode)SDL_atoi(hint);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Texture *
|
||||
SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int h)
|
||||
{
|
||||
|
|
@ -534,6 +578,7 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int
|
|||
texture->g = 255;
|
||||
texture->b = 255;
|
||||
texture->a = 255;
|
||||
texture->scaleMode = SDL_GetScaleMode();
|
||||
texture->renderer = renderer;
|
||||
texture->next = renderer->textures;
|
||||
if (renderer->textures) {
|
||||
|
|
@ -605,7 +650,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
|
|||
|
||||
/* See what the best texture format is */
|
||||
fmt = surface->format;
|
||||
if (fmt->Amask || SDL_GetColorKey(surface, NULL) == 0) {
|
||||
if (fmt->Amask || SDL_HasColorKey(surface)) {
|
||||
needAlpha = SDL_TRUE;
|
||||
} else {
|
||||
needAlpha = SDL_FALSE;
|
||||
|
|
@ -664,7 +709,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
|
|||
SDL_GetSurfaceAlphaMod(surface, &a);
|
||||
SDL_SetTextureAlphaMod(texture, a);
|
||||
|
||||
if (SDL_GetColorKey(surface, NULL) == 0) {
|
||||
if (SDL_HasColorKey(surface)) {
|
||||
/* We converted to a texture with alpha format */
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
} else {
|
||||
|
|
@ -1187,6 +1232,8 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
|||
}
|
||||
}
|
||||
|
||||
SDL_LockMutex(renderer->target_mutex);
|
||||
|
||||
if (texture && !renderer->target) {
|
||||
/* Make a backup of the viewport */
|
||||
renderer->viewport_backup = renderer->viewport;
|
||||
|
|
@ -1199,6 +1246,7 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
|||
renderer->target = texture;
|
||||
|
||||
if (renderer->SetRenderTarget(renderer, texture) < 0) {
|
||||
SDL_UnlockMutex(renderer->target_mutex);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -1221,6 +1269,9 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
|||
renderer->logical_w = renderer->logical_w_backup;
|
||||
renderer->logical_h = renderer->logical_h_backup;
|
||||
}
|
||||
|
||||
SDL_UnlockMutex(renderer->target_mutex);
|
||||
|
||||
if (renderer->UpdateViewport(renderer) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -1259,6 +1310,7 @@ UpdateLogicalSize(SDL_Renderer *renderer)
|
|||
|
||||
hint = SDL_GetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE);
|
||||
if (hint && (*hint == '1' || SDL_strcasecmp(hint, "overscan") == 0)) {
|
||||
#if SDL_VIDEO_RENDER_D3D
|
||||
SDL_bool overscan_supported = SDL_TRUE;
|
||||
/* Unfortunately, Direct3D 9 doesn't support negative viewport numbers
|
||||
which the overscan implementation relies on.
|
||||
|
|
@ -1269,6 +1321,9 @@ UpdateLogicalSize(SDL_Renderer *renderer)
|
|||
if (overscan_supported) {
|
||||
scale_policy = 1;
|
||||
}
|
||||
#else
|
||||
scale_policy = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
want_aspect = (float)renderer->logical_w / renderer->logical_h;
|
||||
|
|
@ -2086,6 +2141,10 @@ SDL_DestroyRenderer(SDL_Renderer * renderer)
|
|||
/* It's no longer magical... */
|
||||
renderer->magic = NULL;
|
||||
|
||||
/* Free the target mutex */
|
||||
SDL_DestroyMutex(renderer->target_mutex);
|
||||
renderer->target_mutex = NULL;
|
||||
|
||||
/* Free the renderer instance */
|
||||
renderer->DestroyRenderer(renderer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,20 @@
|
|||
|
||||
#include "SDL_render.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_yuv_sw_c.h"
|
||||
|
||||
/* The SDL 2D rendering system */
|
||||
|
||||
typedef struct SDL_RenderDriver SDL_RenderDriver;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDL_ScaleModeNearest,
|
||||
SDL_ScaleModeLinear,
|
||||
SDL_ScaleModeBest
|
||||
} SDL_ScaleMode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float x;
|
||||
|
|
@ -55,6 +63,7 @@ struct SDL_Texture
|
|||
int h; /**< The height of the texture */
|
||||
int modMode; /**< The texture modulation mode */
|
||||
SDL_BlendMode blendMode; /**< The texture blend mode */
|
||||
SDL_ScaleMode scaleMode; /**< The texture scale mode */
|
||||
Uint8 r, g, b, a; /**< Texture modulation values */
|
||||
|
||||
SDL_Renderer *renderer;
|
||||
|
|
@ -164,6 +173,7 @@ struct SDL_Renderer
|
|||
/* The list of textures */
|
||||
SDL_Texture *textures;
|
||||
SDL_Texture *target;
|
||||
SDL_mutex *target_mutex;
|
||||
|
||||
Uint8 r, g, b, a; /**< Color for drawing operations values */
|
||||
SDL_BlendMode blendMode; /**< The drawing blend mode */
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_yuv_sw_c_h_
|
||||
#define SDL_yuv_sw_c_h_
|
||||
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#include "SDL_video.h"
|
||||
|
|
@ -64,4 +68,6 @@ void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata);
|
|||
#define USE_MMX_ASSEMBLY 1
|
||||
#endif
|
||||
|
||||
#endif /* SDL_yuv_sw_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -664,18 +664,6 @@ D3D_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
|
|||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static D3DTEXTUREFILTERTYPE
|
||||
GetScaleQuality(void)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
|
||||
if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
return D3DTEXF_POINT;
|
||||
} else /* if (*hint == '1' || SDL_strcasecmp(hint, "linear") == 0) */ {
|
||||
return D3DTEXF_LINEAR;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD usage, Uint32 format, D3DFORMAT d3dfmt, int w, int h)
|
||||
{
|
||||
|
|
@ -829,7 +817,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
if (!texturedata) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
texturedata->scaleMode = GetScaleQuality();
|
||||
texturedata->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3DTEXF_POINT : D3DTEXF_LINEAR;
|
||||
|
||||
texture->driverdata = texturedata;
|
||||
|
||||
|
|
|
|||
|
|
@ -1161,17 +1161,6 @@ D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
|
|||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static D3D11_FILTER
|
||||
GetScaleQuality(void)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
return D3D11_FILTER_MIN_MAG_MIP_POINT;
|
||||
} else /* if (*hint == '1' || SDL_strcasecmp(hint, "linear") == 0) */ {
|
||||
return D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||
{
|
||||
|
|
@ -1192,7 +1181,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
SDL_OutOfMemory();
|
||||
return -1;
|
||||
}
|
||||
textureData->scaleMode = GetScaleQuality();
|
||||
textureData->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
|
||||
texture->driverdata = textureData;
|
||||
|
||||
|
|
@ -2234,8 +2223,6 @@ static int
|
|||
D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||
const SDL_Rect * srcrect, const SDL_FRect * dstrect)
|
||||
{
|
||||
D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
|
||||
D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
|
||||
float minu, maxu, minv, maxv;
|
||||
Float4 color;
|
||||
VertexPositionColor vertices[4];
|
||||
|
|
@ -2307,8 +2294,6 @@ D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
const SDL_Rect * srcrect, const SDL_FRect * dstrect,
|
||||
const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip)
|
||||
{
|
||||
D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
|
||||
D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
|
||||
float minu, maxu, minv, maxv;
|
||||
Float4 color;
|
||||
Float4X4 modelMatrix;
|
||||
|
|
|
|||
|
|
@ -752,8 +752,7 @@ METAL_ActivateRenderCommandEncoder(SDL_Renderer * renderer, MTLLoadAction load)
|
|||
static void
|
||||
METAL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
|
||||
{
|
||||
if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED ||
|
||||
event->event == SDL_WINDOWEVENT_SHOWN ||
|
||||
if (event->event == SDL_WINDOWEVENT_SHOWN ||
|
||||
event->event == SDL_WINDOWEVENT_HIDDEN) {
|
||||
// !!! FIXME: write me
|
||||
}
|
||||
|
|
@ -844,17 +843,24 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
mtltexdesc.height = (texture->h + 1) / 2;
|
||||
mtltexdesc.textureType = MTLTextureType2DArray;
|
||||
mtltexdesc.arrayLength = 2;
|
||||
mtltexture_uv = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
|
||||
} else if (nv12) {
|
||||
mtltexdesc.pixelFormat = MTLPixelFormatRG8Unorm;
|
||||
mtltexdesc.width = (texture->w + 1) / 2;
|
||||
mtltexdesc.height = (texture->h + 1) / 2;
|
||||
}
|
||||
|
||||
if (yuv || nv12) {
|
||||
mtltexture_uv = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
|
||||
if (mtltexture_uv == nil) {
|
||||
#if !__has_feature(objc_arc)
|
||||
[mtltexture release];
|
||||
#endif
|
||||
return SDL_SetError("Texture allocation failed");
|
||||
}
|
||||
}
|
||||
|
||||
METAL_TextureData *texturedata = [[METAL_TextureData alloc] init];
|
||||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
if (texture->scaleMode == SDL_ScaleModeNearest) {
|
||||
texturedata.mtlsampler = data.mtlsamplernearest;
|
||||
} else {
|
||||
texturedata.mtlsampler = data.mtlsamplerlinear;
|
||||
|
|
@ -957,8 +963,8 @@ METAL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
const Uint8 *Vplane, int Vpitch)
|
||||
{ @autoreleasepool {
|
||||
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
|
||||
int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0;
|
||||
int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1;
|
||||
const int Uslice = 0;
|
||||
const int Vslice = 1;
|
||||
|
||||
/* Bail out if we're supposed to update an empty rectangle */
|
||||
if (rect->w <= 0 || rect->h <= 0) {
|
||||
|
|
@ -1345,10 +1351,23 @@ static int
|
|||
METAL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
||||
Uint32 pixel_format, void * pixels, int pitch)
|
||||
{ @autoreleasepool {
|
||||
METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
|
||||
|
||||
/* Make sure we have a valid MTLTexture to read from, and an active command
|
||||
* buffer we can wait for. */
|
||||
METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad);
|
||||
|
||||
// !!! FIXME: this probably needs to commit the current command buffer, and probably waitUntilCompleted
|
||||
METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
|
||||
/* Wait for the current command buffer to finish, so we don't read from the
|
||||
* texture before the GPU finishes rendering to it. */
|
||||
if (data.mtlcmdencoder) {
|
||||
[data.mtlcmdencoder endEncoding];
|
||||
[data.mtlcmdbuffer commit];
|
||||
[data.mtlcmdbuffer waitUntilCompleted];
|
||||
|
||||
data.mtlcmdencoder = nil;
|
||||
data.mtlcmdbuffer = nil;
|
||||
}
|
||||
|
||||
id<MTLTexture> mtltexture = data.mtlpassdesc.colorAttachments[0].texture;
|
||||
MTLRegion mtlregion = MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h);
|
||||
|
||||
|
|
@ -1364,6 +1383,13 @@ METAL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
|||
const Uint32 temp_format = (mtltexture.pixelFormat == MTLPixelFormatBGRA8Unorm) ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_ABGR8888;
|
||||
const int status = SDL_ConvertPixels(rect->w, rect->h, temp_format, temp_pixels, temp_pitch, pixel_format, pixels, pitch);
|
||||
SDL_free(temp_pixels);
|
||||
|
||||
/* Set up an active command buffer and encoder once we're done. It will use
|
||||
* the same texture that was active before (even if it's part of the swap
|
||||
* chain), since we didn't clear that when waiting for the command buffer to
|
||||
* complete. */
|
||||
METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad);
|
||||
|
||||
return status;
|
||||
}}
|
||||
|
||||
|
|
|
|||
|
|
@ -703,18 +703,6 @@ convert_format(GL_RenderData *renderdata, Uint32 pixel_format,
|
|||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static GLenum
|
||||
GetScaleQuality(void)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
|
||||
if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
return GL_NEAREST;
|
||||
} else {
|
||||
return GL_LINEAR;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||
{
|
||||
|
|
@ -803,7 +791,7 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
|
||||
data->format = format;
|
||||
data->formattype = type;
|
||||
scaleMode = GetScaleQuality();
|
||||
scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR;
|
||||
renderdata->glEnable(data->type);
|
||||
renderdata->glBindTexture(data->type, data->texture);
|
||||
renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, scaleMode);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_shaders_gl_h_
|
||||
#define SDL_shaders_gl_h_
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
/* OpenGL shader implementation */
|
||||
|
|
@ -44,4 +48,6 @@ extern GL_ShaderContext * GL_CreateShaderContext(void);
|
|||
extern void GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader);
|
||||
extern void GL_DestroyShaderContext(GL_ShaderContext *ctx);
|
||||
|
||||
#endif /* SDL_shaders_gl_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -524,18 +524,6 @@ power_of_2(int input)
|
|||
return value;
|
||||
}
|
||||
|
||||
static GLenum
|
||||
GetScaleQuality(void)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
|
||||
if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
return GL_NEAREST;
|
||||
} else {
|
||||
return GL_LINEAR;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||
{
|
||||
|
|
@ -603,7 +591,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
|
||||
data->format = format;
|
||||
data->formattype = type;
|
||||
scaleMode = GetScaleQuality();
|
||||
scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR;
|
||||
renderdata->glBindTexture(data->type, data->texture);
|
||||
renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, scaleMode);
|
||||
renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER, scaleMode);
|
||||
|
|
|
|||
|
|
@ -553,18 +553,6 @@ static void GLES2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture);
|
|||
static int GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
|
||||
static void GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture);
|
||||
|
||||
static GLenum
|
||||
GetScaleQuality(void)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
|
||||
if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
return GL_NEAREST;
|
||||
} else {
|
||||
return GL_LINEAR;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
{
|
||||
|
|
@ -625,7 +613,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
|||
data->nv12 = ((texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21));
|
||||
data->texture_u = 0;
|
||||
data->texture_v = 0;
|
||||
scaleMode = GetScaleQuality();
|
||||
scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR;
|
||||
|
||||
/* Allocate a blob for image renderdata */
|
||||
if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
|
||||
|
|
@ -731,6 +719,10 @@ GLES2_TexSubImage2D(GLES2_DriverContext *data, GLenum target, GLint xoffset, GLi
|
|||
int src_pitch;
|
||||
int y;
|
||||
|
||||
if ((width == 0) || (height == 0) || (bpp == 0)) {
|
||||
return 0; /* nothing to do */
|
||||
}
|
||||
|
||||
/* Reformat the texture data into a tightly packed array */
|
||||
src_pitch = width * bpp;
|
||||
src = (Uint8 *)pixels;
|
||||
|
|
@ -1542,7 +1534,7 @@ GLES2_UpdateVertexBuffer(SDL_Renderer *renderer, GLES2_Attribute attr,
|
|||
GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
|
||||
|
||||
#if !SDL_GLES2_USE_VBOS
|
||||
data->glVertexAttribPointer(attr, attr == GLES2_ATTRIBUTE_ANGLE ? 1 : 2, GL_FLOAT, GL_FALSE, 0, vertexData);
|
||||
data->glVertexAttribPointer(attr, 2, GL_FLOAT, GL_FALSE, 0, vertexData);
|
||||
#else
|
||||
if (!data->vertex_buffers[attr]) {
|
||||
data->glGenBuffers(1, &data->vertex_buffers[attr]);
|
||||
|
|
@ -1557,7 +1549,7 @@ GLES2_UpdateVertexBuffer(SDL_Renderer *renderer, GLES2_Attribute attr,
|
|||
data->glBufferSubData(GL_ARRAY_BUFFER, 0, dataSizeInBytes, vertexData);
|
||||
}
|
||||
|
||||
data->glVertexAttribPointer(attr, attr == GLES2_ATTRIBUTE_ANGLE ? 1 : 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
data->glVertexAttribPointer(attr, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
|
@ -1873,8 +1865,9 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect
|
|||
GLfloat vertices[8];
|
||||
GLfloat texCoords[8];
|
||||
GLfloat translate[8];
|
||||
GLfloat fAngle[4];
|
||||
GLfloat fAngle[8];
|
||||
GLfloat tmp;
|
||||
float radian_angle;
|
||||
|
||||
GLES2_ActivateRenderer(renderer);
|
||||
|
||||
|
|
@ -1884,7 +1877,11 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect
|
|||
|
||||
data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_CENTER);
|
||||
data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_ANGLE);
|
||||
fAngle[0] = fAngle[1] = fAngle[2] = fAngle[3] = (GLfloat)(360.0f - angle);
|
||||
|
||||
radian_angle = (float)(M_PI * (360.0 - angle) / 180.0);
|
||||
fAngle[0] = fAngle[2] = fAngle[4] = fAngle[6] = (GLfloat)SDL_sin(radian_angle);
|
||||
/* render expects cos value - 1 (see GLES2_VertexSrc_Default_) */
|
||||
fAngle[1] = fAngle[3] = fAngle[5] = fAngle[7] = (GLfloat)SDL_cos(radian_angle) - 1.0f;
|
||||
/* Calculate the center of rotation */
|
||||
translate[0] = translate[2] = translate[4] = translate[6] = (center->x + dstrect->x);
|
||||
translate[1] = translate[3] = translate[5] = translate[7] = (center->y + dstrect->y);
|
||||
|
|
@ -1913,7 +1910,7 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect
|
|||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_CENTER, 2, GL_FLOAT, GL_FALSE, 0, translate);
|
||||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);*/
|
||||
|
||||
GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_ANGLE, fAngle, 4 * sizeof(GLfloat));
|
||||
GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_ANGLE, fAngle, 8 * sizeof(GLfloat));
|
||||
GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_CENTER, translate, 8 * sizeof(GLfloat));
|
||||
GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_POSITION, vertices, 8 * sizeof(GLfloat));
|
||||
|
||||
|
|
@ -1940,6 +1937,7 @@ GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
|||
{
|
||||
GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
|
||||
Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888;
|
||||
size_t buflen;
|
||||
void *temp_pixels;
|
||||
int temp_pitch;
|
||||
Uint8 *src, *dst, *tmp;
|
||||
|
|
@ -1949,7 +1947,12 @@ GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
|||
GLES2_ActivateRenderer(renderer);
|
||||
|
||||
temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format);
|
||||
temp_pixels = SDL_malloc(rect->h * temp_pitch);
|
||||
buflen = (size_t) (rect->h * temp_pitch);
|
||||
if (buflen == 0) {
|
||||
return 0; /* nothing to do. */
|
||||
}
|
||||
|
||||
temp_pixels = SDL_malloc(buflen);
|
||||
if (!temp_pixels) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,20 +30,24 @@
|
|||
/*************************************************************************************************
|
||||
* Vertex/fragment shader source *
|
||||
*************************************************************************************************/
|
||||
|
||||
/* Notes on a_angle:
|
||||
* It is a vector containing sin and cos for rotation matrix
|
||||
* To get correct rotation for most cases when a_angle is disabled cos
|
||||
value is decremented by 1.0 to get proper output with 0.0 which is
|
||||
default value
|
||||
*/
|
||||
static const Uint8 GLES2_VertexSrc_Default_[] = " \
|
||||
uniform mat4 u_projection; \
|
||||
attribute vec2 a_position; \
|
||||
attribute vec2 a_texCoord; \
|
||||
attribute float a_angle; \
|
||||
attribute vec2 a_angle; \
|
||||
attribute vec2 a_center; \
|
||||
varying vec2 v_texCoord; \
|
||||
\
|
||||
void main() \
|
||||
{ \
|
||||
float angle = radians(a_angle); \
|
||||
float c = cos(angle); \
|
||||
float s = sin(angle); \
|
||||
float s = a_angle[0]; \
|
||||
float c = a_angle[1] + 1.0; \
|
||||
mat2 rotationMatrix = mat2(c, -s, s, c); \
|
||||
vec2 position = rotationMatrix * (a_position - a_center) + a_center; \
|
||||
v_texCoord = a_texCoord; \
|
||||
|
|
|
|||
|
|
@ -186,18 +186,6 @@ TextureNextPow2(unsigned int w)
|
|||
}
|
||||
|
||||
|
||||
static int
|
||||
GetScaleQuality(void)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
|
||||
if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
return GU_NEAREST; /* GU_NEAREST good for tile-map */
|
||||
} else {
|
||||
return GU_LINEAR; /* GU_LINEAR good for scaling */
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
PixelFormatToPSPFMT(Uint32 format)
|
||||
{
|
||||
|
|
@ -514,7 +502,7 @@ void
|
|||
TextureActivate(SDL_Texture * texture)
|
||||
{
|
||||
PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
|
||||
int scaleMode = GetScaleQuality();
|
||||
int scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GU_NEAREST : GU_LINEAR;
|
||||
|
||||
/* Swizzling is useless with small textures. */
|
||||
if (texture->w >= 16 || texture->h >= 16)
|
||||
|
|
|
|||
|
|
@ -18,10 +18,16 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_blendfillrect_h_
|
||||
#define SDL_blendfillrect_h_
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
|
||||
extern int SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
extern int SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect * rects, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
#endif /* SDL_blendfillrect_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -18,10 +18,16 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_blendline_h_
|
||||
#define SDL_blendline_h_
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
|
||||
extern int SDL_BlendLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
extern int SDL_BlendLines(SDL_Surface * dst, const SDL_Point * points, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
#endif /* SDL_blendline_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -18,10 +18,16 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_blendpoint_h_
|
||||
#define SDL_blendpoint_h_
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
|
||||
extern int SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
extern int SDL_BlendPoints(SDL_Surface * dst, const SDL_Point * points, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
#endif /* SDL_blendpoint_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -18,10 +18,16 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_drawline_h_
|
||||
#define SDL_drawline_h_
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
|
||||
extern int SDL_DrawLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color);
|
||||
extern int SDL_DrawLines(SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color);
|
||||
|
||||
#endif /* SDL_drawline_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -18,10 +18,16 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_drawpoint_h_
|
||||
#define SDL_drawpoint_h_
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
|
||||
extern int SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color);
|
||||
extern int SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color);
|
||||
|
||||
#endif /* SDL_drawpoint_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -587,18 +587,6 @@ SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
GetScaleQuality(void)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
|
||||
if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||
const SDL_Rect * srcrect, const SDL_FRect * dstrect,
|
||||
|
|
@ -669,6 +657,11 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
blitRequired = SDL_TRUE;
|
||||
}
|
||||
|
||||
/* srcrect is not selecting the whole src surface, so cropping is needed */
|
||||
if (!(srcrect->w == src->w && srcrect->h == src->h && srcrect->x == 0 && srcrect->y == 0)) {
|
||||
blitRequired = SDL_TRUE;
|
||||
}
|
||||
|
||||
/* The color and alpha modulation has to be applied before the rotation when using the NONE and MOD blend modes. */
|
||||
if ((blendmode == SDL_BLENDMODE_NONE || blendmode == SDL_BLENDMODE_MOD) && (alphaMod & rMod & gMod & bMod) != 255) {
|
||||
applyModulation = SDL_TRUE;
|
||||
|
|
@ -717,7 +710,7 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
|
||||
if (!retval) {
|
||||
SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, &dstwidth, &dstheight, &cangle, &sangle);
|
||||
src_rotated = SDLgfx_rotateSurface(src_clone, angle, dstwidth/2, dstheight/2, GetScaleQuality(), flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle);
|
||||
src_rotated = SDLgfx_rotateSurface(src_clone, angle, dstwidth/2, dstheight/2, (texture->scaleMode == SDL_ScaleModeNearest) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle);
|
||||
if (src_rotated == NULL) {
|
||||
retval = -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_render_sw_c_h_
|
||||
#define SDL_render_sw_c_h_
|
||||
|
||||
extern SDL_Renderer * SW_CreateRendererForSurface(SDL_Surface * surface);
|
||||
|
||||
#endif /* SDL_render_sw_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -83,7 +83,9 @@ static Uint32
|
|||
_colorkey(SDL_Surface *src)
|
||||
{
|
||||
Uint32 key = 0;
|
||||
SDL_GetColorKey(src, &key);
|
||||
if (SDL_HasColorKey(src)) {
|
||||
SDL_GetColorKey(src, &key);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
|
|
@ -424,8 +426,10 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery,
|
|||
if (src == NULL)
|
||||
return NULL;
|
||||
|
||||
if (SDL_GetColorKey(src, &colorkey) == 0) {
|
||||
colorKeyAvailable = SDL_TRUE;
|
||||
if (SDL_HasColorKey(src)) {
|
||||
if (SDL_GetColorKey(src, &colorkey) == 0) {
|
||||
colorKeyAvailable = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* This function requires a 32-bit surface or 8-bit surface with a colorkey */
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_rotate_h_
|
||||
#define SDL_rotate_h_
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
|
@ -26,3 +29,4 @@
|
|||
extern SDL_Surface *SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle);
|
||||
extern void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, int *dstwidth, int *dstheight, double *cangle, double *sangle);
|
||||
|
||||
#endif /* SDL_rotate_h_ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue