test/automated/common/common.h
author Ryan C. Gordon
Wed, 03 Apr 2013 11:49:25 -0400
changeset 7053 187225ae13e5
parent 7051 cf773d8091c7
child 7191 75360622e65f
permissions -rw-r--r--
Another attempt at fixing compiler warnings for SDLTest_SurfaceImage_t.
slouken@3259
     1
/**
slouken@3259
     2
 * Automated SDL test common framework.
slouken@3259
     3
 *
slouken@3259
     4
 * Written by Edgar Simo "bobbens"
slouken@3259
     5
 *
slouken@3259
     6
 * Released under Public Domain.
slouken@3259
     7
 */
slouken@3259
     8
slouken@3259
     9
slouken@3259
    10
#ifndef COMMON_H
slouken@3259
    11
#  define COMMON_H
slouken@3259
    12
slouken@3259
    13
slouken@3441
    14
#  define FORMAT  SDL_PIXELFORMAT_ARGB8888
slouken@3439
    15
#  define AMASK   0xff000000 /**< Alpha bit mask. */
slouken@3439
    16
#  define RMASK   0x00ff0000 /**< Red bit mask. */
slouken@3259
    17
#  define GMASK   0x0000ff00 /**< Green bit mask. */
slouken@3439
    18
#  define BMASK   0x000000ff /**< Blue bit mask. */
slouken@3259
    19
slouken@3259
    20
slouken@3259
    21
typedef struct SurfaceImage_s {
slouken@3259
    22
   int width;
slouken@3259
    23
   int height;
slouken@3259
    24
   unsigned int  bytes_per_pixel; /* 3:RGB, 4:RGBA */ 
icculus@7053
    25
   const char *pixel_data;
slouken@3259
    26
} SurfaceImage_t;
slouken@3259
    27
slouken@3477
    28
#define ALLOWABLE_ERROR_OPAQUE	0
slouken@3477
    29
#define ALLOWABLE_ERROR_BLENDED	64
slouken@3259
    30
slouken@3259
    31
/**
slouken@3259
    32
 * @brief Compares a surface and a surface image for equality.
slouken@3259
    33
 *
slouken@3259
    34
 *    @param sur Surface to compare.
slouken@3259
    35
 *    @param img Image to compare against.
slouken@3259
    36
 *    @return 0 if they are the same, -1 on error and positive if different.
slouken@3259
    37
 */
slouken@3477
    38
int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img, int allowable_error );
slouken@3259
    39
slouken@3259
    40
slouken@3259
    41
#endif /* COMMON_H */
slouken@3259
    42