Mercurial > sdl-ios-xcode
annotate test/automated/surface/surface.c @ 3716:ac6bc19a2dfb gsoc2009_unit_tests
Added surfarce blend rendering functions testcase.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Wed, 01 Jul 2009 22:03:32 +0000 |
parents | 3c9d9c052c8f |
children | 9d71382713b5 |
rev | line source |
---|---|
3715
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
1 /** |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
2 * Automated SDL_Surface test. |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
3 * |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
4 * Written by Edgar Simo "bobbens" |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
5 * |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
6 * Released under Public Domain. |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
7 */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
8 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
9 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
10 #include "SDL.h" |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
11 #include "SDL_at.h" |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
12 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
13 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
14 #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
15 # define RMASK 0xff000000 /**< Red bit mask. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
16 # define GMASK 0x00ff0000 /**< Green bit mask. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
17 # define BMASK 0x0000ff00 /**< Blue bit mask. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
18 # define AMASK 0x000000ff /**< Alpha bit mask. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
19 #else |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
20 # define RMASK 0x000000ff /**< Red bit mask. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
21 # define GMASK 0x0000ff00 /**< Green bit mask. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
22 # define BMASK 0x00ff0000 /**< Blue bit mask. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
23 # define AMASK 0xff000000 /**< Alpha bit mask. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
24 #endif |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
25 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
26 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
27 typedef struct SurfaceImage_s { |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
28 unsigned int width; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
29 unsigned int height; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
30 unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
31 const unsigned char pixel_data[]; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
32 } SurfaceImage_t; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
33 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
34 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
35 /* |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
36 * Pull in images for testcases. |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
37 */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
38 #include "primitives.c" |
3716
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
39 #include "blend.c" |
3715
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
40 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
41 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
42 /** |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
43 * @brief Compares a surface and a surface image for equality. |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
44 * |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
45 * @param sur Surface to compare. |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
46 * @param img Image to compare against. |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
47 * @return 0 if they are the same, -1 on error and positive if different. |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
48 */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
49 static int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img ) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
50 { |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
51 int ret; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
52 int i,j; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
53 Uint32 pix; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
54 int bpp; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
55 Uint8 *p, *pd; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
56 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
57 /* Make sure size is the same. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
58 if ((sur->w != img->width) || (sur->h != img->height)) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
59 return -1; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
60 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
61 SDL_LockSurface( sur ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
62 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
63 ret = 0; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
64 bpp = sur->format->BytesPerPixel; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
65 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
66 /* Compare image - should be same format. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
67 for (j=0; j<sur->h; j++) { |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
68 for (i=0; i<sur->w; i++) { |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
69 p = (Uint8 *)sur->pixels + j * sur->pitch + i * bpp; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
70 pd = (Uint8 *)img->pixel_data + (j*img->width + i) * img->bytes_per_pixel; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
71 switch (bpp) { |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
72 case 1: |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
73 /* Paletted not supported atm. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
74 ret += 1; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
75 break; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
76 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
77 case 2: |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
78 /* 16 BPP not supported atm. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
79 ret += 1; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
80 break; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
81 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
82 case 3: |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
83 /* 24 BPP not supported atm. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
84 ret += 1; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
85 break; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
86 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
87 case 4: |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
88 ret += !( (p[0] == pd[0]) && |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
89 (p[1] == pd[1]) && |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
90 (p[2] == pd[2]) ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
91 break; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
92 } |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
93 } |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
94 } |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
95 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
96 SDL_UnlockSurface( sur ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
97 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
98 return ret; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
99 } |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
100 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
101 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
102 /** |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
103 * @brief Tests the SDL primitives for rendering. |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
104 */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
105 static void surface_testPrimitives (void) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
106 { |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
107 int ret; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
108 int x, y; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
109 SDL_Rect rect; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
110 SDL_Surface *testsur; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
111 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
112 SDL_ATbegin( "Primitives Test" ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
113 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
114 /* Create the surface. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
115 testsur = SDL_CreateRGBSurface( 0, 80, 60, 32, |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
116 RMASK, GMASK, BMASK, AMASK ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
117 if (SDL_ATassert( "SDL_CreateRGBSurface", testsur != NULL)) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
118 return; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
119 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
120 /* Draw a rectangle. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
121 rect.x = 40; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
122 rect.y = 0; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
123 rect.w = 40; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
124 rect.h = 80; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
125 ret = SDL_FillRect( testsur, &rect, |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
126 SDL_MapRGB( testsur->format, 13, 73, 200 ) ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
127 if (SDL_ATassert( "SDL_FillRect", ret == 0)) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
128 return; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
129 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
130 /* Draw a rectangle. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
131 rect.x = 10; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
132 rect.y = 10; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
133 rect.w = 60; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
134 rect.h = 40; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
135 ret = SDL_FillRect( testsur, &rect, |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
136 SDL_MapRGB( testsur->format, 200, 0, 100 ) ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
137 if (SDL_ATassert( "SDL_FillRect", ret == 0)) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
138 return; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
139 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
140 /* Draw some points like so: |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
141 * X.X.X.X.. |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
142 * .X.X.X.X. |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
143 * X.X.X.X.. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
144 for (y=0; y<3; y++) { |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
145 x = y % 2; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
146 for (; x<80; x+=2) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
147 ret = SDL_DrawPoint( testsur, x, y, |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
148 SDL_MapRGB( testsur->format, x*y, x*y/2, x*y/3 ) ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
149 if (SDL_ATassert( "SDL_DrawPoint", ret == 0)) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
150 return; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
151 } |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
152 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
153 /* Draw some lines. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
154 ret = SDL_DrawLine( testsur, 0, 30, 80, 30, |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
155 SDL_MapRGB( testsur->format, 0, 255, 0 ) ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
156 if (SDL_ATassert( "SDL_DrawLine", ret == 0)) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
157 return; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
158 ret = SDL_DrawLine( testsur, 40, 30, 40, 60, |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
159 SDL_MapRGB( testsur->format, 55, 55, 5 ) ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
160 if (SDL_ATassert( "SDL_DrawLine", ret == 0)) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
161 return; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
162 ret = SDL_DrawLine( testsur, 0, 60, 80, 0, |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
163 SDL_MapRGB( testsur->format, 5, 105, 105 ) ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
164 if (SDL_ATassert( "SDL_DrawLine", ret == 0)) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
165 return; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
166 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
167 /* See if it's the same. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
168 if (SDL_ATassert( "Primitives output not the same.", |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
169 surface_compare( testsur, &img_primitives )==0 )) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
170 return; |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
171 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
172 /* Clean up. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
173 SDL_FreeSurface( testsur ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
174 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
175 SDL_ATend(); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
176 } |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
177 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
178 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
179 /** |
3716
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
180 * @brief Tests the SDL primitives with alpha for rendering. |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
181 */ |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
182 static void surface_testPrimitivesAlpha (void) |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
183 { |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
184 int ret; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
185 int i, j; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
186 SDL_Rect rect; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
187 SDL_Surface *testsur; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
188 |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
189 SDL_ATbegin( "Primitives Alpha Test" ); |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
190 |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
191 /* Create the surface. */ |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
192 testsur = SDL_CreateRGBSurface( 0, 80, 60, 32, |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
193 RMASK, GMASK, BMASK, AMASK ); |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
194 |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
195 /* Create some rectangles for each blend mode. */ |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
196 ret = SDL_BlendRect( testsur, NULL, SDL_BLENDMODE_NONE, 255, 255, 255, 0 ); |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
197 if (SDL_ATassert( "SDL_BlendRect", ret == 0)) |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
198 return; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
199 rect.x = 10; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
200 rect.y = 25; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
201 rect.w = 40; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
202 rect.h = 25; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
203 ret = SDL_BlendRect( testsur, &rect, SDL_BLENDMODE_ADD, 240, 10, 10, 75 ); |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
204 if (SDL_ATassert( "SDL_BlendRect", ret == 0)) |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
205 return; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
206 rect.x = 30; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
207 rect.y = 40; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
208 rect.w = 45; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
209 rect.h = 15; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
210 ret = SDL_BlendRect( testsur, &rect, SDL_BLENDMODE_BLEND, 10, 240, 10, 100 ); |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
211 if (SDL_ATassert( "SDL_BlendRect", ret == 0)) |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
212 return; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
213 rect.x = 25; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
214 rect.y = 25; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
215 rect.w = 25; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
216 rect.h = 25; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
217 ret = SDL_BlendRect( testsur, &rect, SDL_BLENDMODE_MOD, 10, 10, 240, 125 ); |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
218 if (SDL_ATassert( "SDL_BlendRect", ret == 0)) |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
219 return; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
220 |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
221 /* Draw blended lines, lines for everyone. */ |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
222 for (i=0; i<testsur->w; i+=2) { |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
223 ret = SDL_BlendLine( testsur, 0, 0, i, 59, |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
224 (((i/2)%3)==0) ? SDL_BLENDMODE_BLEND : |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
225 (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD, |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
226 60+2*j, 240-2*j, 50, 3*j ); |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
227 if (SDL_ATassert( "SDL_BlendLine", ret == 0)) |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
228 return; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
229 } |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
230 for (i=0; i<testsur->h; i+=2) { |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
231 ret = SDL_BlendLine( testsur, 0, 0, 79, i, |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
232 (((i/2)%3)==0) ? SDL_BLENDMODE_BLEND : |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
233 (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD, |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
234 60+2*j, 240-2*j, 50, 3*j ); |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
235 if (SDL_ATassert( "SDL_BlendLine", ret == 0)) |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
236 return; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
237 } |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
238 |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
239 /* Draw points. */ |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
240 for (j=0; j<testsur->h; j+=3) { |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
241 for (i=0; i<testsur->w; i+=3) { |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
242 ret = SDL_BlendPoint( testsur, i, j, |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
243 ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND : |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
244 ((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD, |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
245 j*4, i*3, j*4, i*3 ); |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
246 if (SDL_ATassert( "SDL_BlendPoint", ret == 0)) |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
247 return; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
248 } |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
249 } |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
250 |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
251 /* See if it's the same. */ |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
252 if (SDL_ATassert( "Primitives output not the same.", |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
253 surface_compare( testsur, &img_blend )==0 )) |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
254 return; |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
255 |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
256 /* Clean up. */ |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
257 SDL_FreeSurface( testsur ); |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
258 |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
259 SDL_ATend(); |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
260 } |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
261 |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
262 |
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
263 /** |
3715
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
264 * @brief Entry point. |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
265 */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
266 int main( int argc, const char *argv[] ) |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
267 { |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
268 SDL_ATinit( "SDL_Surface" ); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
269 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
270 /* Initializes the SDL subsystems. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
271 SDL_Init(0); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
272 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
273 surface_testPrimitives(); |
3716
ac6bc19a2dfb
Added surfarce blend rendering functions testcase.
Edgar Simo <bobbens@gmail.com>
parents:
3715
diff
changeset
|
274 surface_testPrimitivesAlpha(); |
3715
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
275 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
276 /* Exit SDL. */ |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
277 SDL_Quit(); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
278 |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
279 return SDL_ATfinish(1); |
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
280 } |