diff options
author | Markus Ongyerth <ongy@ongy.net> | 2018-02-01 21:36:14 +0100 |
---|---|---|
committer | Markus Ongyerth <ongy@ongy.net> | 2018-02-01 21:36:14 +0100 |
commit | cd925f496c2e1f644de0ff7f79f7dce49759e769 (patch) | |
tree | 92ccab9ce3ebaa3b57c19a53d5524d1164146c28 /examples/screenshot.c | |
parent | 3a404e4f8d722bb6fbde0bdcd9a560179f9a52c6 (diff) |
fixes the off by one errors in examples/screenshot
The inverse loop iterations for the transformed outputs had an off by
one error, iterating 1 based, not 0 based. This commit fixes that.
Diffstat (limited to 'examples/screenshot.c')
-rw-r--r-- | examples/screenshot.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/screenshot.c b/examples/screenshot.c index b305e56f..7de2ab8e 100644 --- a/examples/screenshot.c +++ b/examples/screenshot.c @@ -178,7 +178,7 @@ static void write_image(const char *filename, int width, int height) { for (int i = 0; i < output->height; ++i) { for (int j = 0; j < output->width; ++j) { dst[i * width + j] = - src[i * output->width + output->width - j]; + src[i * output->width + output->width - 1 - j]; } } break; @@ -186,7 +186,7 @@ static void write_image(const char *filename, int width, int height) { for (int i = 0; i < output->width; ++i) { for (int j = 0; j < output->height; ++j) { dst[i * width + j] = - src[j * output->width + output->width - i]; + src[j * output->width + output->width - 1 - i]; } } break; @@ -194,7 +194,7 @@ static void write_image(const char *filename, int width, int height) { for (int i = 0; i < output->width; ++i) { for (int j = 0; j < output->height; ++j) { dst[i * width + j] = - src[(output->height - j) * output->width + output->width - i]; + src[(output->height - 1 - j) * output->width + output->width - 1 - i]; } } break; @@ -202,7 +202,7 @@ static void write_image(const char *filename, int width, int height) { for (int i = 0; i < output->height; ++i) { for (int j = 0; j < output->width; ++j) { dst[i * width + j] = - src[(output->height - i) * output->width + output->width - j]; + src[(output->height - 1 - i) * output->width + output->width - 1 - j]; } } break; @@ -210,7 +210,7 @@ static void write_image(const char *filename, int width, int height) { for (int i = 0; i < output->height; ++i) { for (int j = 0; j < output->width; ++j) { dst[i * width + j] = - src[(output->height - i) * output->width + j]; + src[(output->height - 1 - i) * output->width + j]; } } break; @@ -218,7 +218,7 @@ static void write_image(const char *filename, int width, int height) { for (int i = 0; i < output->width; ++i) { for (int j = 0; j < output->height; ++j) { dst[i * width + j] = - src[(output->height - j) * output->width + i]; + src[(output->height - 1 - j) * output->width + i]; } } break; |