diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2016-05-19 22:39:22 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2016-05-19 23:57:38 +0300 |
commit | 75a31c36702239fc86081e66bcd6f27df0437e4a (patch) | |
tree | 00c17d85139b5097e6cce570fec3b5adb641451d /source/blender/blenkernel/intern/image.c | |
parent | ad14c471eb2525c2ae70cef3a7e4555dbf7ce3f3 (diff) |
Add Peak Memory as render stamp option
This commit adds Peak Memory to the stamp options, the value is the same one that is already shown in the image viewer.
Requested by @nutel.
Reviewers: campbellbarton
Subscribers: campbellbarton, nutel
Differential Revision: https://developer.blender.org/D1989
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index d4551fd0b2c..1ae7ca189fb 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1748,6 +1748,7 @@ typedef struct StampData { char scene[STAMP_NAME_SIZE]; char strip[STAMP_NAME_SIZE]; char rendertime[STAMP_NAME_SIZE]; + char memory[STAMP_NAME_SIZE]; } StampData; #undef STAMP_NAME_SIZE @@ -1869,6 +1870,13 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d else { stamp_data->rendertime[0] = '\0'; } + + if (stats && (scene->r.stamp & R_STAMP_MEMORY)) { + BLI_snprintf(stamp_data->memory, sizeof(stamp_data->memory), do_prefix ? "Peak Memory %.2fM" : "%.2fM", stats->mem_peak); + } + else { + stamp_data->memory[0] = '\0'; + } } } @@ -1943,6 +1951,12 @@ static void stampdata_from_template(StampData *stamp_data, else { stamp_data->rendertime[0] = '\0'; } + if (scene->r.stamp & R_STAMP_MEMORY) { + BLI_snprintf(stamp_data->memory, sizeof(stamp_data->memory), "Peak Memory %s", stamp_data_template->memory); + } + else { + stamp_data->memory[0] = '\0'; + } } void BKE_image_stamp_buf( @@ -2056,6 +2070,21 @@ void BKE_image_stamp_buf( } /* Top left corner, below File, Date, Rendertime */ + if (TEXT_SIZE_CHECK(stamp_data.memory, w, h)) { + y -= h; + + /* and space for background. */ + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display, + 0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y); + + BLF_position(mono, x, y + y_ofs, 0.0); + BLF_draw_buffer(mono, stamp_data.memory, BLF_DRAW_STR_DUMMY_MAX); + + /* the extra pixel for background. */ + y -= BUFF_MARGIN_Y * 2; + } + + /* Top left corner, below File, Date, Memory, Rendertime */ BLF_enable(mono, BLF_WORD_WRAP); if (TEXT_SIZE_CHECK_WORD_WRAP(stamp_data.note, w, h)) { y -= h; @@ -2219,6 +2248,7 @@ void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCall CALL(scene, "Scene"); CALL(strip, "Strip"); CALL(rendertime, "RenderTime"); + CALL(memory, "Memory"); #undef CALL } |