43 |
gradient.colors[3]); |
gradient.colors[3]); |
44 |
} |
} |
45 |
|
|
46 |
SDL_Surface* PG_Draw::CreateGradient(const PG_Rect& r, SDL_Color & ul, SDL_Color & ur, SDL_Color & dl, SDL_Color & dr) { |
SDL_Surface* PG_Draw::CreateGradient(const PG_Rect& r, const PG_Color& ul, const PG_Color& ur, const PG_Color& dl, const PG_Color& dr) { |
47 |
SDL_Surface* screen = SDL_GetVideoSurface(); |
SDL_Surface* screen = SDL_GetVideoSurface(); |
48 |
|
|
49 |
assert(screen); |
assert(screen); |
67 |
gradient.colors[3]); |
gradient.colors[3]); |
68 |
} |
} |
69 |
|
|
70 |
void PG_Draw::DrawGradient(SDL_Surface * surface, const PG_Rect& rect, const SDL_Color & ul, const SDL_Color & ur, const SDL_Color & dl, const SDL_Color & dr) { |
void PG_Draw::DrawGradient(SDL_Surface * surface, const PG_Rect& rect, const PG_Color& ul, const PG_Color& ur, const PG_Color& dl, const PG_Color& dr) { |
71 |
Sint32 v00,v01,v02; |
Sint32 v00,v01,v02; |
72 |
Sint32 v10,v11,v12; |
Sint32 v10,v11,v12; |
73 |
|
|
83 |
if (w > surface->w || h > surface->h) |
if (w > surface->w || h > surface->h) |
84 |
return; |
return; |
85 |
|
|
86 |
Uint32 c1 = SDL_MapRGB(surface->format, ul.r, ul.g, ul.b); |
Uint32 c1 = ul.MapRGB(surface->format); |
87 |
Uint32 c2 = SDL_MapRGB(surface->format, ur.r, ur.g, ur.b); |
Uint32 c2 = ur.MapRGB(surface->format); |
88 |
Uint32 c3 = SDL_MapRGB(surface->format, dl.r, dl.g, dl.b); |
Uint32 c3 = dl.MapRGB(surface->format); |
89 |
Uint32 c4 = SDL_MapRGB(surface->format, dr.r, dr.g, dr.b); |
Uint32 c4 = dr.MapRGB(surface->format); |
90 |
|
|
91 |
// solid color gradient ? |
// solid color gradient ? |
92 |
if((c1 == c2) && (c2 == c3) && (c3 == c4)) { |
if((c1 == c2) && (c2 == c3) && (c3 == c4)) { |