From a4a4bca745fc9e5417243be404c77486fcdfe336 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Wed, 6 Feb 2013 08:04:40 +0100 Subject: Reduces memory footprint The buffer for some gradients does not have to be width * height big when two lines are sufficient. --- src/FbTk/TextureRender.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc index 93c91f1..ce1613a 100644 --- a/src/FbTk/TextureRender.cc +++ b/src/FbTk/TextureRender.cc @@ -403,7 +403,7 @@ void renderPyramidGradient(bool interlaced, FbTk::ImageControl& imgctrl) { - const size_t s = width * height; + const size_t s = width + height; // we need 2 gradients but use only 'one' buffer FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; @@ -446,7 +446,7 @@ void renderRectangleGradient(bool interlaced, const FbTk::Color* from, const FbTk::Color* to, FbTk::ImageControl& imgctrl) { - const size_t s = width * height; + const size_t s = width + height; // we need 2 gradients but use only 'one' buffer FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; @@ -488,7 +488,7 @@ void renderPipeCrossGradient(bool interlaced, const FbTk::Color* from, const FbTk::Color* to, FbTk::ImageControl& imgctrl) { - size_t s = width * height; + size_t s = width + height; // we need 2 gradients but use only 'one' buffer FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; @@ -535,7 +535,7 @@ void renderDiagonalGradient(bool interlaced, FbTk::ImageControl& imgctrl) { - size_t s = width * height; + size_t s = width + height; // we need 2 gradients but use only 'one' buffer FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; @@ -569,8 +569,6 @@ void renderEllipticGradient(bool interlaced, const FbTk::Color* from, const FbTk::Color* to, FbTk::ImageControl& imgctrl) { - size_t s = width * height; - size_t i; int x; int y; @@ -614,7 +612,7 @@ void renderCrossDiagonalGradient(bool interlaced, const FbTk::Color* from, const FbTk::Color* to, FbTk::ImageControl& imgctrl) { - size_t s = width * height; + size_t s = width + height; // we need 2 gradients but use only 'one' buffer FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; -- cgit v0.11.2