From 997d7d72244911c7224775f2e4c0f62a1dcd32ef Mon Sep 17 00:00:00 2001 From: fluxgen Date: Wed, 6 Oct 2004 09:30:54 +0000 Subject: allocate red, green and blue buffers only for gradients --- src/FbTk/TextureRender.cc | 73 ++++++++++++++++++++++++++--------------------- src/FbTk/TextureRender.hh | 4 ++- 2 files changed, 43 insertions(+), 34 deletions(-) diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc index dc51d35..c278c2a 100644 --- a/src/FbTk/TextureRender.cc +++ b/src/FbTk/TextureRender.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: TextureRender.cc,v 1.11 2004/08/31 15:26:39 rathnor Exp $ +// $Id: TextureRender.cc,v 1.12 2004/10/06 09:30:54 fluxgen Exp $ #include "TextureRender.hh" @@ -49,11 +49,13 @@ TextureRender::TextureRender(ImageControl &imgctrl, control(imgctrl), colors(_colors), ncolors(ncolors), + cpc(imgctrl.colorsPerChannel()), + cpccpc(cpc * cpc), + red(0), green(0), blue(0), + width(static_cast((w > 0 ? w : 1))), height(static_cast(h > 0 ? h : 1)), xtable(0), ytable(0) { _FB_USES_NLS; - width = ((signed) w > 0) ? w : 1; - height = ((signed) h > 0) ? h : 1; // clamp to "normal" size if (width > 3200) { cerr<<"TextureRender: "<<_FBTKTEXT(Error, BigWidth, "Warning! Width > 3200 setting Width = 3200", "Image width seems too big, clamping")<bits_per_pixel + ((image->byte_order == MSBFirst) ? 1 : 0); - if (control.doDither() && width > 1 && height > 1) { + if (control.doDither()) { unsigned char dither4[4][4] = { {0, 4, 1, 5}, {6, 2, 7, 3}, @@ -564,7 +569,9 @@ XImage *TextureRender::renderXImage() { XDestroyImage(image); return (XImage *) 0; } -} else { +} else { // end do dither + + // no dither: switch (control.visual()->c_class) { case StaticColor: case PseudoColor: diff --git a/src/FbTk/TextureRender.hh b/src/FbTk/TextureRender.hh index f07a5c7..0139dcb 100644 --- a/src/FbTk/TextureRender.hh +++ b/src/FbTk/TextureRender.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: TextureRender.hh,v 1.2 2003/04/28 22:27:29 fluxgen Exp $ +// $Id: TextureRender.hh,v 1.3 2004/10/06 09:30:54 fluxgen Exp $ #ifndef FBTK_TEXTURRENDER_HH #define FBTK_TEXTURRENDER_HH @@ -54,6 +54,8 @@ public: /// scales and renders a pixmap Pixmap renderPixmap(const FbTk::Texture &src_texture); private: + /// allocates red, green and blue for gradient rendering + void allocateColorTables(); /** Render to pixmap @return rendered pixmap -- cgit v0.11.2