Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/imbuf/intern/rotate.c
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/imbuf/intern/rotate.c')
-rw-r--r--source/blender/imbuf/intern/rotate.c126
1 files changed, 65 insertions, 61 deletions
diff --git a/source/blender/imbuf/intern/rotate.c b/source/blender/imbuf/intern/rotate.c
index 277a2d0c491..2b200abc852 100644
--- a/source/blender/imbuf/intern/rotate.c
+++ b/source/blender/imbuf/intern/rotate.c
@@ -32,82 +32,86 @@
void IMB_flipy(struct ImBuf *ibuf)
{
- int x, y;
+ int x, y;
- if (ibuf == NULL) return;
+ if (ibuf == NULL)
+ return;
- if (ibuf->rect) {
- unsigned int *top, *bottom, *line;
+ if (ibuf->rect) {
+ unsigned int *top, *bottom, *line;
- x = ibuf->x;
- y = ibuf->y;
+ x = ibuf->x;
+ y = ibuf->y;
- top = ibuf->rect;
- bottom = top + ((y - 1) * x);
- line = MEM_mallocN(x * sizeof(int), "linebuf");
+ top = ibuf->rect;
+ bottom = top + ((y - 1) * x);
+ line = MEM_mallocN(x * sizeof(int), "linebuf");
- y >>= 1;
+ y >>= 1;
- for (; y > 0; y--) {
- memcpy(line, top, x * sizeof(int));
- memcpy(top, bottom, x * sizeof(int));
- memcpy(bottom, line, x * sizeof(int));
- bottom -= x;
- top += x;
- }
+ for (; y > 0; y--) {
+ memcpy(line, top, x * sizeof(int));
+ memcpy(top, bottom, x * sizeof(int));
+ memcpy(bottom, line, x * sizeof(int));
+ bottom -= x;
+ top += x;
+ }
- MEM_freeN(line);
- }
+ MEM_freeN(line);
+ }
- if (ibuf->rect_float) {
- float *topf = NULL, *bottomf = NULL, *linef = NULL;
+ if (ibuf->rect_float) {
+ float *topf = NULL, *bottomf = NULL, *linef = NULL;
- x = ibuf->x;
- y = ibuf->y;
+ x = ibuf->x;
+ y = ibuf->y;
- topf = ibuf->rect_float;
- bottomf = topf + 4 * ((y - 1) * x);
- linef = MEM_mallocN(4 * x * sizeof(float), "linebuff");
+ topf = ibuf->rect_float;
+ bottomf = topf + 4 * ((y - 1) * x);
+ linef = MEM_mallocN(4 * x * sizeof(float), "linebuff");
- y >>= 1;
+ y >>= 1;
- for (; y > 0; y--) {
- memcpy(linef, topf, 4 * x * sizeof(float));
- memcpy(topf, bottomf, 4 * x * sizeof(float));
- memcpy(bottomf, linef, 4 * x * sizeof(float));
- bottomf -= 4 * x;
- topf += 4 * x;
- }
+ for (; y > 0; y--) {
+ memcpy(linef, topf, 4 * x * sizeof(float));
+ memcpy(topf, bottomf, 4 * x * sizeof(float));
+ memcpy(bottomf, linef, 4 * x * sizeof(float));
+ bottomf -= 4 * x;
+ topf += 4 * x;
+ }
- MEM_freeN(linef);
- }
+ MEM_freeN(linef);
+ }
}
void IMB_flipx(struct ImBuf *ibuf)
{
- int x, y, xr, xl, yi;
- float px_f[4];
-
- if (ibuf == NULL) return;
-
- x = ibuf->x;
- y = ibuf->y;
-
- if (ibuf->rect) {
- for (yi = y - 1; yi >= 0; yi--) {
- for (xr = x - 1, xl = 0; xr >= xl; xr--, xl++) {
- SWAP(unsigned int, ibuf->rect[(x * yi) + xr], ibuf->rect[(x * yi) + xl]);
- }
- }
- }
-
- if (ibuf->rect_float) {
- for (yi = y - 1; yi >= 0; yi--) {
- for (xr = x - 1, xl = 0; xr >= xl; xr--, xl++) {
- memcpy(&px_f, &ibuf->rect_float[((x * yi) + xr) * 4], 4 * sizeof(float));
- memcpy(&ibuf->rect_float[((x * yi) + xr) * 4], &ibuf->rect_float[((x * yi) + xl) * 4], 4 * sizeof(float));
- memcpy(&ibuf->rect_float[((x * yi) + xl) * 4], &px_f, 4 * sizeof(float));
- }
- }
- }
+ int x, y, xr, xl, yi;
+ float px_f[4];
+
+ if (ibuf == NULL)
+ return;
+
+ x = ibuf->x;
+ y = ibuf->y;
+
+ if (ibuf->rect) {
+ for (yi = y - 1; yi >= 0; yi--) {
+ for (xr = x - 1, xl = 0; xr >= xl; xr--, xl++) {
+ SWAP(unsigned int, ibuf->rect[(x * yi) + xr], ibuf->rect[(x * yi) + xl]);
+ }
+ }
+ }
+
+ if (ibuf->rect_float) {
+ for (yi = y - 1; yi >= 0; yi--) {
+ for (xr = x - 1, xl = 0; xr >= xl; xr--, xl++) {
+ memcpy(&px_f, &ibuf->rect_float[((x * yi) + xr) * 4], 4 * sizeof(float));
+ memcpy(&ibuf->rect_float[((x * yi) + xr) * 4],
+ &ibuf->rect_float[((x * yi) + xl) * 4],
+ 4 * sizeof(float));
+ memcpy(&ibuf->rect_float[((x * yi) + xl) * 4], &px_f, 4 * sizeof(float));
+ }
+ }
+ }
}