When you say 'lags like hell' do you mean your game's FPS drops to like 1 or there's this super long pause that lasts for a few seconds but the game runs normally afterwards?
If the first, you should still look for why you are calling that 'gradient_draw_text' so many times. Why would you even need to call it multiple times anyways? Just draw it once and be done with it.
If the second, which must mean you are drawing something to an insanely large bitmap, I would probably do something along the lines of what Ryex suggested for my game.