Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Merged fix for bug #457 from SDL 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 15, 2007
1 parent 506fef5 commit f604b38
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/SDL_compat.c
Expand Up @@ -1399,6 +1399,11 @@ SDL_LockYUVOverlay(SDL_Overlay * overlay)
{
void *pixels;
int pitch;

if (!overlay) {
SDL_SetError("Passed a NULL overlay");
return -1;
}
if (SDL_LockTexture(overlay->hwdata->textureID, NULL, 1, &pixels, &pitch)
< 0) {
return -1;
Expand All @@ -1424,12 +1429,19 @@ SDL_LockYUVOverlay(SDL_Overlay * overlay)
void
SDL_UnlockYUVOverlay(SDL_Overlay * overlay)
{
if (!overlay) {
return;
}
SDL_UnlockTexture(overlay->hwdata->textureID);
}

int
SDL_DisplayYUVOverlay(SDL_Overlay * overlay, SDL_Rect * dstrect)
{
if (!overlay || !dstrect) {
SDL_SetError("Passed a NULL overlay or dstrect");
return -1;
}
if (SDL_RenderCopy(overlay->hwdata->textureID, NULL, dstrect) < 0) {
return -1;
}
Expand All @@ -1440,15 +1452,16 @@ SDL_DisplayYUVOverlay(SDL_Overlay * overlay, SDL_Rect * dstrect)
void
SDL_FreeYUVOverlay(SDL_Overlay * overlay)
{
if (overlay) {
if (overlay->hwdata) {
if (overlay->hwdata->textureID) {
SDL_DestroyTexture(overlay->hwdata->textureID);
}
SDL_free(overlay->hwdata);
if (!overlay) {
return;
}
if (overlay->hwdata) {
if (overlay->hwdata->textureID) {
SDL_DestroyTexture(overlay->hwdata->textureID);
}
SDL_free(overlay);
SDL_free(overlay->hwdata);
}
SDL_free(overlay);
}

void
Expand Down

0 comments on commit f604b38

Please sign in to comment.