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-07-04 14:15:18 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-07-04 14:15:18 +0300
commitc497a7efabe73514cd051a02b0574e179b0efeb8 (patch)
tree4d51f44f1e66894b5725c48a890e6dd8e232c5fe /source/blender/editors/screen/screendump.c
parentb2e3f23bec156dfceab98032d35b761288976368 (diff)
ImBuf: add crop function (move out of screendump.c)
Diffstat (limited to 'source/blender/editors/screen/screendump.c')
-rw-r--r--source/blender/editors/screen/screendump.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index e5552314a6e..005c76d26b0 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -110,24 +110,6 @@ static void screenshot_data_free(wmOperator *op)
}
}
-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 crop_x = BLI_rcti_size_x(&crop);
- int crop_y = BLI_rcti_size_y(&crop);
- int y;
-
- 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 = crop_x;
- ibuf->y = crop_y;
- }
-}
-
static int screenshot_exec(bContext *C, wmOperator *op)
{
ScreenshotData *scd = op->customdata;
@@ -153,7 +135,8 @@ static int screenshot_exec(bContext *C, wmOperator *op)
/* crop to show only single editor */
if (!RNA_boolean_get(op->ptr, "full")) {
- screenshot_crop(ibuf, scd->crop);
+ IMB_rect_crop(ibuf, &scd->crop);
+ scd->dumprect = ibuf->rect;
}
if (scd->im_format.planes == R_IMF_PLANES_BW) {