From 6fb296075692b20122b1ecad53006f61e9c6939c Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Tue, 22 Feb 2011 22:33:56 +0100 Subject: moved rarely used 'cpccpc' out of class declaration --- src/FbTk/TextureRender.cc | 23 ++++++++++++----------- src/FbTk/TextureRender.hh | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc index 89a88ea..87fbd96 100644 --- a/src/FbTk/TextureRender.cc +++ b/src/FbTk/TextureRender.cc @@ -1310,7 +1310,6 @@ TextureRender::TextureRender(ImageControl &imgctrl, FbTk::Orientation orient): control(imgctrl), cpc(imgctrl.colorsPerChannel()), - cpccpc(cpc * cpc), red(0), green(0), blue(0), orientation(orient), width(w), @@ -1545,19 +1544,21 @@ XImage *TextureRender::renderXImage() { switch (control.visual()->c_class) { case StaticColor: case PseudoColor: - for (y = 0, offset = 0; y < height; y++) { - for (x = 0; x < width; x++, offset++) { - r = red_table[red[offset]]; - g = green_table[green[offset]]; - b = blue_table[blue[offset]]; + { + int cpccpc = cpc * cpc; + for (y = 0, offset = 0; y < height; y++) { + for (x = 0; x < width; x++, offset++) { + r = red_table[red[offset]]; + g = green_table[green[offset]]; + b = blue_table[blue[offset]]; + + pixel = (r * cpccpc) + (g * cpc) + b; + *pixel_data++ = control.colors()[pixel].pixel; + } - pixel = (r * cpccpc) + (g * cpc) + b; - *pixel_data++ = control.colors()[pixel].pixel; + pixel_data = (ppixel_data += image->bytes_per_line); } - - pixel_data = (ppixel_data += image->bytes_per_line); } - break; case TrueColor: diff --git a/src/FbTk/TextureRender.hh b/src/FbTk/TextureRender.hh index 7896c06..b19a606 100644 --- a/src/FbTk/TextureRender.hh +++ b/src/FbTk/TextureRender.hh @@ -68,7 +68,7 @@ private: ImageControl &control; int red_offset, green_offset, blue_offset, red_bits, green_bits, blue_bits, - cpc, cpccpc; + cpc; unsigned char *red, *green, *blue; const unsigned char *red_table, *green_table, *blue_table; Orientation orientation; -- cgit v0.11.2