Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
d5a4d0b8
Commit
d5a4d0b8
authored
Aug 15, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaning up render test suite.
parent
28324935
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
85 deletions
+80
-85
testrender.c
test/test-automation/tests/testrender/testrender.c
+80
-85
No files found.
test/test-automation/tests/testrender/testrender.c
View file @
d5a4d0b8
...
@@ -18,14 +18,14 @@
...
@@ -18,14 +18,14 @@
static
SDL_Renderer
*
renderer
;
static
SDL_Renderer
*
renderer
;
/* Prototypes for helper functions */
/* Prototypes for helper functions */
static
int
render
_clearScreen
(
void
);
static
int
_clearScreen
(
void
);
static
void
render
_compare
(
const
char
*
msg
,
const
SurfaceImage_t
*
s
,
int
allowable_error
);
static
void
_compare
(
const
char
*
msg
,
const
SurfaceImage_t
*
s
,
int
allowable_error
);
static
int
render
_hasTexAlpha
(
void
);
static
int
_hasTexAlpha
(
void
);
static
int
render
_hasTexColor
(
void
);
static
int
_hasTexColor
(
void
);
static
SDL_Texture
*
render
_loadTestFace
(
void
);
static
SDL_Texture
*
_loadTestFace
(
void
);
static
int
render
_hasBlendModes
(
void
);
static
int
_hasBlendModes
(
void
);
static
int
render
_hasDrawColor
(
void
);
static
int
_hasDrawColor
(
void
);
static
int
render
_isSupported
(
int
code
);
static
int
_isSupported
(
int
code
);
/* Test cases */
/* Test cases */
...
@@ -148,9 +148,8 @@ int render_testPrimitives (void *arg)
...
@@ -148,9 +148,8 @@ int render_testPrimitives (void *arg)
int
x
,
y
;
int
x
,
y
;
SDL_Rect
rect
;
SDL_Rect
rect
;
/* Need drawcolour or just skip test. */
/* Need drawcolour or just skip test. */
AssertTrue
(
render
_hasDrawColor
(),
"hasDrawColor"
);
AssertTrue
(
_hasDrawColor
(),
"hasDrawColor"
);
/* Draw a rectangle. */
/* Draw a rectangle. */
rect
.
x
=
40
;
rect
.
x
=
40
;
...
@@ -219,7 +218,7 @@ int render_testPrimitives (void *arg)
...
@@ -219,7 +218,7 @@ int render_testPrimitives (void *arg)
AssertEquals
(
ret
,
0
,
"SDL_RenderDrawLine"
);
AssertEquals
(
ret
,
0
,
"SDL_RenderDrawLine"
);
/* See if it's the same. */
/* See if it's the same. */
render
_compare
(
"Primitives output not the same."
,
&
img_primitives
,
ALLOWABLE_ERROR_OPAQUE
);
_compare
(
"Primitives output not the same."
,
&
img_primitives
,
ALLOWABLE_ERROR_OPAQUE
);
}
}
...
@@ -238,8 +237,8 @@ int render_testPrimitivesBlend (void *arg)
...
@@ -238,8 +237,8 @@ int render_testPrimitivesBlend (void *arg)
SDL_Rect
rect
;
SDL_Rect
rect
;
/* Need drawcolour and blendmode or just skip test. */
/* Need drawcolour and blendmode or just skip test. */
AssertTrue
(
render_hasDrawColor
(),
"render
_hasDrawColor"
);
AssertTrue
(
_hasDrawColor
(),
"
_hasDrawColor"
);
AssertTrue
(
render_hasBlendModes
(),
"render_hasDrawColor
"
);
AssertTrue
(
_hasBlendModes
(),
"_hasBlendModes
"
);
/* Create some rectangles for each blend mode. */
/* Create some rectangles for each blend mode. */
ret
=
SDL_SetRenderDrawColor
(
renderer
,
255
,
255
,
255
,
0
);
ret
=
SDL_SetRenderDrawColor
(
renderer
,
255
,
255
,
255
,
0
);
...
@@ -334,7 +333,7 @@ int render_testPrimitivesBlend (void *arg)
...
@@ -334,7 +333,7 @@ int render_testPrimitivesBlend (void *arg)
}
}
/* See if it's the same. FIXME needs assert */
/* See if it's the same. FIXME needs assert */
render
_compare
(
"Blended primitives output not the same."
,
&
img_blend
,
ALLOWABLE_ERROR_BLENDED
);
_compare
(
"Blended primitives output not the same."
,
&
img_blend
,
ALLOWABLE_ERROR_BLENDED
);
}
}
...
@@ -355,11 +354,11 @@ render_testBlit(void *arg)
...
@@ -355,11 +354,11 @@ render_testBlit(void *arg)
/* Need drawcolour or just skip test. */
/* Need drawcolour or just skip test. */
AssertTrue
(
render_hasDrawColor
(),
"render
_hasDrawColor)"
);
AssertTrue
(
_hasDrawColor
(),
"
_hasDrawColor)"
);
/* Create face surface. */
/* Create face surface. */
tface
=
render
_loadTestFace
();
tface
=
_loadTestFace
();
AssertTrue
(
tface
!=
0
,
"
render
_loadTestFace()"
);
AssertTrue
(
tface
!=
0
,
"_loadTestFace()"
);
/* Constant values. */
/* Constant values. */
rect
.
w
=
img_face
.
width
;
rect
.
w
=
img_face
.
width
;
...
@@ -382,7 +381,7 @@ render_testBlit(void *arg)
...
@@ -382,7 +381,7 @@ render_testBlit(void *arg)
SDL_DestroyTexture
(
tface
);
SDL_DestroyTexture
(
tface
);
/* See if it's the same. FIXME needs assert */
/* See if it's the same. FIXME needs assert */
render
_compare
(
"Blit output not the same."
,
&
img_blit
,
ALLOWABLE_ERROR_OPAQUE
);
_compare
(
"Blit output not the same."
,
&
img_blit
,
ALLOWABLE_ERROR_OPAQUE
);
}
}
/**
/**
...
@@ -402,9 +401,9 @@ render_testBlitColour (void *arg)
...
@@ -402,9 +401,9 @@ render_testBlitColour (void *arg)
int
i
,
j
,
ni
,
nj
;
int
i
,
j
,
ni
,
nj
;
/* Create face surface. */
/* Create face surface. */
tface
=
render
_loadTestFace
();
tface
=
_loadTestFace
();
AssertTrue
(
tface
!=
0
,
"
render
_loadTestFace()"
);
AssertTrue
(
tface
!=
0
,
"_loadTestFace()"
);
/* Constant values. */
/* Constant values. */
rect
.
w
=
img_face
.
width
;
rect
.
w
=
img_face
.
width
;
...
@@ -431,7 +430,7 @@ render_testBlitColour (void *arg)
...
@@ -431,7 +430,7 @@ render_testBlitColour (void *arg)
SDL_DestroyTexture
(
tface
);
SDL_DestroyTexture
(
tface
);
/* See if it's the same. */
/* See if it's the same. */
render
_compare
(
"Blit output not the same (using SDL_SetTextureColorMod)."
,
_compare
(
"Blit output not the same (using SDL_SetTextureColorMod)."
,
&
img_blitColour
,
ALLOWABLE_ERROR_OPAQUE
);
&
img_blitColour
,
ALLOWABLE_ERROR_OPAQUE
);
}
}
...
@@ -452,11 +451,11 @@ render_testBlitAlpha (void *arg)
...
@@ -452,11 +451,11 @@ render_testBlitAlpha (void *arg)
int
i
,
j
,
ni
,
nj
;
int
i
,
j
,
ni
,
nj
;
/* Need alpha or just skip test. */
/* Need alpha or just skip test. */
AssertTrue
(
render
_hasTexAlpha
(),
"render_hasTexAlpha"
);
AssertTrue
(
_hasTexAlpha
(),
"render_hasTexAlpha"
);
/* Create face surface. */
/* Create face surface. */
tface
=
render
_loadTestFace
();
tface
=
_loadTestFace
();
AssertTrue
(
tface
!=
0
,
"
render
_loadTestFace()"
);
AssertTrue
(
tface
!=
0
,
"_loadTestFace()"
);
/* Constant values. */
/* Constant values. */
rect
.
w
=
img_face
.
width
;
rect
.
w
=
img_face
.
width
;
...
@@ -483,7 +482,7 @@ render_testBlitAlpha (void *arg)
...
@@ -483,7 +482,7 @@ render_testBlitAlpha (void *arg)
SDL_DestroyTexture
(
tface
);
SDL_DestroyTexture
(
tface
);
/* See if it's the same. */
/* See if it's the same. */
render
_compare
(
"Blit output not the same (using SDL_SetSurfaceAlphaMod)."
,
_compare
(
"Blit output not the same (using SDL_SetSurfaceAlphaMod)."
,
&
img_blitAlpha
,
ALLOWABLE_ERROR_BLENDED
);
&
img_blitAlpha
,
ALLOWABLE_ERROR_BLENDED
);
}
}
...
@@ -494,15 +493,15 @@ render_testBlitAlpha (void *arg)
...
@@ -494,15 +493,15 @@ render_testBlitAlpha (void *arg)
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
* http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
* http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
*/
*/
void
static
void
render
_testBlitBlendMode
(
SDL_Texture
*
tface
,
int
mode
)
_testBlitBlendMode
(
SDL_Texture
*
tface
,
int
mode
)
{
{
int
ret
;
int
ret
;
int
i
,
j
,
ni
,
nj
;
int
i
,
j
,
ni
,
nj
;
SDL_Rect
rect
;
SDL_Rect
rect
;
/* Clear surface. */
/* Clear surface. */
if
(
render
_clearScreen
())
if
(
_clearScreen
())
return
-
1
;
return
-
1
;
/* Steps to take. */
/* Steps to take. */
...
@@ -530,8 +529,6 @@ render_testBlitBlendMode( SDL_Texture * tface, int mode )
...
@@ -530,8 +529,6 @@ render_testBlitBlendMode( SDL_Texture * tface, int mode )
}
}
/**
/**
* @brief Tests some more blitting routines.
* @brief Tests some more blitting routines.
*
*
...
@@ -550,13 +547,12 @@ render_testBlitBlend (void *arg)
...
@@ -550,13 +547,12 @@ render_testBlitBlend (void *arg)
int
i
,
j
,
ni
,
nj
;
int
i
,
j
,
ni
,
nj
;
int
mode
;
int
mode
;
AssertTrue
(
_hasBlendModes
(),
"_hasBlendModes"
);
AssertTrue
(
render_hasBlendModes
(),
"render_hasBlendModes"
);
AssertTrue
(
_hasTexColor
(),
"_hasTexColor"
);
AssertTrue
(
render_hasTexColor
(),
"render_hasTexColor"
);
AssertTrue
(
_hasTexAlpha
(),
"_hasTexAlpha"
);
AssertTrue
(
render_hasTexAlpha
(),
"render_hasTexAlpha"
);
/* Create face surface. */
/* Create face surface. */
tface
=
render
_loadTestFace
();
tface
=
_loadTestFace
();
AssertTrue
(
tface
!=
0
,
"render_loadTestFace()"
);
AssertTrue
(
tface
!=
0
,
"render_loadTestFace()"
);
/* Steps to take. */
/* Steps to take. */
...
@@ -572,32 +568,32 @@ render_testBlitBlend (void *arg)
...
@@ -572,32 +568,32 @@ render_testBlitBlend (void *arg)
AssertEquals
(
ret
,
0
,
"SDL_SetTextureAlphaMod"
);
AssertEquals
(
ret
,
0
,
"SDL_SetTextureAlphaMod"
);
/* Test None. */
/* Test None. */
render
_testBlitBlendMode
(
tface
,
SDL_BLENDMODE_NONE
);
_testBlitBlendMode
(
tface
,
SDL_BLENDMODE_NONE
);
/* See if it's the same. */
/* See if it's the same. */
render
_compare
(
"Blit blending output not the same (using SDL_BLENDMODE_NONE)."
,
_compare
(
"Blit blending output not the same (using SDL_BLENDMODE_NONE)."
,
&
img_blendNone
,
ALLOWABLE_ERROR_OPAQUE
);
//FIXME add assert
&
img_blendNone
,
ALLOWABLE_ERROR_OPAQUE
);
//FIXME add assert
/* Test Blend. */
/* Test Blend. */
render
_testBlitBlendMode
(
tface
,
SDL_BLENDMODE_BLEND
);
_testBlitBlendMode
(
tface
,
SDL_BLENDMODE_BLEND
);
render
_compare
(
"Blit blending output not the same (using SDL_BLENDMODE_BLEND)."
,
_compare
(
"Blit blending output not the same (using SDL_BLENDMODE_BLEND)."
,
&
img_blendBlend
,
ALLOWABLE_ERROR_BLENDED
);
//FIXME add assert
&
img_blendBlend
,
ALLOWABLE_ERROR_BLENDED
);
//FIXME add assert
/* Test Add. */
/* Test Add. */
render
_testBlitBlendMode
(
tface
,
SDL_BLENDMODE_ADD
);
_testBlitBlendMode
(
tface
,
SDL_BLENDMODE_ADD
);
render
_compare
(
"Blit blending output not the same (using SDL_BLENDMODE_ADD)."
,
_compare
(
"Blit blending output not the same (using SDL_BLENDMODE_ADD)."
,
&
img_blendAdd
,
ALLOWABLE_ERROR_BLENDED
);
//FIXME add assert
&
img_blendAdd
,
ALLOWABLE_ERROR_BLENDED
);
//FIXME add assert
/* Test Mod. */
/* Test Mod. */
render
_testBlitBlendMode
(
tface
,
SDL_BLENDMODE_MOD
);
_testBlitBlendMode
(
tface
,
SDL_BLENDMODE_MOD
);
render
_compare
(
"Blit blending output not the same (using SDL_BLENDMODE_MOD)."
,
_compare
(
"Blit blending output not the same (using SDL_BLENDMODE_MOD)."
,
&
img_blendMod
,
ALLOWABLE_ERROR_BLENDED
);
&
img_blendMod
,
ALLOWABLE_ERROR_BLENDED
);
/* Clear surface. */
/* Clear surface. */
render
_clearScreen
();
_clearScreen
();
/* Loop blit. */
/* Loop blit. */
for
(
j
=
0
;
j
<=
nj
;
j
+=
4
)
{
for
(
j
=
0
;
j
<=
nj
;
j
+=
4
)
{
...
@@ -632,30 +628,30 @@ render_testBlitBlend (void *arg)
...
@@ -632,30 +628,30 @@ render_testBlitBlend (void *arg)
SDL_DestroyTexture
(
tface
);
SDL_DestroyTexture
(
tface
);
/* Check to see if matches. */
/* Check to see if matches. */
render
_compare
(
"Blit blending output not the same (using SDL_BLENDMODE_*)."
,
_compare
(
"Blit blending output not the same (using SDL_BLENDMODE_*)."
,
&
img_blendAll
,
ALLOWABLE_ERROR_BLENDED
);
// FIXME add assert
&
img_blendAll
,
ALLOWABLE_ERROR_BLENDED
);
// FIXME add assert
}
}
/**
/**
* @brief Checks to see if functionality is supported.
* @brief Checks to see if functionality is supported.
Helper function.
*/
*/
static
static
int
int
render
_isSupported
(
int
code
)
_isSupported
(
int
code
)
{
{
return
(
code
==
0
);
return
(
code
==
0
);
}
}
/**
/**
* @brief Test to see if we can vary the draw colour.
* @brief Test to see if we can vary the draw colour.
Helper function.
*
*
* \sa
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
* http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawColor
* http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawColor
*/
*/
static
static
int
int
render
_hasDrawColor
(
void
)
_hasDrawColor
(
void
)
{
{
int
ret
,
fail
;
int
ret
,
fail
;
Uint8
r
,
g
,
b
,
a
;
Uint8
r
,
g
,
b
,
a
;
...
@@ -664,14 +660,14 @@ int render_hasDrawColor (void)
...
@@ -664,14 +660,14 @@ int render_hasDrawColor (void)
/* Set colour. */
/* Set colour. */
ret
=
SDL_SetRenderDrawColor
(
renderer
,
100
,
100
,
100
,
100
);
ret
=
SDL_SetRenderDrawColor
(
renderer
,
100
,
100
,
100
,
100
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
SDL_GetRenderDrawColor
(
renderer
,
&
r
,
&
g
,
&
b
,
&
a
);
ret
=
SDL_GetRenderDrawColor
(
renderer
,
&
r
,
&
g
,
&
b
,
&
a
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
/* Restore natural. */
/* Restore natural. */
ret
=
SDL_SetRenderDrawColor
(
renderer
,
0
,
0
,
0
,
SDL_ALPHA_OPAQUE
);
ret
=
SDL_SetRenderDrawColor
(
renderer
,
0
,
0
,
0
,
SDL_ALPHA_OPAQUE
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
/* Something failed, consider not available. */
/* Something failed, consider not available. */
...
@@ -684,14 +680,14 @@ int render_hasDrawColor (void)
...
@@ -684,14 +680,14 @@ int render_hasDrawColor (void)
}
}
/**
/**
* @brief Test to see if we can vary the blend mode.
* @brief Test to see if we can vary the blend mode.
Helper function.
*
*
* \sa
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
* http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawBlendMode
* http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawBlendMode
*/
*/
static
int
static
int
render
_hasBlendModes
(
void
)
_hasBlendModes
(
void
)
{
{
int
fail
;
int
fail
;
int
ret
;
int
ret
;
...
@@ -700,40 +696,40 @@ render_hasBlendModes (void)
...
@@ -700,40 +696,40 @@ render_hasBlendModes (void)
fail
=
0
;
fail
=
0
;
ret
=
SDL_SetRenderDrawBlendMode
(
renderer
,
SDL_BLENDMODE_BLEND
);
ret
=
SDL_SetRenderDrawBlendMode
(
renderer
,
SDL_BLENDMODE_BLEND
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
SDL_GetRenderDrawBlendMode
(
renderer
,
&
mode
);
ret
=
SDL_GetRenderDrawBlendMode
(
renderer
,
&
mode
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
(
mode
!=
SDL_BLENDMODE_BLEND
);
ret
=
(
mode
!=
SDL_BLENDMODE_BLEND
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
SDL_SetRenderDrawBlendMode
(
renderer
,
SDL_BLENDMODE_ADD
);
ret
=
SDL_SetRenderDrawBlendMode
(
renderer
,
SDL_BLENDMODE_ADD
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
SDL_GetRenderDrawBlendMode
(
renderer
,
&
mode
);
ret
=
SDL_GetRenderDrawBlendMode
(
renderer
,
&
mode
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
(
mode
!=
SDL_BLENDMODE_ADD
);
ret
=
(
mode
!=
SDL_BLENDMODE_ADD
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
SDL_SetRenderDrawBlendMode
(
renderer
,
SDL_BLENDMODE_MOD
);
ret
=
SDL_SetRenderDrawBlendMode
(
renderer
,
SDL_BLENDMODE_MOD
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
SDL_GetRenderDrawBlendMode
(
renderer
,
&
mode
);
ret
=
SDL_GetRenderDrawBlendMode
(
renderer
,
&
mode
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
(
mode
!=
SDL_BLENDMODE_MOD
);
ret
=
(
mode
!=
SDL_BLENDMODE_MOD
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
SDL_SetRenderDrawBlendMode
(
renderer
,
SDL_BLENDMODE_NONE
);
ret
=
SDL_SetRenderDrawBlendMode
(
renderer
,
SDL_BLENDMODE_NONE
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
SDL_GetRenderDrawBlendMode
(
renderer
,
&
mode
);
ret
=
SDL_GetRenderDrawBlendMode
(
renderer
,
&
mode
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
(
mode
!=
SDL_BLENDMODE_NONE
);
ret
=
(
mode
!=
SDL_BLENDMODE_NONE
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
return
!
fail
;
return
!
fail
;
...
@@ -741,14 +737,14 @@ render_hasBlendModes (void)
...
@@ -741,14 +737,14 @@ render_hasBlendModes (void)
/**
/**
* @brief Loads the test face.
* @brief Loads the test face.
Helper function.
*
*
* \sa
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_CreateRGBSurfaceFrom
* http://wiki.libsdl.org/moin.cgi/SDL_CreateRGBSurfaceFrom
* http://wiki.libsdl.org/moin.cgi/SDL_CreateTextureFromSurface
* http://wiki.libsdl.org/moin.cgi/SDL_CreateTextureFromSurface
*/
*/
static
SDL_Texture
*
static
SDL_Texture
*
render
_loadTestFace
(
void
)
_loadTestFace
(
void
)
{
{
SDL_Surface
*
face
;
SDL_Surface
*
face
;
SDL_Texture
*
tface
;
SDL_Texture
*
tface
;
...
@@ -778,7 +774,7 @@ render_loadTestFace(void)
...
@@ -778,7 +774,7 @@ render_loadTestFace(void)
/**
/**
* @brief Test to see if can set texture colour mode.
* @brief Test to see if can set texture colour mode.
Helper function.
*
*
* \sa
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
...
@@ -786,7 +782,7 @@ render_loadTestFace(void)
...
@@ -786,7 +782,7 @@ render_loadTestFace(void)
* http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
* http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
*/
*/
static
int
static
int
render
_hasTexColor
(
void
)
_hasTexColor
(
void
)
{
{
int
fail
;
int
fail
;
int
ret
;
int
ret
;
...
@@ -794,17 +790,17 @@ render_hasTexColor (void)
...
@@ -794,17 +790,17 @@ render_hasTexColor (void)
Uint8
r
,
g
,
b
;
Uint8
r
,
g
,
b
;
/* Get test face. */
/* Get test face. */
tface
=
render
_loadTestFace
();
tface
=
_loadTestFace
();
if
(
tface
==
0
)
if
(
tface
==
0
)
return
0
;
return
0
;
/* See if supported. */
/* See if supported. */
fail
=
0
;
fail
=
0
;
ret
=
SDL_SetTextureColorMod
(
tface
,
100
,
100
,
100
);
ret
=
SDL_SetTextureColorMod
(
tface
,
100
,
100
,
100
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
SDL_GetTextureColorMod
(
tface
,
&
r
,
&
g
,
&
b
);
ret
=
SDL_GetTextureColorMod
(
tface
,
&
r
,
&
g
,
&
b
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
/* Clean up. */
/* Clean up. */
...
@@ -818,7 +814,7 @@ render_hasTexColor (void)
...
@@ -818,7 +814,7 @@ render_hasTexColor (void)
}
}
/**
/**
* @brief Test to see if we can vary the alpha of the texture.
* @brief Test to see if we can vary the alpha of the texture.
Helper function.
*
*
* \sa
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
...
@@ -826,7 +822,7 @@ render_hasTexColor (void)
...
@@ -826,7 +822,7 @@ render_hasTexColor (void)
* http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
* http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
*/
*/
static
int
static
int
render
_hasTexAlpha
(
void
)
_hasTexAlpha
(
void
)
{
{
int
fail
;
int
fail
;
int
ret
;
int
ret
;
...
@@ -834,17 +830,17 @@ render_hasTexAlpha(void)
...
@@ -834,17 +830,17 @@ render_hasTexAlpha(void)
Uint8
a
;
Uint8
a
;
/* Get test face. */
/* Get test face. */
tface
=
render
_loadTestFace
();
tface
=
_loadTestFace
();
if
(
tface
==
0
)
if
(
tface
==
0
)
return
0
;
return
0
;
/* See if supported. */
/* See if supported. */
fail
=
0
;
fail
=
0
;
ret
=
SDL_SetTextureAlphaMod
(
tface
,
100
);
ret
=
SDL_SetTextureAlphaMod
(
tface
,
100
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
ret
=
SDL_GetTextureAlphaMod
(
tface
,
&
a
);
ret
=
SDL_GetTextureAlphaMod
(
tface
,
&
a
);
if
(
!
render
_isSupported
(
ret
))
if
(
!
_isSupported
(
ret
))
fail
=
1
;
fail
=
1
;
/* Clean up. */
/* Clean up. */
...
@@ -858,7 +854,7 @@ render_hasTexAlpha(void)
...
@@ -858,7 +854,7 @@ render_hasTexAlpha(void)
}
}
/**
/**
* @brief Compares screen pixels with image pixels.
* @brief Compares screen pixels with image pixels.
Helper function.
*
*
* @param msg Message on failure.
* @param msg Message on failure.
* @param s Image to compare against.
* @param s Image to compare against.
...
@@ -870,7 +866,7 @@ render_hasTexAlpha(void)
...
@@ -870,7 +866,7 @@ render_hasTexAlpha(void)
* http://wiki.libsdl.org/moin.cgi/SDL_FreeSurface
* http://wiki.libsdl.org/moin.cgi/SDL_FreeSurface
*/
*/
static
void
static
void
render
_compare
(
const
char
*
msg
,
const
SurfaceImage_t
*
s
,
int
allowable_error
)
_compare
(
const
char
*
msg
,
const
SurfaceImage_t
*
s
,
int
allowable_error
)
{
{
int
ret
;
int
ret
;
SDL_Rect
rect
;
SDL_Rect
rect
;
...
@@ -899,16 +895,15 @@ render_compare(const char *msg, const SurfaceImage_t *s, int allowable_error)
...
@@ -899,16 +895,15 @@ render_compare(const char *msg, const SurfaceImage_t *s, int allowable_error)
}
}
/**
/**
* @brief Clears the screen.
* @brief Clears the screen.
Helper function.
*
*
* \sa
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
* http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
* http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
*
*/
*/
static
int
static
int
render
_clearScreen
(
void
)
_clearScreen
(
void
)
{
{
int
ret
;
int
ret
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment