diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2013-02-06 07:04:40 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2013-02-06 07:04:47 (GMT) |
commit | a4a4bca745fc9e5417243be404c77486fcdfe336 (patch) | |
tree | 98fc4d531b800cd57cab10c4baa72a1ac5af6c78 | |
parent | 6514398bead7926b85b6e5eb7d6276f47a97cd2f (diff) | |
download | fluxbox_pavel-a4a4bca745fc9e5417243be404c77486fcdfe336.zip fluxbox_pavel-a4a4bca745fc9e5417243be404c77486fcdfe336.tar.bz2 |
Reduces memory footprint
The buffer for some gradients does not have to be width * height big when two
lines are sufficient.
-rw-r--r-- | src/FbTk/TextureRender.cc | 12 |
1 files 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, | |||
403 | FbTk::ImageControl& imgctrl) { | 403 | FbTk::ImageControl& imgctrl) { |
404 | 404 | ||
405 | 405 | ||
406 | const size_t s = width * height; | 406 | const size_t s = width + height; |
407 | 407 | ||
408 | // we need 2 gradients but use only 'one' buffer | 408 | // we need 2 gradients but use only 'one' buffer |
409 | FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; | 409 | FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; |
@@ -446,7 +446,7 @@ void renderRectangleGradient(bool interlaced, | |||
446 | const FbTk::Color* from, const FbTk::Color* to, | 446 | const FbTk::Color* from, const FbTk::Color* to, |
447 | FbTk::ImageControl& imgctrl) { | 447 | FbTk::ImageControl& imgctrl) { |
448 | 448 | ||
449 | const size_t s = width * height; | 449 | const size_t s = width + height; |
450 | 450 | ||
451 | // we need 2 gradients but use only 'one' buffer | 451 | // we need 2 gradients but use only 'one' buffer |
452 | FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; | 452 | FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; |
@@ -488,7 +488,7 @@ void renderPipeCrossGradient(bool interlaced, | |||
488 | const FbTk::Color* from, const FbTk::Color* to, | 488 | const FbTk::Color* from, const FbTk::Color* to, |
489 | FbTk::ImageControl& imgctrl) { | 489 | FbTk::ImageControl& imgctrl) { |
490 | 490 | ||
491 | size_t s = width * height; | 491 | size_t s = width + height; |
492 | 492 | ||
493 | // we need 2 gradients but use only 'one' buffer | 493 | // we need 2 gradients but use only 'one' buffer |
494 | FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; | 494 | FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; |
@@ -535,7 +535,7 @@ void renderDiagonalGradient(bool interlaced, | |||
535 | FbTk::ImageControl& imgctrl) { | 535 | FbTk::ImageControl& imgctrl) { |
536 | 536 | ||
537 | 537 | ||
538 | size_t s = width * height; | 538 | size_t s = width + height; |
539 | 539 | ||
540 | // we need 2 gradients but use only 'one' buffer | 540 | // we need 2 gradients but use only 'one' buffer |
541 | FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; | 541 | FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; |
@@ -569,8 +569,6 @@ void renderEllipticGradient(bool interlaced, | |||
569 | const FbTk::Color* from, const FbTk::Color* to, | 569 | const FbTk::Color* from, const FbTk::Color* to, |
570 | FbTk::ImageControl& imgctrl) { | 570 | FbTk::ImageControl& imgctrl) { |
571 | 571 | ||
572 | size_t s = width * height; | ||
573 | |||
574 | size_t i; | 572 | size_t i; |
575 | int x; | 573 | int x; |
576 | int y; | 574 | int y; |
@@ -614,7 +612,7 @@ void renderCrossDiagonalGradient(bool interlaced, | |||
614 | const FbTk::Color* from, const FbTk::Color* to, | 612 | const FbTk::Color* from, const FbTk::Color* to, |
615 | FbTk::ImageControl& imgctrl) { | 613 | FbTk::ImageControl& imgctrl) { |
616 | 614 | ||
617 | size_t s = width * height; | 615 | size_t s = width + height; |
618 | 616 | ||
619 | // we need 2 gradients but use only 'one' buffer | 617 | // we need 2 gradients but use only 'one' buffer |
620 | FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; | 618 | FbTk::RGBA* x_gradient = (FbTk::RGBA*)&getGradientBuffer(s * sizeof(FbTk::RGBA))[0]; |