diff options
author | Ton Roosendaal <ton@blender.org> | 2011-01-04 17:37:21 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-01-04 17:37:21 +0300 |
commit | 8b1bfbcfea8af306dbf42743b5f67d46159015c5 (patch) | |
tree | 8e0b3b9a2b193b679ffa0048dfacc7369481c169 /source/blender/editors/screen | |
parent | c2bc82c9fcd14bcaec14e54c867757baa45b52d6 (diff) |
Todo items:
- File Window: when opened with operator (save, load, etc), you
couldn't start a new one, causing memleaks. Now it nicely
refreshes file window for new operator.
Also means you can make CTRL+F3 screenies of filewindow now.
- CTRL+F3 screenshot had memleak on cancel.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/area.c | 6 | ||||
-rw-r--r-- | source/blender/editors/screen/screendump.c | 53 |
2 files changed, 38 insertions, 21 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index fd8afd63bb8..c482ba4a9e8 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1103,10 +1103,12 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type) /*send space change notifyer*/ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, sa); - - ED_area_tag_redraw(sa); + ED_area_tag_refresh(sa); } + + /* also redraw when re-used */ + ED_area_tag_redraw(sa); } void ED_area_prevspace(bContext *C, ScrArea *sa) diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index a536b4ea1a4..d4235a09d37 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -70,29 +70,31 @@ static int screenshot_exec(bContext *C, wmOperator *op) { ScreenshotData *scd= op->customdata; - if(scd && scd->dumprect) { - Scene *scene= CTX_data_scene(C); - ImBuf *ibuf; - char path[FILE_MAX]; - - RNA_string_get(op->ptr, "filepath", path); - - strcpy(G.ima, path); - BLI_path_abs(path, G.main->name); + if(scd) { + if(scd->dumprect) { + Scene *scene= CTX_data_scene(C); + ImBuf *ibuf; + char path[FILE_MAX]; - /* BKE_add_image_extension() checks for if extension was already set */ - if(scene->r.scemode & R_EXTENSION) - if(strlen(path)<FILE_MAXDIR+FILE_MAXFILE-5) - BKE_add_image_extension(path, scene->r.imtype); + RNA_string_get(op->ptr, "filepath", path); - ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0); - ibuf->rect= scd->dumprect; - - BKE_write_ibuf(scene, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality); + strcpy(G.ima, path); + BLI_path_abs(path, G.main->name); + + /* BKE_add_image_extension() checks for if extension was already set */ + if(scene->r.scemode & R_EXTENSION) + if(strlen(path)<FILE_MAXDIR+FILE_MAXFILE-5) + BKE_add_image_extension(path, scene->r.imtype); + + ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0); + ibuf->rect= scd->dumprect; + + BKE_write_ibuf(scene, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality); - IMB_freeImBuf(ibuf); + IMB_freeImBuf(ibuf); - MEM_freeN(scd->dumprect); + MEM_freeN(scd->dumprect); + } MEM_freeN(scd); op->customdata= NULL; } @@ -159,6 +161,18 @@ static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event) return OPERATOR_CANCELLED; } +static int screenshot_cancel(bContext *UNUSED(C), wmOperator *op) +{ + ScreenshotData *scd= op->customdata; + + if(scd) { + if(scd->dumprect) + MEM_freeN(scd->dumprect); + MEM_freeN(scd); + op->customdata= NULL; + } + return OPERATOR_CANCELLED; +} void SCREEN_OT_screenshot(wmOperatorType *ot) { @@ -168,6 +182,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot) ot->invoke= screenshot_invoke; ot->exec= screenshot_exec; ot->poll= WM_operator_winactive; + ot->cancel= screenshot_cancel; ot->flag= 0; |