Commit graph

66 commits

Author SHA1 Message Date
Sam Lantinga
6b6170caf6 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sam Lantinga
b88aaba9c1 Fixed bug 4914 - Expose SDL_ScaleMode and add SDL_SetTextureScaleMode/SDL_GetTextureScaleMode
Konrad

This was something rather trivial to add, but asked at least several times before (I did google about it as well).

It should be possible to dynamically change scaling mode of the texture. It is actually trivial task, but until now it was only possible with a hint before creating a texture.

I needed it for my game as well, so I took the liberty of writing it myself.

This patch adds following functions:

SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode);
SDL_GetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode *scaleMode);

That way you can change texture scaling on the fly.
2019-12-22 13:39:44 -08:00
Sylvain Becker
72bbc9de9d Added a helper function SDL_LockTextureToSurface()
Similar to SDL_LockTexture(), except the locked area is exposed as a SDL surface.
2019-09-30 20:58:44 +02:00
Sam Lantinga
af32a2f4cd Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Ryan C. Gordon
538f2f7649 render: Add floating point versions of various draw APIs.
--HG--
branch : SDL-ryan-batching-renderer
2018-10-23 01:34:03 -04:00
Ryan C. Gordon
7d96cb5cef render: Added SDL_RenderFlush().
--HG--
branch : SDL-ryan-batching-renderer
2018-10-04 16:34:44 -04:00
Sam Lantinga
346af016a5 Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga
f16b7e735b Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() 2017-12-08 14:30:10 -08:00
Sam Lantinga
b5cd11a4ea Note that texture contents are undefined when the texture is created. 2017-08-12 13:05:26 -07:00
Sam Lantinga
fba643fb3b Fixed bug 3492 - SDL_RenderCopyEx angle direction not documented
xyzdragon

Reading https://wiki.libsdl.org/SDL_RenderCopyEx there is no mention what the angle means. Normally in a mathematically environment positive angles translate to counter-clockwise rotations, but in SDL positive angles means clockwise rotation.
2017-08-11 13:24:18 -07:00
Sam Lantinga
1dd89d8496 Fixed bug 3681 - SDL_UpateTexture documentation not specific enough about format requirement
Simon Hug

The documentation of SDL_UpateTexture does not say that the pixel data has to be in the format of the texture.
2017-08-10 11:57:19 -07:00
Sam Lantinga
1b24bfad38 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
91e0a1d094 Renaming of guard header names to quiet -Wreserved-id-macro
Patch contributed by Sylvain
2016-11-20 21:34:54 -08:00
Sam Lantinga
a64ed63bba Fixed bug 3345 - SDL_RenderClear inconsistency with ClipRect
Simon Hug

The description of the SDL_RenderClear function in the SDL_render.h header says the following:

"This function clears the entire rendering target, ignoring the viewport."

The word "entire" implies that the clipping rectangle set with SDL_RenderSetClipRect also gets ignored. This is left somewhat ambiguous if only the viewport is mentioned. Minor thing, but let's see what the implementations actually do.

The software renderer ignores the clipping rectangle when clearing. It even has a comment on this: /* By definition the clear ignores the clip rect */

