mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-24 13:39:11 +00:00
SDL API renaming: SDL_surface.h
Fixes https://github.com/libsdl-org/SDL/issues/6884
This commit is contained in:
parent
2db699f48e
commit
cc0296c934
47 changed files with 416 additions and 362 deletions
|
@ -232,7 +232,7 @@ int mouse_createFreeColorCursor(void *arg)
|
|||
SDLTest_AssertPass("Call to SDL_CreateColorCursor()");
|
||||
SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_CreateColorCursor() is not NULL");
|
||||
if (cursor == NULL) {
|
||||
SDL_FreeSurface(face);
|
||||
SDL_DestroySurface(face);
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ int mouse_createFreeColorCursor(void *arg)
|
|||
SDLTest_AssertPass("Call to SDL_FreeCursor()");
|
||||
|
||||
/* Clean up */
|
||||
SDL_FreeSurface(face);
|
||||
SDL_DestroySurface(face);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ int render_testPrimitives(void *arg)
|
|||
SDL_RenderPresent(renderer);
|
||||
|
||||
/* Clean up. */
|
||||
SDL_FreeSurface(referenceSurface);
|
||||
SDL_DestroySurface(referenceSurface);
|
||||
referenceSurface = NULL;
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -355,7 +355,7 @@ int render_testPrimitivesBlend(void *arg)
|
|||
SDL_RenderPresent(renderer);
|
||||
|
||||
/* Clean up. */
|
||||
SDL_FreeSurface(referenceSurface);
|
||||
SDL_DestroySurface(referenceSurface);
|
||||
referenceSurface = NULL;
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -424,7 +424,7 @@ int render_testBlit(void *arg)
|
|||
|
||||
/* Clean up. */
|
||||
SDL_DestroyTexture(tface);
|
||||
SDL_FreeSurface(referenceSurface);
|
||||
SDL_DestroySurface(referenceSurface);
|
||||
referenceSurface = NULL;
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -500,7 +500,7 @@ int render_testBlitColor(void *arg)
|
|||
|
||||
/* Clean up. */
|
||||
SDL_DestroyTexture(tface);
|
||||
SDL_FreeSurface(referenceSurface);
|
||||
SDL_DestroySurface(referenceSurface);
|
||||
referenceSurface = NULL;
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -579,7 +579,7 @@ int render_testBlitAlpha(void *arg)
|
|||
|
||||
/* Clean up. */
|
||||
SDL_DestroyTexture(tface);
|
||||
SDL_FreeSurface(referenceSurface);
|
||||
SDL_DestroySurface(referenceSurface);
|
||||
referenceSurface = NULL;
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -695,7 +695,7 @@ int render_testBlitBlend(void *arg)
|
|||
_compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE);
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
SDL_FreeSurface(referenceSurface);
|
||||
SDL_DestroySurface(referenceSurface);
|
||||
referenceSurface = NULL;
|
||||
|
||||
/* Test Blend. */
|
||||
|
@ -706,7 +706,7 @@ int render_testBlitBlend(void *arg)
|
|||
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
SDL_FreeSurface(referenceSurface);
|
||||
SDL_DestroySurface(referenceSurface);
|
||||
referenceSurface = NULL;
|
||||
|
||||
/* Test Add. */
|
||||
|
@ -717,7 +717,7 @@ int render_testBlitBlend(void *arg)
|
|||
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
SDL_FreeSurface(referenceSurface);
|
||||
SDL_DestroySurface(referenceSurface);
|
||||
referenceSurface = NULL;
|
||||
|
||||
/* Test Mod. */
|
||||
|
@ -728,7 +728,7 @@ int render_testBlitBlend(void *arg)
|
|||
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
SDL_FreeSurface(referenceSurface);
|
||||
SDL_DestroySurface(referenceSurface);
|
||||
referenceSurface = NULL;
|
||||
|
||||
/* Clear surface. */
|
||||
|
@ -794,7 +794,7 @@ int render_testBlitBlend(void *arg)
|
|||
/* Make current */
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
SDL_FreeSurface(referenceSurface);
|
||||
SDL_DestroySurface(referenceSurface);
|
||||
referenceSurface = NULL;
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -941,7 +941,7 @@ _loadTestFace(void)
|
|||
SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
SDL_FreeSurface(face);
|
||||
SDL_DestroySurface(face);
|
||||
|
||||
return tface;
|
||||
}
|
||||
|
@ -1042,7 +1042,7 @@ _hasTexAlpha(void)
|
|||
* \sa
|
||||
* http://wiki.libsdl.org/SDL_RenderReadPixels
|
||||
* http://wiki.libsdl.org/SDL_CreateSurfaceFrom
|
||||
* http://wiki.libsdl.org/SDL_FreeSurface
|
||||
* http://wiki.libsdl.org/SDL_DestroySurface
|
||||
*/
|
||||
static void
|
||||
_compare(SDL_Surface *referenceSurface, int allowable_error)
|
||||
|
@ -1077,7 +1077,7 @@ _compare(SDL_Surface *referenceSurface, int allowable_error)
|
|||
|
||||
/* Clean up. */
|
||||
SDL_free(pixels);
|
||||
SDL_FreeSurface(testSurface);
|
||||
SDL_DestroySurface(testSurface);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,9 +56,9 @@ void _surfaceSetUp(void *arg)
|
|||
|
||||
void _surfaceTearDown(void *arg)
|
||||
{
|
||||
SDL_FreeSurface(referenceSurface);
|
||||
SDL_DestroySurface(referenceSurface);
|
||||
referenceSurface = NULL;
|
||||
SDL_FreeSurface(testSurface);
|
||||
SDL_DestroySurface(testSurface);
|
||||
testSurface = NULL;
|
||||
}
|
||||
|
||||
|
@ -73,9 +73,9 @@ void _clearTestSurface()
|
|||
/* Clear surface. */
|
||||
color = SDL_MapRGBA(testSurface->format, 0, 0, 0, 0);
|
||||
SDLTest_AssertPass("Call to SDL_MapRGBA()");
|
||||
ret = SDL_FillRect(testSurface, NULL, color);
|
||||
SDLTest_AssertPass("Call to SDL_FillRect()");
|
||||
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_FillRect, expected: 0, got: %i", ret);
|
||||
ret = SDL_FillSurfaceRect(testSurface, NULL, color);
|
||||
SDLTest_AssertPass("Call to SDL_FillSurfaceRect()");
|
||||
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_FillSurfaceRect, expected: 0, got: %i", ret);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,9 +118,9 @@ void _testBlitBlendMode(int mode)
|
|||
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceColorMod(), expected: 0, got: %i", ret);
|
||||
|
||||
/* Reset color key */
|
||||
ret = SDL_SetColorKey(face, SDL_FALSE, 0);
|
||||
SDLTest_AssertPass("Call to SDL_SetColorKey()");
|
||||
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey(), expected: 0, got: %i", ret);
|
||||
ret = SDL_SetSurfaceColorKey(face, SDL_FALSE, 0);
|
||||
SDLTest_AssertPass("Call to SDL_SetSurfaceColorKey()");
|
||||
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceColorKey(), expected: 0, got: %i", ret);
|
||||
|
||||
/* Clear the test surface */
|
||||
_clearTestSurface();
|
||||
|
@ -196,7 +196,7 @@ void _testBlitBlendMode(int mode)
|
|||
SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_SetSurfaceBlendMode, expected: 0, got: %i", checkFailCount4);
|
||||
|
||||
/* Clean up */
|
||||
SDL_FreeSurface(face);
|
||||
SDL_DestroySurface(face);
|
||||
face = NULL;
|
||||
}
|
||||
|
||||
|
@ -250,9 +250,9 @@ int surface_testSaveLoadBitmap(void *arg)
|
|||
unlink(sampleFilename);
|
||||
|
||||
/* Clean up */
|
||||
SDL_FreeSurface(face);
|
||||
SDL_DestroySurface(face);
|
||||
face = NULL;
|
||||
SDL_FreeSurface(rface);
|
||||
SDL_DestroySurface(rface);
|
||||
rface = NULL;
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -275,9 +275,9 @@ int surface_testSurfaceConversion(void *arg)
|
|||
|
||||
/* Set transparent pixel as the pixel at (0,0) */
|
||||
if (face->format->palette) {
|
||||
ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *)face->pixels);
|
||||
SDLTest_AssertPass("Call to SDL_SetColorKey()");
|
||||
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
|
||||
ret = SDL_SetSurfaceColorKey(face, SDL_RLEACCEL, *(Uint8 *)face->pixels);
|
||||
SDLTest_AssertPass("Call to SDL_SetSurfaceColorKey()");
|
||||
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceColorKey, expected: 0, got: %i", ret);
|
||||
}
|
||||
|
||||
/* Convert to 32 bit to compare. */
|
||||
|
@ -290,9 +290,9 @@ int surface_testSurfaceConversion(void *arg)
|
|||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||
|
||||
/* Clean up. */
|
||||
SDL_FreeSurface(face);
|
||||
SDL_DestroySurface(face);
|
||||
face = NULL;
|
||||
SDL_FreeSurface(rface);
|
||||
SDL_DestroySurface(rface);
|
||||
rface = NULL;
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -345,9 +345,9 @@ int surface_testCompleteSurfaceConversion(void *arg)
|
|||
|
||||
/* Set transparent pixel as the pixel at (0,0) */
|
||||
if (face->format->palette) {
|
||||
ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *)face->pixels);
|
||||
SDLTest_AssertPass("Call to SDL_SetColorKey()");
|
||||
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
|
||||
ret = SDL_SetSurfaceColorKey(face, SDL_RLEACCEL, *(Uint8 *)face->pixels);
|
||||
SDLTest_AssertPass("Call to SDL_SetSurfaceColorKey()");
|
||||
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceColorKey, expected: 0, got: %i", ret);
|
||||
}
|
||||
|
||||
for (i = 0; i < SDL_arraysize(pixel_formats); ++i) {
|
||||
|
@ -372,18 +372,18 @@ int surface_testCompleteSurfaceConversion(void *arg)
|
|||
/* Compare surface. */
|
||||
ret = SDLTest_CompareSurfaces(face, final, 0);
|
||||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||
SDL_FreeSurface(final);
|
||||
SDL_DestroySurface(final);
|
||||
}
|
||||
|
||||
SDL_FreeSurface(cvt1);
|
||||
SDL_DestroySurface(cvt1);
|
||||
SDL_DestroyPixelFormat(fmt1);
|
||||
SDL_FreeSurface(cvt2);
|
||||
SDL_DestroySurface(cvt2);
|
||||
SDL_DestroyPixelFormat(fmt2);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up. */
|
||||
SDL_FreeSurface(face);
|
||||
SDL_DestroySurface(face);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ int surface_testBlit(void *arg)
|
|||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||
|
||||
/* Clean up. */
|
||||
SDL_FreeSurface(compareSurface);
|
||||
SDL_DestroySurface(compareSurface);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ int surface_testBlitColorMod(void *arg)
|
|||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||
|
||||
/* Clean up. */
|
||||
SDL_FreeSurface(compareSurface);
|
||||
SDL_DestroySurface(compareSurface);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ int surface_testBlitAlphaMod(void *arg)
|
|||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||
|
||||
/* Clean up. */
|
||||
SDL_FreeSurface(compareSurface);
|
||||
SDL_DestroySurface(compareSurface);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ int surface_testBlitBlendNone(void *arg)
|
|||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||
|
||||
/* Clean up. */
|
||||
SDL_FreeSurface(compareSurface);
|
||||
SDL_DestroySurface(compareSurface);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ int surface_testBlitBlendBlend(void *arg)
|
|||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||
|
||||
/* Clean up. */
|
||||
SDL_FreeSurface(compareSurface);
|
||||
SDL_DestroySurface(compareSurface);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ int surface_testBlitBlendAdd(void *arg)
|
|||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||
|
||||
/* Clean up. */
|
||||
SDL_FreeSurface(compareSurface);
|
||||
SDL_DestroySurface(compareSurface);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ int surface_testBlitBlendMod(void *arg)
|
|||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||
|
||||
/* Clean up. */
|
||||
SDL_FreeSurface(compareSurface);
|
||||
SDL_DestroySurface(compareSurface);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ int surface_testBlitBlendLoop(void *arg)
|
|||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||
|
||||
/* Clean up. */
|
||||
SDL_FreeSurface(compareSurface);
|
||||
SDL_DestroySurface(compareSurface);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -628,11 +628,11 @@ int surface_testOverflow(void *arg)
|
|||
surface = SDL_CreateSurfaceFrom(buf, 6, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 6, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
|
||||
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
|
||||
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
|
||||
|
@ -646,21 +646,21 @@ int surface_testOverflow(void *arg)
|
|||
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 4, SDL_PIXELFORMAT_INDEX4LSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 4, SDL_PIXELFORMAT_INDEX4LSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
|
||||
/* SDL_PIXELFORMAT_INDEX1* needs 1 byte per 8 pixels. */
|
||||
surface = SDL_CreateSurfaceFrom(buf, 16, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 16, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
|
||||
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
|
||||
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
|
||||
|
@ -674,21 +674,21 @@ int surface_testOverflow(void *arg)
|
|||
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 3, SDL_PIXELFORMAT_INDEX1LSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 3, SDL_PIXELFORMAT_INDEX1LSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
|
||||
/* SDL_PIXELFORMAT_INDEX8 and SDL_PIXELFORMAT_RGB332 require 1 byte per pixel. */
|
||||
surface = SDL_CreateSurfaceFrom(buf, 5, 1, 5, SDL_PIXELFORMAT_RGB332);
|
||||
SDLTest_AssertCheck(surface != NULL, "5px * 8 bits per px fits in 5 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 5, 1, 5, SDL_PIXELFORMAT_INDEX8);
|
||||
SDLTest_AssertCheck(surface != NULL, "5px * 8 bits per px fits in 5 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
|
||||
surface = SDL_CreateSurfaceFrom(buf, 6, 1, 5, SDL_PIXELFORMAT_RGB332);
|
||||
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
|
||||
|
@ -705,11 +705,11 @@ int surface_testOverflow(void *arg)
|
|||
surface = SDL_CreateSurfaceFrom(buf, 3, 1, 6, SDL_PIXELFORMAT_RGB555);
|
||||
SDLTest_AssertCheck(surface != NULL, "3px * 15 (really 16) bits per px fits in 6 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 3, 1, 6, SDL_PIXELFORMAT_RGB555);
|
||||
SDLTest_AssertCheck(surface != NULL, "5px * 15 (really 16) bits per px fits in 6 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
|
||||
surface = SDL_CreateSurfaceFrom(buf, 4, 1, 6, SDL_PIXELFORMAT_RGB555);
|
||||
SDLTest_AssertCheck(surface == NULL, "4px * 15 (really 16) bits per px doesn't fit in 6 bytes");
|
||||
|
|
|
@ -72,25 +72,25 @@ init_color_cursor(const char *file)
|
|||
SDL_Surface *surface = SDL_LoadBMP(file);
|
||||
if (surface) {
|
||||
if (surface->format->palette) {
|
||||
SDL_SetColorKey(surface, 1, *(Uint8 *)surface->pixels);
|
||||
SDL_SetSurfaceColorKey(surface, 1, *(Uint8 *)surface->pixels);
|
||||
} else {
|
||||
switch (surface->format->BitsPerPixel) {
|
||||
case 15:
|
||||
SDL_SetColorKey(surface, 1, (*(Uint16 *)surface->pixels) & 0x00007FFF);
|
||||
SDL_SetSurfaceColorKey(surface, 1, (*(Uint16 *)surface->pixels) & 0x00007FFF);
|
||||
break;
|
||||
case 16:
|
||||
SDL_SetColorKey(surface, 1, *(Uint16 *)surface->pixels);
|
||||
SDL_SetSurfaceColorKey(surface, 1, *(Uint16 *)surface->pixels);
|
||||
break;
|
||||
case 24:
|
||||
SDL_SetColorKey(surface, 1, (*(Uint32 *)surface->pixels) & 0x00FFFFFF);
|
||||
SDL_SetSurfaceColorKey(surface, 1, (*(Uint32 *)surface->pixels) & 0x00FFFFFF);
|
||||
break;
|
||||
case 32:
|
||||
SDL_SetColorKey(surface, 1, *(Uint32 *)surface->pixels);
|
||||
SDL_SetSurfaceColorKey(surface, 1, *(Uint32 *)surface->pixels);
|
||||
break;
|
||||
}
|
||||
}
|
||||
cursor = SDL_CreateColorCursor(surface, 0, 0);
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
}
|
||||
return cursor;
|
||||
}
|
||||
|
|
|
@ -496,7 +496,7 @@ static void _Redraw(int rendererID)
|
|||
drawnTextRect.h = textSur->h;
|
||||
|
||||
texture = SDL_CreateTextureFromSurface(renderer, textSur);
|
||||
SDL_FreeSurface(textSur);
|
||||
SDL_DestroySurface(textSur);
|
||||
|
||||
SDL_RenderTexture(renderer, texture, NULL, &drawnTextRect);
|
||||
SDL_DestroyTexture(texture);
|
||||
|
@ -567,7 +567,7 @@ static void _Redraw(int rendererID)
|
|||
drawnTextRect.h = textSur->h;
|
||||
|
||||
texture = SDL_CreateTextureFromSurface(renderer, textSur);
|
||||
SDL_FreeSurface(textSur);
|
||||
SDL_DestroySurface(textSur);
|
||||
|
||||
SDL_RenderTexture(renderer, texture, NULL, &drawnTextRect);
|
||||
SDL_DestroyTexture(texture);
|
||||
|
|
|
@ -65,7 +65,7 @@ void save_surface_to_bmp()
|
|||
SDL_GetWindowID(window), ++frame_number);
|
||||
|
||||
SDL_SaveBMP(surface, file);
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
}
|
||||
|
||||
void loop()
|
||||
|
|
|
@ -171,7 +171,7 @@ quit(int rc)
|
|||
SDL_free(RawMooseData);
|
||||
|
||||
for (i = 0; i < MOOSEFRAMES_COUNT; i++) {
|
||||
SDL_FreeSurface(MooseYUVSurfaces[i]);
|
||||
SDL_DestroySurface(MooseYUVSurfaces[i]);
|
||||
}
|
||||
|
||||
SDLTest_CommonQuit(state);
|
||||
|
@ -472,7 +472,7 @@ int main(int argc, char **argv)
|
|||
quit(7);
|
||||
}
|
||||
|
||||
SDL_FreeSurface(mooseRGBSurface);
|
||||
SDL_DestroySurface(mooseRGBSurface);
|
||||
}
|
||||
|
||||
SDL_free(RawMooseData);
|
||||
|
|
|
@ -350,7 +350,7 @@ SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord)
|
|||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels);
|
||||
SDL_FreeSurface(image); /* No longer needed */
|
||||
SDL_DestroySurface(image); /* No longer needed */
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ int main(int argc, char **argv)
|
|||
exit(3);
|
||||
}
|
||||
texture = SDL_GL_LoadTexture(surface, texcoords);
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_DestroySurface(surface);
|
||||
|
||||
/* Loop, drawing and checking events */
|
||||
InitGL(640, 480);
|
||||
|
|
|
@ -82,7 +82,7 @@ int main(int argc, char **argv)
|
|||
pictures[i].name = argv[i + 1];
|
||||
if (pictures[i].surface == NULL) {
|
||||
for (j = 0; j < num_pictures; j++) {
|
||||
SDL_FreeSurface(pictures[j].surface);
|
||||
SDL_DestroySurface(pictures[j].surface);
|
||||
}
|
||||
SDL_free(pictures);
|
||||
SDL_Quit();
|
||||
|
@ -107,7 +107,7 @@ int main(int argc, char **argv)
|
|||
SDL_SetWindowPosition(window, SHAPED_WINDOW_X, SHAPED_WINDOW_Y);
|
||||
if (window == NULL) {
|
||||
for (i = 0; i < num_pictures; i++) {
|
||||
SDL_FreeSurface(pictures[i].surface);
|
||||
SDL_DestroySurface(pictures[i].surface);
|
||||
}
|
||||
SDL_free(pictures);
|
||||
SDL_Quit();
|
||||
|
@ -118,7 +118,7 @@ int main(int argc, char **argv)
|
|||
if (renderer == NULL) {
|
||||
SDL_DestroyWindow(window);
|
||||
for (i = 0; i < num_pictures; i++) {
|
||||
SDL_FreeSurface(pictures[i].surface);
|
||||
SDL_DestroySurface(pictures[i].surface);
|
||||
}
|
||||
SDL_free(pictures);
|
||||
SDL_Quit();
|
||||
|
@ -138,7 +138,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
for (i = 0; i < num_pictures; i++) {
|
||||
SDL_FreeSurface(pictures[i].surface);
|
||||
SDL_DestroySurface(pictures[i].surface);
|
||||
}
|
||||
SDL_free(pictures);
|
||||
SDL_DestroyRenderer(renderer);
|
||||
|
@ -198,7 +198,7 @@ int main(int argc, char **argv)
|
|||
SDL_DestroyWindow(window);
|
||||
/* Free the original surfaces backing the textures. */
|
||||
for (i = 0; i < num_pictures; i++) {
|
||||
SDL_FreeSurface(pictures[i].surface);
|
||||
SDL_DestroySurface(pictures[i].surface);
|
||||
}
|
||||
SDL_free(pictures);
|
||||
/* Call SDL_Quit() before quitting. */
|
||||
|
|
|
@ -109,22 +109,22 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent,
|
|||
/* Set transparent pixel as the pixel at (0,0) */
|
||||
if (transparent) {
|
||||
if (temp->format->palette) {
|
||||
SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels);
|
||||
SDL_SetSurfaceColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels);
|
||||
} else {
|
||||
switch (temp->format->BitsPerPixel) {
|
||||
case 15:
|
||||
SDL_SetColorKey(temp, SDL_TRUE,
|
||||
SDL_SetSurfaceColorKey(temp, SDL_TRUE,
|
||||
(*(Uint16 *)temp->pixels) & 0x00007FFF);
|
||||
break;
|
||||
case 16:
|
||||
SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *)temp->pixels);
|
||||
SDL_SetSurfaceColorKey(temp, SDL_TRUE, *(Uint16 *)temp->pixels);
|
||||
break;
|
||||
case 24:
|
||||
SDL_SetColorKey(temp, SDL_TRUE,
|
||||
SDL_SetSurfaceColorKey(temp, SDL_TRUE,
|
||||
(*(Uint32 *)temp->pixels) & 0x00FFFFFF);
|
||||
break;
|
||||
case 32:
|
||||
SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *)temp->pixels);
|
||||
SDL_SetSurfaceColorKey(temp, SDL_TRUE, *(Uint32 *)temp->pixels);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent,
|
|||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
|
||||
}
|
||||
}
|
||||
SDL_FreeSurface(temp);
|
||||
SDL_DestroySurface(temp);
|
||||
if (path) {
|
||||
SDL_free(path);
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ static int run_automated_tests(int pattern_size, int extra_pitch)
|
|||
done:
|
||||
SDL_free(yuv1);
|
||||
SDL_free(yuv2);
|
||||
SDL_FreeSurface(pattern);
|
||||
SDL_DestroySurface(pattern);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue