43 int bpp, bpp_reference;
46 int sampleErrorX = 0, sampleErrorY = 0, sampleDist = 0;
49 char imageFilename[128];
50 char referenceFilename[128];
53 if (surface ==
NULL || referenceSurface ==
NULL) {
58 if ((surface->
w != referenceSurface->
w) || (surface->
h != referenceSurface->
h)) {
63 if (allowable_error<0) {
74 for (j=0; j<surface->
h; j++) {
75 for (i=0; i<surface->
w; i++) {
77 p_reference = (
Uint8 *)referenceSurface->
pixels + j * referenceSurface->
pitch + i * bpp_reference;
83 dist += (R-Rd)*(R-Rd);
84 dist += (G-Gd)*(G-Gd);
85 dist += (B-Bd)*(B-Bd);
88 if (dist > allowable_error) {
105 SDLTest_LogError(
"Comparison of pixels with allowable error of %i failed %i times.", allowable_error, ret);
106 SDLTest_LogError(
"First detected occurrence at position %i,%i with a squared RGB-difference of %i.", sampleErrorX, sampleErrorY, sampleDist);
111 SDLTest_LogError(
"Surfaces from failed comparison saved as '%s' and '%s'", imageFilename, referenceFilename);
int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error)
Compares a surface and with reference image data for equality.
#define SDL_UnlockSurface
A collection of pixels used in software blitting.
#define SDL_SaveBMP(surface, file)
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp
static int _CompareSurfaceCount
void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
Prints given message with a timestamp in the TEST category and the ERROR priority.
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 int in j)
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 SDL_Surface * referenceSurface