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>2012-08-22 00:34:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-22 00:34:05 +0400
commitc92ab5c3ef2d8339650eb95cd2ebba8c6956b62d (patch)
tree960acc2f94886377a44a7adc03d6afc9239ec640 /source/blender/editors/screen/screendump.c
parentabd031bb4eb2d2e8a1820da5a3338aa79266f6ef (diff)
code cleanup: use rect size macros
Diffstat (limited to 'source/blender/editors/screen/screendump.c')
-rw-r--r--source/blender/editors/screen/screendump.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 41e2f0b16a4..4e71c49465f 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -149,14 +149,16 @@ static void screenshot_crop(ImBuf *ibuf, rcti crop)
{
unsigned int *to = ibuf->rect;
unsigned int *from = ibuf->rect + crop.ymin * ibuf->x + crop.xmin;
- int y, cropw = crop.xmax - crop.xmin, croph = crop.ymax - crop.ymin;
+ int crop_x = BLI_RCT_SIZE_X(&crop);
+ int crop_y = BLI_RCT_SIZE_Y(&crop);
+ int y;
- if (cropw > 0 && croph > 0) {
- for (y = 0; y < croph; y++, to += cropw, from += ibuf->x)
- memmove(to, from, sizeof(unsigned int) * cropw);
+ if (crop_x > 0 && crop_y > 0) {
+ for (y = 0; y < crop_y; y++, to += crop_x, from += ibuf->x)
+ memmove(to, from, sizeof(unsigned int) * crop_x);
- ibuf->x = cropw;
- ibuf->y = croph;
+ ibuf->x = crop_x;
+ ibuf->y = crop_y;
}
}