Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/draw.cc2
-rw-r--r--src/render/draw.h2
-rw-r--r--src/render/tgafile.cc15
3 files changed, 9 insertions, 10 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 9e6bb5a..7d0242d 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -1344,7 +1344,7 @@ void draw(float seconds)
}
// draw HUD target world space geometry, like dock indicators
-void draw_target(core::Entity *entity)
+void draw_target(const core::Entity *entity)
{
model::Model *model = entity->model();
if (!model)
diff --git a/src/render/draw.h b/src/render/draw.h
index b13c7b0..54e8507 100644
--- a/src/render/draw.h
+++ b/src/render/draw.h
@@ -18,7 +18,7 @@ namespace render
/// draw the world
void draw(float seconds);
-void draw_target(core::Entity *entity);
+void draw_target(const core::Entity *entity);
/// reset
void reset();
diff --git a/src/render/tgafile.cc b/src/render/tgafile.cc
index db54645..10082e6 100644
--- a/src/render/tgafile.cc
+++ b/src/render/tgafile.cc
@@ -270,20 +270,20 @@ void TGA::save(const char *filename, Image & image)
pixel_data[3] = *image[index+3];
if (block_length == 0) {
+ // if the block is empty, copy the first pixel
memcpy(block_data, pixel_data, image.channels());
block_length++;
+ // by default, the block is not compressed
compress = false;
} else {
+ // if the current block is not compressed
if (!compress) {
-
- // uncompressed block and pixel_data differs from the last pixel
+ // if the previous pixel differs from the pixel data
if (memcmp(&block_data[(block_length-1)*image.channels()], pixel_data, image.channels()) != 0) {
// append pixel
memcpy(&block_data[block_length*image.channels()], pixel_data, image.channels());
-
block_length++;
} else {
-
// uncompressed block and pixel data is identical
if (block_length > 1) {
// write the uncompressed block
@@ -292,17 +292,16 @@ void TGA::save(const char *filename, Image & image)
ofs.write((char *)block_data, (block_length - 1) * image.channels());
block_length = 1;
}
+ // create a commpressed block
memcpy(block_data, pixel_data, image.channels());
block_length++;
compress = true;
}
-
+ // if the current block is compressed
} else {
-
- // compressed block and pixel data are identical
+ // if the previous pixel and the pixel data are identical
if (memcmp(block_data, pixel_data, image.channels()) == 0) {
block_length++;
-
} else {
// compressed block and pixel data differs