Lock SDL_Surfaces
This commit is contained in:
parent
f1a85d4d2c
commit
7c4a2b5caa
1 changed files with 8 additions and 1 deletions
|
@ -149,15 +149,18 @@ unsigned char* RenderBackend_LockSurface(RenderBackend_Surface *surface, unsigne
|
||||||
if (surface == NULL)
|
if (surface == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
SDL_LockSurface(surface->sdlsurface);
|
||||||
|
|
||||||
*pitch = surface->sdlsurface->pitch;
|
*pitch = surface->sdlsurface->pitch;
|
||||||
return (unsigned char*)surface->sdlsurface->pixels;
|
return (unsigned char*)surface->sdlsurface->pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderBackend_UnlockSurface(RenderBackend_Surface *surface, unsigned int width, unsigned int height)
|
void RenderBackend_UnlockSurface(RenderBackend_Surface *surface, unsigned int width, unsigned int height)
|
||||||
{
|
{
|
||||||
(void)surface;
|
|
||||||
(void)width;
|
(void)width;
|
||||||
(void)height;
|
(void)height;
|
||||||
|
|
||||||
|
SDL_UnlockSurface(surface->sdlsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderBackend_Blit(RenderBackend_Surface *source_surface, const RenderBackend_Rect *rect, RenderBackend_Surface *destination_surface, long x, long y, bool colour_key)
|
void RenderBackend_Blit(RenderBackend_Surface *source_surface, const RenderBackend_Rect *rect, RenderBackend_Surface *destination_surface, long x, long y, bool colour_key)
|
||||||
|
@ -225,6 +228,8 @@ void RenderBackend_DestroyGlyphAtlas(RenderBackend_GlyphAtlas *atlas)
|
||||||
|
|
||||||
void RenderBackend_UploadGlyph(RenderBackend_GlyphAtlas *atlas, size_t x, size_t y, const unsigned char *pixels, size_t width, size_t height)
|
void RenderBackend_UploadGlyph(RenderBackend_GlyphAtlas *atlas, size_t x, size_t y, const unsigned char *pixels, size_t width, size_t height)
|
||||||
{
|
{
|
||||||
|
SDL_LockSurface(atlas->sdlsurface);
|
||||||
|
|
||||||
const unsigned char *source_pointer = pixels;
|
const unsigned char *source_pointer = pixels;
|
||||||
|
|
||||||
for (size_t iy = 0; iy < height; ++iy)
|
for (size_t iy = 0; iy < height; ++iy)
|
||||||
|
@ -239,6 +244,8 @@ void RenderBackend_UploadGlyph(RenderBackend_GlyphAtlas *atlas, size_t x, size_t
|
||||||
*destination_pointer++ = *source_pointer++;
|
*destination_pointer++ = *source_pointer++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_UnlockSurface(atlas->sdlsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderBackend_PrepareToDrawGlyphs(RenderBackend_GlyphAtlas *atlas, RenderBackend_Surface *destination_surface, const unsigned char *colour_channels)
|
void RenderBackend_PrepareToDrawGlyphs(RenderBackend_GlyphAtlas *atlas, RenderBackend_Surface *destination_surface, const unsigned char *colour_channels)
|
||||||
|
|
Loading…
Add table
Reference in a new issue