Reduces memory footprint

The buffer for some gradients does not have to be width * height big when two
lines are sufficient.
This commit is contained in:
Mathias Gumz 2013-02-06 08:04:40 +01:00
parent 6514398bea
commit a4a4bca745

View file

@ -403,7 +403,7 @@ void renderPyramidGradient(bool interlaced,
FbTk::ImageControl& imgctrl) { FbTk::ImageControl& imgctrl) {
const size_t s = width * height; const size_t s = width + height;
// we need 2 gradients but use only 'one' buffer // we need 2 gradients but use only 'one' buffer
FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; 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, const FbTk::Color* from, const FbTk::Color* to,
FbTk::ImageControl& imgctrl) { FbTk::ImageControl& imgctrl) {
const size_t s = width * height; const size_t s = width + height;
// we need 2 gradients but use only 'one' buffer // we need 2 gradients but use only 'one' buffer
FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; 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, const FbTk::Color* from, const FbTk::Color* to,
FbTk::ImageControl& imgctrl) { FbTk::ImageControl& imgctrl) {
size_t s = width * height; size_t s = width + height;
// we need 2 gradients but use only 'one' buffer // we need 2 gradients but use only 'one' buffer
FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0];
@ -535,7 +535,7 @@ void renderDiagonalGradient(bool interlaced,
FbTk::ImageControl& imgctrl) { FbTk::ImageControl& imgctrl) {
size_t s = width * height; size_t s = width + height;
// we need 2 gradients but use only 'one' buffer // we need 2 gradients but use only 'one' buffer
FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; 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, const FbTk::Color* from, const FbTk::Color* to,
FbTk::ImageControl& imgctrl) { FbTk::ImageControl& imgctrl) {
size_t s = width * height;
size_t i; size_t i;
int x; int x;
int y; int y;
@ -614,7 +612,7 @@ void renderCrossDiagonalGradient(bool interlaced,
const FbTk::Color* from, const FbTk::Color* to, const FbTk::Color* from, const FbTk::Color* to,
FbTk::ImageControl& imgctrl) { FbTk::ImageControl& imgctrl) {
size_t s = width * height; size_t s = width + height;
// we need 2 gradients but use only 'one' buffer // we need 2 gradients but use only 'one' buffer
FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0];