From: Ricardo Cruz Date: Sun, 11 Apr 2004 21:06:05 +0000 (+0000) Subject: Made drawgradient() to use our fillrect(), instead of SDL thingies X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=2e3f215f8ff96ab043170c365f06f01514720cf0;p=supertux.git Made drawgradient() to use our fillrect(), instead of SDL thingies and thus the code is much clear now. SVN-Revision: 493 --- diff --git a/src/screen.cpp b/src/screen.cpp index d757eac54..7adeae4a1 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -74,17 +74,10 @@ void drawgradient(int top_r, int top_g, int top_b, int bot_r, int bot_g, int bot { #endif - SDL_Rect r; - r.x = 0; - r.w = 640; - r.h = 2; - for(float y = 0; y < 480; y += 2) - { - r.y = (int)y; - - SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, (int)(((float)(top_r-bot_r)/640) * y + top_r), (int)(((float)(top_g-bot_g)/640) * y + top_g), (int)(((float)(top_b-bot_b)/640) * y + top_b))); - } + fillrect(0, (int)y, 640, 2, (int)(((float)(top_r-bot_r)/640) * y + top_r), + (int)(((float)(top_g-bot_g)/640) * y + top_g), + (int)(((float)(top_b-bot_b)/640) * y + top_b), 255); /* calculates the color for each line, based in the generic equation for functions: y = mx + b */ #ifndef NOOPENGL