From: Ricardo Cruz Date: Tue, 13 Apr 2004 15:20:20 +0000 (+0000) Subject: Fixed SDL code of drawgradient(). X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=8dfd372e4ec205eab6cea2c77f031826e564429a;p=supertux.git Fixed SDL code of drawgradient(). I forgot that the axis in SDL are positve in the Up-Down direction. Now you shouldn't notice any difference between SDL and OpenGL gradients ;) SVN-Revision: 521 --- diff --git a/src/screen.cpp b/src/screen.cpp index d3e762d87..88525ed1c 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -75,9 +75,10 @@ void drawgradient(Color top_clr, Color bot_clr) #endif for(float y = 0; y < 480; y += 2) - fillrect(0, (int)y, 640, 2, (int)(((float)(top_clr.red-bot_clr.red)/640) * y + top_clr.red), - (int)(((float)(top_clr.green-bot_clr.green)/640) * y + top_clr.green), - (int)(((float)(top_clr.blue-bot_clr.blue)/640) * y + top_clr.blue), 255); + fillrect(0, (int)y, 640, 2, + (int)(((float)(top_clr.red-bot_clr.red)/(0-480)) * y + top_clr.red), + (int)(((float)(top_clr.green-bot_clr.green)/(0-480)) * y + top_clr.green), + (int)(((float)(top_clr.blue-bot_clr.blue)/(0-480)) * y + top_clr.blue), 255); /* calculates the color for each line, based in the generic equation for functions: y = mx + b */ #ifndef NOOPENGL