Most other render drivers (opengl, opengles, opengles2, direct3d, and psp [I assume. Can't test it.]) use the scissor test for the ClipRect and don't disable it when clearing. Clearing will only happen within the clipping rectangle for these drivers.

An exception is direct3d11 which uses a clear function that ignores the scissor test.
2016-10-01 11:46:32 -07:00
Ethan Lee
c93d43c4e0 SDL_RenderSetIntegerScale 2016-01-05 16:39:18 -05:00
Sam Lantinga
7ee8dda270 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Alex Szpakowski
1c47d39ad1 Updated some header comments and iOS documentation to better clarify high-dpi / retina support and screen-coordinate sizes versus pixel sizes. 2015-12-31 21:16:43 -04:00
Philipp Wiesemann
56e17dd71f Corrected documentation of the SDL_CreateTexture() functions in header file. 2015-08-21 23:50:59 +02:00
Sam Lantinga
56b58afdbe Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Philipp Wiesemann
26ddac2631 Fix typos in header file documentation comments. 2015-01-30 23:20:15 +01:00
Sam Lantinga
bfedd0228b Improved the pitch variable description 2014-11-29 11:18:49 -08:00
Philipp Wiesemann
0492432d15 Fixed two typos in header file comment. 2014-10-27 12:53:47 +01:00
Jørgen P. Tjernø
431aca234b Render: Allow empty cliprect.
This fixes an issue where an empty cliprect is treated the same as a NULL
cliprect, causing the render backends to disable clipping.

Also adds a new API, SDL_RenderIsClipEnabled(render) that allows you to
differentiate between:
 - SDL_RenderSetClipRect(render, NULL)
 - SDL_Rect r = {0,0,0,0}; SDL_RenderSetClipRect(render, &r);

Fixes https://bugzilla.libsdl.org/show_bug.cgi?id=2504

--HG--
extra : amend_source : 9e5ac76e3f009d9ae49bc61c350df3ba891267b5
extra : histedit_source : b92b8be4d05b19a89fa0dee57f7ed6b1e924cb99%2Cce419f6ade87bafc78ff42702c1f263d2469e7e7
2014-04-19 13:15:41 -07:00
Sam Lantinga
d7940a513e Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
Ryan C. Gordon
d2671e8a86 Fixed a few public APIs that we accidentally neglected to mark as SDLCALL.
Fixes Bugzilla #2262.

--HG--
extra : rebase_source : ba28833dc17e3cb29c4566c7396f5e005d448576
2013-11-23 15:52:49 -05:00
Sam Lantinga
43cc5c1cbb Added optimized YUV texture upload path with SDL_UpdateYUVTexture() 2013-09-28 14:06:47 -07:00
Sam Lantinga
56c6743a1b Added documentation saying the render API isn't for multi-threading. 2013-07-28 11:24:16 -07:00
Sam Lantinga
20c5cf1e8b When the window is resized, the viewport is automatically reset.
This resolves lots of confusion around resizable windows.  Most people don't expect a viewport to be implicitly set when the renderer is created and then not to be reset to the window size if the window is resized.

Added common test command line parameters --logical WxH and --scale N to test the render logical size and scaling APIs.
2013-05-29 03:22:19 -07:00
Sam Lantinga
c55f53aa40 Fixed bug 1622 - SDL_RenderSetViewport with empty SDL_Rect raises wrong error for OpenGL rendering backend
It's now legal to set an empty viewport rect - it will prevent any rendering.

Also added an API to query the output size: SDL_GetRendererOutputSize()
2013-05-29 03:07:55 -07:00
Sam Lantinga
0cb6385637 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Philipp Wiesemann
f86b25c56e Fixed Doxygen warnings. 2013-05-18 14:48:19 +02:00
Philipp Wiesemann
74047a3267 Fixed Doxygen warnings. 2013-05-15 22:00:28 +02:00
Philipp Wiesemann
98b4492c37 Fixed bug 1843 - SDL_RenderClear prototype doxygen missing
Martin Gerhardy

SDL_RenderClear prototype misses documentation for the return value
2013-05-12 13:25:34 +02:00
Sam Lantinga
866f2e5f9e First pass on SDL render clip rect functionality 2013-05-04 04:46:00 -07:00
Sam Lantinga
95dcfa4c28 Happy New Year! 2013-02-15 08:47:44 -08:00
Sam Lantinga
4809ef4290 Fixed typo in documentation 2013-01-27 15:53:24 -08:00
Sam Lantinga
59fea78fe0 Added SDL_GetRenderTarget() API function
Also fixed a bug with setting logical size for a render target.
2012-10-12 02:20:10 -07:00
Sam Lantinga
3c4b366a81 Added SDL_RenderSetLogicalSize() and SDL_RenderGetLogicalSize() 2012-10-01 22:30:07 -07:00
Sam Lantinga
f366b098d4 Added SDL_RenderSetScale() and SDL_RenderGetScale() 2012-10-01 20:59:33 -07:00
Sam Lantinga
400b953d29 Made it clear that locking a streaming texture is a write-only operation. 2012-09-28 03:29:36 -07:00
Gabriel Jacobo
bd7b381374 Implements SDL_GL_BindTexture and SDL_GL_UnbindTexture (#1576) 2012-09-03 11:16:12 -03:00
Gabriel Jacobo
17bdcc6e8e RenderCopyEx,rotation and flipping for all hardware/software backends (#1308) 2012-06-01 19:51:08 -03:00
Sam Lantinga
39b2ae4a20 Added a convenience function SDL_CreateWindowAndRenderer() 2012-01-22 19:22:53 -05:00
Sam Lantinga
8d3c63045f You need to create the texture with the SDL_TEXTUREACCESS_TARGET flag. 2012-01-22 01:29:26 -05:00
Sam Lantinga
0458fa488a Renamed SetTargetTexture() to SetRenderTarget() 2012-01-22 01:26:28 -05:00
Sam Lantinga
23b96d3406 Added a renderer flag to expose whether a renderer supports render to texture. 2012-01-19 21:06:47 -05:00
Sam Lantinga
a49a88676f Implementation of render targets, by Mason Wheeler and Gabriel Jacobo
Thanks guys!
2012-01-18 22:45:49 -05:00
Sam Lantinga
028e5dcdbd Happy New Year! 2011-12-31 09:28:07 -05:00
Sam Lantinga
f7c2849eb9 The draw color affects RenderClear() as well. (thanks to the feedback form to whoever pointed this out) 2011-10-30 17:53:54 -04:00
Sam Lantinga
b0660ba5ff SDL 1.3 is now under the zlib license. 2011-04-08 13:03:26 -07:00