Go to the source code of this file.
|
| static SDL_Renderer * | SW_CreateRenderer (SDL_Window *window, Uint32 flags) |
| |
| static void | SW_WindowEvent (SDL_Renderer *renderer, const SDL_WindowEvent *event) |
| |
| static int | SW_GetOutputSize (SDL_Renderer *renderer, int *w, int *h) |
| |
| static int | SW_CreateTexture (SDL_Renderer *renderer, SDL_Texture *texture) |
| |
| static int | SW_SetTextureColorMod (SDL_Renderer *renderer, SDL_Texture *texture) |
| |
| static int | SW_SetTextureAlphaMod (SDL_Renderer *renderer, SDL_Texture *texture) |
| |
| static int | SW_SetTextureBlendMode (SDL_Renderer *renderer, SDL_Texture *texture) |
| |
| static int | SW_UpdateTexture (SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch) |
| |
| static int | SW_LockTexture (SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch) |
| |
| static void | SW_UnlockTexture (SDL_Renderer *renderer, SDL_Texture *texture) |
| |
| static int | SW_SetRenderTarget (SDL_Renderer *renderer, SDL_Texture *texture) |
| |
| static int | SW_UpdateViewport (SDL_Renderer *renderer) |
| |
| static int | SW_UpdateClipRect (SDL_Renderer *renderer) |
| |
| static int | SW_RenderClear (SDL_Renderer *renderer) |
| |
| static int | SW_RenderDrawPoints (SDL_Renderer *renderer, const SDL_FPoint *points, int count) |
| |
| static int | SW_RenderDrawLines (SDL_Renderer *renderer, const SDL_FPoint *points, int count) |
| |
| static int | SW_RenderFillRects (SDL_Renderer *renderer, const SDL_FRect *rects, int count) |
| |
| static int | SW_RenderCopy (SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect) |
| |
| static int | SW_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) |
| |
| static int | SW_RenderReadPixels (SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch) |
| |
| static void | SW_RenderPresent (SDL_Renderer *renderer) |
| |
| static void | SW_DestroyTexture (SDL_Renderer *renderer, SDL_Texture *texture) |
| |
| static void | SW_DestroyRenderer (SDL_Renderer *renderer) |
| |
| static SDL_Surface * | SW_ActivateRenderer (SDL_Renderer *renderer) |
| |
| SDL_Renderer * | SW_CreateRendererForSurface (SDL_Surface *surface) |
| |
◆ SW_ActivateRenderer()
Definition at line 106 of file SDL_render_sw.c.
110 if (!
data->surface) {
113 if (!
data->surface) {
122 return data->surface;
References SDL_Renderer::driverdata, renderer, SDL_GetWindowSurface, SW_UpdateClipRect(), SW_UpdateViewport(), and SDL_Renderer::window.
Referenced by SW_CreateRendererForSurface(), SW_GetOutputSize(), SW_RenderClear(), SW_RenderCopy(), SW_RenderCopyEx(), SW_RenderDrawLines(), SW_RenderDrawPoints(), SW_RenderFillRects(), and SW_RenderReadPixels().
◆ SW_CreateRenderer()
◆ SW_CreateRendererForSurface()
Definition at line 126 of file SDL_render_sw.c.
References SDL_Renderer::CreateTexture, SDL_Renderer::DestroyRenderer, SDL_Renderer::DestroyTexture, SDL_Renderer::driverdata, SDL_Renderer::GetOutputSize, SDL_Renderer::info, SDL_RenderDriver::info, SDL_Renderer::LockTexture, NULL, SDL_Renderer::RenderClear, SDL_Renderer::RenderCopy, SDL_Renderer::RenderCopyEx, SDL_Renderer::RenderDrawLines, SDL_Renderer::RenderDrawPoints, renderer, SDL_Renderer::RenderFillRects, SDL_Renderer::RenderPresent, SDL_Renderer::RenderReadPixels, SDL_calloc, SDL_OutOfMemory, SDL_SetError, SDL_Renderer::SetRenderTarget, SDL_Renderer::SetTextureAlphaMod, SDL_Renderer::SetTextureBlendMode, SDL_Renderer::SetTextureColorMod, SW_ActivateRenderer(), SW_CreateTexture(), SW_DestroyRenderer(), SW_DestroyTexture(), SW_GetOutputSize(), SW_LockTexture(), SW_RenderClear(), SW_RenderCopy(), SW_RenderCopyEx(), SW_RenderDrawLines(), SW_RenderDrawPoints(), SW_RenderDriver, SW_RenderFillRects(), SW_RenderPresent(), SW_RenderReadPixels(), SW_SetRenderTarget(), SW_SetTextureAlphaMod(), SW_SetTextureBlendMode(), SW_SetTextureColorMod(), SW_UnlockTexture(), SW_UpdateClipRect(), SW_UpdateTexture(), SW_UpdateViewport(), SW_WindowEvent(), SDL_Renderer::UnlockTexture, SDL_Renderer::UpdateClipRect, SDL_Renderer::UpdateTexture, SDL_Renderer::UpdateViewport, and SDL_Renderer::WindowEvent.
Referenced by SDL_CreateSoftwareRenderer(), and SW_CreateRenderer().
◆ SW_CreateTexture()
Definition at line 224 of file SDL_render_sw.c.
227 Uint32 Rmask, Gmask, Bmask, Amask;
230 (
texture->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
References SDL_CreateRGBSurface, SDL_PixelFormatEnumToMasks, SDL_SetError, SDL_SetSurfaceAlphaMod, SDL_SetSurfaceBlendMode, SDL_SetSurfaceColorMod, SDL_SetSurfaceRLE, and SDL_TEXTUREACCESS_STATIC.
Referenced by SW_CreateRendererForSurface().
◆ SW_DestroyRenderer()
◆ SW_DestroyTexture()
◆ SW_GetOutputSize()
| static int SW_GetOutputSize |
( |
SDL_Renderer * |
renderer, |
|
|
int * |
w, |
|
|
int * |
h |
|
) |
| |
|
static |
◆ SW_LockTexture()
◆ SW_RenderClear()
◆ SW_RenderCopy()
Definition at line 558 of file SDL_render_sw.c.
573 final_rect.x = (int)dstrect->
x;
574 final_rect.y = (
int)dstrect->
y;
576 final_rect.w = (int)dstrect->
w;
577 final_rect.h = (
int)dstrect->
h;
579 if ( srcrect->
w == final_rect.w && srcrect->
h == final_rect.h ) {
References SDL_Rect::h, SDL_FRect::h, renderer, SDL_BlitScaled, SDL_BlitSurface, SDL_SetSurfaceRLE, SW_ActivateRenderer(), SDL_Renderer::viewport, SDL_Rect::w, SDL_FRect::w, SDL_Rect::x, SDL_FRect::x, SDL_Rect::y, and SDL_FRect::y.
Referenced by SW_CreateRendererForSurface().
◆ SW_RenderCopyEx()
Definition at line 591 of file SDL_render_sw.c.
600 int retval = 0, dstwidth, dstheight, abscenterx, abscentery;
601 double cangle, sangle, px, py, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y;
603 Uint8 alphaMod, rMod, gMod, bMod;
616 final_rect.
x = (int)dstrect->
x;
617 final_rect.
y = (
int)dstrect->
y;
619 final_rect.
w = (int)dstrect->
w;
620 final_rect.
h = (
int)dstrect->
h;
622 tmp_rect = final_rect;
637 src->format->Rmask,
src->format->Gmask,
638 src->format->Bmask,
src->format->Amask);
639 if (src_clone ==
NULL) {
656 if (!(srcrect->
w == final_rect.
w && srcrect->
h == final_rect.
h && srcrect->
x == 0 && srcrect->
y == 0)) {
661 if (!(srcrect->
w ==
src->w && srcrect->
h ==
src->h && srcrect->
x == 0 && srcrect->
y == 0)) {
682 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
693 if (!
retval && (blitRequired || applyModulation)) {
696 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
697 if (src_scaled ==
NULL) {
703 src_clone = src_scaled;
713 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);
714 if (src_rotated ==
NULL) {
719 mask_rotated =
SDLgfx_rotateSurface(
mask,
angle, dstwidth/2, dstheight/2,
SDL_FALSE, 0, 0, dstwidth, dstheight, cangle, sangle);
720 if (mask_rotated ==
NULL) {
726 abscenterx = final_rect.
x + (int)center->
x;
727 abscentery = final_rect.
y + (
int)center->
y;
732 px = final_rect.
x - abscenterx;
733 py = final_rect.
y - abscentery;
734 p1x = px * cangle - py * sangle + abscenterx;
735 p1y = px * sangle + py * cangle + abscentery;
738 px = final_rect.
x + final_rect.
w - abscenterx;
739 py = final_rect.
y - abscentery;
740 p2x = px * cangle - py * sangle + abscenterx;
741 p2y = px * sangle + py * cangle + abscentery;
744 px = final_rect.
x - abscenterx;
745 py = final_rect.
y + final_rect.
h - abscentery;
746 p3x = px * cangle - py * sangle + abscenterx;
747 p3y = px * sangle + py * cangle + abscentery;
750 px = final_rect.
x + final_rect.
w - abscenterx;
751 py = final_rect.
y + final_rect.
h - abscentery;
752 p4x = px * cangle - py * sangle + abscenterx;
753 p4y = px * sangle + py * cangle + abscentery;
755 tmp_rect.x = (int)
MIN(
MIN(p1x, p2x),
MIN(p3x, p4x));
756 tmp_rect.y = (int)
MIN(
MIN(p1y, p2y),
MIN(p3y, p4y));
757 tmp_rect.w = dstwidth;
758 tmp_rect.h = dstheight;
785 mask_rect = tmp_rect;
795 src_rotated->format->BitsPerPixel, src_rotated->pitch,
796 src_rotated->format->Rmask, src_rotated->format->Gmask,
797 src_rotated->format->Bmask, 0);
798 if (src_rotated_rgb ==
NULL) {
809 if (src_rotated !=
NULL) {
821 if (src_clone !=
NULL) {
References SDL_Rect::h, SDL_FRect::h, MIN, NULL, renderer, retval, SDL_BLENDMODE_ADD, SDL_BLENDMODE_MOD, SDL_BLENDMODE_NONE, SDL_BlitScaled, SDL_BlitSurface, SDL_CreateRGBSurface, SDL_CreateRGBSurfaceFrom, SDL_FALSE, SDL_FLIP_HORIZONTAL, SDL_FLIP_VERTICAL, SDL_FreeSurface, SDL_GetSurfaceAlphaMod, SDL_GetSurfaceBlendMode, SDL_GetSurfaceColorMod, SDL_LockSurface, SDL_MUSTLOCK, SDL_PACKEDLAYOUT_8888, SDL_PIXELLAYOUT, SDL_ScaleModeNearest, SDL_SetSurfaceAlphaMod, SDL_SetSurfaceBlendMode, SDL_SetSurfaceColorMod, SDL_TRUE, SDL_UnlockSurface, SDLgfx_rotateSurface(), SDLgfx_rotozoomSurfaceSizeTrig(), SW_ActivateRenderer(), SDL_Renderer::viewport, SDL_Rect::w, SDL_FRect::w, SDL_Rect::x, SDL_FPoint::x, SDL_FRect::x, SDL_Rect::y, SDL_FPoint::y, and SDL_FRect::y.
Referenced by SW_CreateRendererForSurface().
◆ SW_RenderDrawLines()
Definition at line 459 of file SDL_render_sw.c.
References SDL_Renderer::a, SDL_Renderer::b, SDL_Renderer::blendMode, SDL_Renderer::g, i, SDL_Renderer::r, renderer, SDL_BlendLines(), SDL_BLENDMODE_NONE, SDL_DrawLines(), SDL_MapRGBA, SDL_OutOfMemory, SDL_stack_alloc, SDL_stack_free, SW_ActivateRenderer(), SDL_Renderer::viewport, SDL_Point::x, SDL_Rect::x, SDL_Point::y, and SDL_Rect::y.
Referenced by SW_CreateRendererForSurface().
◆ SW_RenderDrawPoints()
Definition at line 410 of file SDL_render_sw.c.
References SDL_Renderer::a, SDL_Renderer::b, SDL_Renderer::blendMode, SDL_Renderer::g, i, SDL_Renderer::r, renderer, SDL_BLENDMODE_NONE, SDL_BlendPoints(), SDL_DrawPoints(), SDL_MapRGBA, SDL_OutOfMemory, SDL_stack_alloc, SDL_stack_free, SW_ActivateRenderer(), SDL_Renderer::viewport, SDL_Point::x, SDL_Rect::x, SDL_Point::y, and SDL_Rect::y.
Referenced by SW_CreateRendererForSurface().
◆ SW_RenderFillRects()
Definition at line 508 of file SDL_render_sw.c.
References SDL_Renderer::a, SDL_Renderer::b, SDL_Renderer::blendMode, SDL_Renderer::g, SDL_Rect::h, i, SDL_Renderer::r, renderer, SDL_BlendFillRects(), SDL_BLENDMODE_NONE, SDL_FillRects, SDL_MapRGBA, SDL_max, SDL_OutOfMemory, SDL_stack_alloc, SDL_stack_free, SW_ActivateRenderer(), SDL_Renderer::viewport, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by SW_CreateRendererForSurface().
◆ SW_RenderPresent()
◆ SW_RenderReadPixels()
Definition at line 828 of file SDL_render_sw.c.
845 return SDL_SetError(
"Tried to read outside of surface bounds");
848 src_format =
surface->format->format;
854 src_format, src_pixels,
surface->pitch,
References SDL_Rect::h, rect, renderer, SDL_ConvertPixels, SDL_SetError, SW_ActivateRenderer(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by SW_CreateRendererForSurface().
◆ SW_SetRenderTarget()
◆ SW_SetTextureAlphaMod()
◆ SW_SetTextureBlendMode()
◆ SW_SetTextureColorMod()
◆ SW_UnlockTexture()
◆ SW_UpdateClipRect()
◆ SW_UpdateTexture()
◆ SW_UpdateViewport()
◆ SW_WindowEvent()
◆ SW_RenderDriver
#define SDL_UnlockSurface
@ SDL_PIXELFORMAT_ARGB8888
SDL_Renderer * SW_CreateRendererForSurface(SDL_Surface *surface)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
static void SW_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
GLfixed GLfixed GLint GLint GLfixed points
static int SW_UpdateViewport(SDL_Renderer *renderer)
A collection of pixels used in software blitting.
int(* UpdateClipRect)(SDL_Renderer *renderer)
static int SW_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
@ SDL_PIXELFORMAT_BGRA8888
int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
int(* SetRenderTarget)(SDL_Renderer *renderer, SDL_Texture *texture)
#define SDL_PIXELLAYOUT(X)
static int SW_SetTextureBlendMode(SDL_Renderer *renderer, SDL_Texture *texture)
GLuint GLuint GLsizei count
int(* SetTextureBlendMode)(SDL_Renderer *renderer, SDL_Texture *texture)
SDL_RenderDriver SW_RenderDriver
#define SDL_IntersectRect
static int SW_SetTextureColorMod(SDL_Renderer *renderer, SDL_Texture *texture)
int(* RenderFillRects)(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
static int SW_RenderClear(SDL_Renderer *renderer)
int(* UpdateViewport)(SDL_Renderer *renderer)
void(* WindowEvent)(SDL_Renderer *renderer, const SDL_WindowEvent *event)
static SDL_Renderer * SW_CreateRenderer(SDL_Window *window, Uint32 flags)
int SDL_BlendLines(SDL_Surface *dst, const SDL_Point *points, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
GLfloat GLfloat GLfloat GLfloat h
GLuint GLsizei GLsizei * length
#define SDL_GetSurfaceBlendMode
static int SW_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
static int SW_RenderDrawPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
The type used to identify a window.
#define SDL_stack_alloc(type, count)
#define SDL_UpdateWindowSurface
int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
static int SW_RenderDrawLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
#define SDL_CreateRGBSurfaceFrom
static int SW_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
int SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count, Uint32 color)
GLint GLint GLint GLint GLint x
EGLSurface EGLNativeWindowType * window
int(* SetTextureColorMod)(SDL_Renderer *renderer, SDL_Texture *texture)
#define SDL_SetSurfaceColorMod
@ SDL_TEXTUREACCESS_STATIC
static int SW_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
int(* RenderDrawLines)(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
static int SW_GetOutputSize(SDL_Renderer *renderer, int *w, int *h)
#define SDL_PixelFormatEnumToMasks
int(* RenderClear)(SDL_Renderer *renderer)
static int SW_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)
@ SDL_WINDOWEVENT_SIZE_CHANGED
#define SDL_SetSurfaceRLE
@ SDL_PIXELFORMAT_RGBA8888
int(* RenderDrawPoints)(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
int SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count, Uint32 color)
static int SW_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
#define SDL_GetWindowSurface
int(* GetOutputSize)(SDL_Renderer *renderer, int *w, int *h)
int(* RenderCopy)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
#define SDL_OutOfMemory()
int(* SetTextureAlphaMod)(SDL_Renderer *renderer, SDL_Texture *texture)
int(* CreateTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
GLint GLint GLint GLint GLint GLint y
#define SDL_CreateRGBSurface
void(* DestroyRenderer)(SDL_Renderer *renderer)
int(* LockTexture)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
#define SDL_GetSurfaceAlphaMod
static void SW_DestroyRenderer(SDL_Renderer *renderer)
int(* RenderReadPixels)(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
int(* RenderCopyEx)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcquad, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
static SDL_Renderer * renderer
#define SDL_stack_free(data)
The structure that defines a point.
@ SDL_RENDERER_TARGETTEXTURE
void(* RenderPresent)(SDL_Renderer *renderer)
static SDL_Surface * SW_ActivateRenderer(SDL_Renderer *renderer)
A rectangle, with the origin at the upper left.
int(* UpdateTexture)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
#define SDL_SetSurfaceBlendMode
#define SDL_GetSurfaceColorMod
#define SDL_ConvertPixels
static int SW_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, int *dstwidth, int *dstheight, double *cangle, double *sangle)
SDL_bool clipping_enabled
static int SW_SetTextureAlphaMod(SDL_Renderer *renderer, SDL_Texture *texture)
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)
@ SDL_PIXELFORMAT_ABGR8888
static void SW_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
static int SW_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
static int SW_UpdateClipRect(SDL_Renderer *renderer)
GLenum GLenum GLuint texture
static void SW_RenderPresent(SDL_Renderer *renderer)
EGLSurface EGLint * rects
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
static void SW_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
void(* UnlockTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
#define SDL_SetSurfaceAlphaMod
void(* DestroyTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
GLubyte GLubyte GLubyte GLubyte w