diff options
author | Kent Mein <mein@cs.umn.edu> | 2004-08-31 18:23:29 +0400 |
---|---|---|
committer | Kent Mein <mein@cs.umn.edu> | 2004-08-31 18:23:29 +0400 |
commit | 934a11e9ff430a40d88a250718bddc08e26cc065 (patch) | |
tree | 37ceb0729ab09b68422a85673545c28c15429281 /source/blender | |
parent | 0a305446a58c181d2e8f9c1d0af4c7d935117b4c (diff) |
ok my last little tweak for today ;)
I cleaned up the code a little did a couple of these:
if (blah > stuff - wah) blah = stuff - wah;
changed to....
tmp = stuff - wah;
if (blah > tmp) blah = tmp;
and combined multiple if statements
Kent
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/imbuf/intern/rectop.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index baeda999e89..60983bdff1e 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -71,6 +71,7 @@ void IMB_rectop(struct ImBuf *dbuf, int value) { unsigned int *drect,*srect; + int tmp; if (dbuf == 0) return; if (operation == 0) return; @@ -96,28 +97,31 @@ void IMB_rectop(struct ImBuf *dbuf, srcy = 0; } - if (width > dbuf->x - destx) width = dbuf->x - destx; - if (height > dbuf->y - desty) height = dbuf->y - desty; - if (sbuf){ - if (width > sbuf->x - srcx) width = sbuf->x - srcx; - if (height > sbuf->y - srcy) height = sbuf->y - srcy; - } + tmp = dbuf->x - destx; + if (width > tmp) width = tmp; + tmp = dbuf->y - desty; + if (height > tmp) height = tmp; - if (width <= 0) return; - if (height <= 0) return; + drect = dbuf->rect + desty * dbuf->x + destx; + destx = dbuf->x; - drect = dbuf->rect; - if (sbuf) srect = sbuf->rect; + if (sbuf){ + tmp = sbuf->x - srcx; + if (width > tmp) width = tmp; + tmp = sbuf->y - srcy; + if (height > tmp) height = tmp; - drect += desty * dbuf->x; - drect += destx; - destx = dbuf->x; + if (width <= 0) return; + if (height <= 0) return; - if (sbuf) { + srect = sbuf->rect; srect += srcy * sbuf->x; srect += srcx; srcx = sbuf->x; } else{ + if (width <= 0) return; + if (height <= 0) return; + srect = drect; srcx = destx; } |