Mercurial > sdl-ios-xcode
comparison src/video/SDL_blendfillrect.c @ 4929:aa8888658021
Use the enumerated type for blend and scale mode instead of int
Renamed SDL_TextureScaleMode to SDL_ScaleMode
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 12 Dec 2010 15:19:05 -0800 |
parents | f7b03b6838cb |
children | e743b9c3f6d6 |
comparison
equal
deleted
inserted
replaced
4927:d716dff4b13e | 4929:aa8888658021 |
---|---|
24 #include "SDL_video.h" | 24 #include "SDL_video.h" |
25 #include "SDL_draw.h" | 25 #include "SDL_draw.h" |
26 | 26 |
27 static int | 27 static int |
28 SDL_BlendFillRect_RGB555(SDL_Surface * dst, const SDL_Rect * rect, | 28 SDL_BlendFillRect_RGB555(SDL_Surface * dst, const SDL_Rect * rect, |
29 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) | 29 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
30 { | 30 { |
31 unsigned inva = 0xff - a; | 31 unsigned inva = 0xff - a; |
32 | 32 |
33 switch (blendMode) { | 33 switch (blendMode) { |
34 case SDL_BLENDMODE_BLEND: | 34 case SDL_BLENDMODE_BLEND: |
47 return 0; | 47 return 0; |
48 } | 48 } |
49 | 49 |
50 static int | 50 static int |
51 SDL_BlendFillRect_RGB565(SDL_Surface * dst, const SDL_Rect * rect, | 51 SDL_BlendFillRect_RGB565(SDL_Surface * dst, const SDL_Rect * rect, |
52 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) | 52 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
53 { | 53 { |
54 unsigned inva = 0xff - a; | 54 unsigned inva = 0xff - a; |
55 | 55 |
56 switch (blendMode) { | 56 switch (blendMode) { |
57 case SDL_BLENDMODE_BLEND: | 57 case SDL_BLENDMODE_BLEND: |
70 return 0; | 70 return 0; |
71 } | 71 } |
72 | 72 |
73 static int | 73 static int |
74 SDL_BlendFillRect_RGB888(SDL_Surface * dst, const SDL_Rect * rect, | 74 SDL_BlendFillRect_RGB888(SDL_Surface * dst, const SDL_Rect * rect, |
75 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) | 75 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
76 { | 76 { |
77 unsigned inva = 0xff - a; | 77 unsigned inva = 0xff - a; |
78 | 78 |
79 switch (blendMode) { | 79 switch (blendMode) { |
80 case SDL_BLENDMODE_BLEND: | 80 case SDL_BLENDMODE_BLEND: |
93 return 0; | 93 return 0; |
94 } | 94 } |
95 | 95 |
96 static int | 96 static int |
97 SDL_BlendFillRect_ARGB8888(SDL_Surface * dst, const SDL_Rect * rect, | 97 SDL_BlendFillRect_ARGB8888(SDL_Surface * dst, const SDL_Rect * rect, |
98 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) | 98 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
99 { | 99 { |
100 unsigned inva = 0xff - a; | 100 unsigned inva = 0xff - a; |
101 | 101 |
102 switch (blendMode) { | 102 switch (blendMode) { |
103 case SDL_BLENDMODE_BLEND: | 103 case SDL_BLENDMODE_BLEND: |
116 return 0; | 116 return 0; |
117 } | 117 } |
118 | 118 |
119 static int | 119 static int |
120 SDL_BlendFillRect_RGB(SDL_Surface * dst, const SDL_Rect * rect, | 120 SDL_BlendFillRect_RGB(SDL_Surface * dst, const SDL_Rect * rect, |
121 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) | 121 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
122 { | 122 { |
123 SDL_PixelFormat *fmt = dst->format; | 123 SDL_PixelFormat *fmt = dst->format; |
124 unsigned inva = 0xff - a; | 124 unsigned inva = 0xff - a; |
125 | 125 |
126 switch (fmt->BytesPerPixel) { | 126 switch (fmt->BytesPerPixel) { |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 static int | 165 static int |
166 SDL_BlendFillRect_RGBA(SDL_Surface * dst, const SDL_Rect * rect, | 166 SDL_BlendFillRect_RGBA(SDL_Surface * dst, const SDL_Rect * rect, |
167 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) | 167 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
168 { | 168 { |
169 SDL_PixelFormat *fmt = dst->format; | 169 SDL_PixelFormat *fmt = dst->format; |
170 unsigned inva = 0xff - a; | 170 unsigned inva = 0xff - a; |
171 | 171 |
172 switch (fmt->BytesPerPixel) { | 172 switch (fmt->BytesPerPixel) { |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
195 int | 195 int |
196 SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect, | 196 SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect, |
197 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) | 197 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
198 { | 198 { |
199 SDL_Rect clipped; | 199 SDL_Rect clipped; |
200 | 200 |
201 if (!dst) { | 201 if (!dst) { |
202 SDL_SetError("Passed NULL destination surface"); | 202 SDL_SetError("Passed NULL destination surface"); |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
264 int | 264 int |
265 SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect ** rects, int count, | 265 SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect ** rects, int count, |
266 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) | 266 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
267 { | 267 { |
268 SDL_Rect clipped; | 268 SDL_Rect clipped; |
269 int i; | 269 int i; |
270 int (*func)(SDL_Surface * dst, const SDL_Rect * rect, | 270 int (*func)(SDL_Surface * dst, const SDL_Rect * rect, |
271 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL; | 271 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL; |
272 int status = 0; | 272 int status = 0; |
273 | 273 |
274 if (!dst) { | 274 if (!dst) { |
275 SDL_SetError("Passed NULL destination surface"); | 275 SDL_SetError("Passed NULL destination surface"); |
276 return -1; | 276 return -1; |