diff options
Diffstat (limited to 'src/render/image.cc')
-rw-r--r-- | src/render/image.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/render/image.cc b/src/render/image.cc index 196eec9..98898ef 100644 --- a/src/render/image.cc +++ b/src/render/image.cc @@ -1,7 +1,7 @@ /* render/image.cc - This file is part of the Osirion project and is distributed under - the terms of the GNU General Public License version 2 + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 */ #include <stdlib.h> @@ -9,7 +9,7 @@ #include "render/image.h" -namespace render +namespace render { Image::Image(unsigned int width, unsigned int height, unsigned int channels) @@ -34,7 +34,7 @@ void Image::clear() void Image::swap_channels() { - for (size_t y =0; y < image_height; y++) { + for (size_t y = 0; y < image_height; y++) { for (size_t x = 0; x < image_width; x++) { size_t offset = y * image_width * image_channels + x * image_channels; unsigned char tmp = image_data[offset]; @@ -52,7 +52,7 @@ void Image::pad() if ((w % 8) != 0) { image_width = w + (8 - (w % 8)); } - + if ((w % 8) != 0) { image_height = h + (8 - (h % 8)); } @@ -60,9 +60,9 @@ void Image::pad() unsigned char *image_new = (unsigned char *) malloc(size()); memset(image_new, 0, size()); - for (size_t y =0; y < h; y++) { + for (size_t y = 0; y < h; y++) { memcpy((void *)&image_new[y * image_width * image_channels], - (void *)&image_data[y * w * image_channels], (size_t) w); + (void *)&image_data[y * w * image_channels], (size_t) w); } free(image_data); @@ -72,16 +72,16 @@ void Image::pad() void Image::flip() { unsigned char line[image_width*image_channels]; - for (size_t y=0; y < image_height /2; y++) { + for (size_t y = 0; y < image_height / 2; y++) { memcpy(line, - &image_data[y*image_width*image_channels], - image_width*image_channels); + &image_data[y*image_width*image_channels], + image_width*image_channels); memcpy(&image_data[y*image_width*image_channels], - &image_data[(image_height-1-y)*image_width*image_channels], - image_width*image_channels); + &image_data[(image_height-1-y)*image_width*image_channels], + image_width*image_channels); memcpy(&image_data[(image_height-1-y)*image_width*image_channels], - line, - image_width*image_channels); + line, + image_width*image_channels); } } |