DrawUtils circle now fills, but alpha is a problem, since we're blending 1800 rectangles on each other

This commit is contained in:
Anna Rose 2011-06-23 00:09:34 -04:00
parent b5e385586d
commit a60ad393e9

View File

@ -96,17 +96,30 @@ void DrawUtils::draw_circle_filled(SDL_Surface* dest, Sint16 int_x, Sint16 int_y
float r = static_cast<float> (int_r);
SDL_Rect pen;
pen.w = 2;
pen.h = 2;
float i;
for (i=0; i < 6.28318531; i += 0.0034906585)
{
pen.x = static_cast<int> (x + cos(i) * r);
pen.y = static_cast<int> (y + sin(i) * r);
// pen.w = static_cast<int> (2 + cos(i) * r);
// pen.h = static_cast<int> (2 + sin(i) * r);
int w = static_cast<int> (x - pen.x);
int h = static_cast<int> (y - pen.y);
if (w == 0) pen.w = 1;
else if (w < 0)
{
pen.x = x;
pen.w = abs(w);
}
else pen.w = w;
if (h == 0) pen.h = 1;
else if (h < 0)
{
pen.y = y;
pen.h = abs(h);
}
else pen.h = h;
if (pen.x >= dest->clip_rect.x &&
pen.y >= dest->clip_rect.y &&
@ -116,7 +129,7 @@ void DrawUtils::draw_circle_filled(SDL_Surface* dest, Sint16 int_x, Sint16 int_y
SDL_MapRGBA(dest->format,
(colour >> 16) & 0xff,
(colour >> 8) & 0xff,
colour & 0xff, alpha));
colour & 0xff, 1));
}
}