diff options
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 6a411f8c308..d59a23c1c30 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -976,7 +976,7 @@ int BKE_imtype_to_ftype(const char imtype) return RADHDR; #endif else if (imtype == R_IMF_IMTYPE_PNG) - return PNG | 90; + return PNG | 15; #ifdef WITH_DDS else if (imtype == R_IMF_IMTYPE_DDS) return DDS; @@ -1340,7 +1340,7 @@ void BKE_imformat_defaults(ImageFormatData *im_format) im_format->imtype = R_IMF_IMTYPE_PNG; im_format->depth = R_IMF_CHAN_DEPTH_8; im_format->quality = 90; - im_format->compress = 90; + im_format->compress = 15; BKE_color_managed_display_settings_init(&im_format->display_settings); BKE_color_managed_view_settings_init(&im_format->view_settings); @@ -1636,6 +1636,9 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec /* this could be an argument if we want to operate on non linear float imbuf's * for now though this is only used for renders which use scene settings */ +#define TEXT_SIZE_CHECK(str, w, h) \ + ((str[0]) && ((void)(h = h_fixed), (w = BLF_width(mono, str, sizeof(str))))) + #define BUFF_MARGIN_X 2 #define BUFF_MARGIN_Y 1 @@ -1665,9 +1668,8 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec x = 0; y = height; - if (stamp_data.file[0]) { + if (TEXT_SIZE_CHECK(stamp_data.file, w, h)) { /* Top left corner */ - BLF_width_and_height(mono, stamp_data.file, &w, &h); h = h_fixed; y -= h; /* also a little of space to the background. */ @@ -1683,8 +1685,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec } /* Top left corner, below File */ - if (stamp_data.note[0]) { - BLF_width_and_height(mono, stamp_data.note, &w, &h); h = h_fixed; + if (TEXT_SIZE_CHECK(stamp_data.note, w, h)) { y -= h; /* and space for background. */ @@ -1699,8 +1700,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec } /* Top left corner, below File (or Note) */ - if (stamp_data.date[0]) { - BLF_width_and_height(mono, stamp_data.date, &w, &h); h = h_fixed; + if (TEXT_SIZE_CHECK(stamp_data.date, w, h)) { y -= h; /* and space for background. */ @@ -1715,8 +1715,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec } /* Top left corner, below File, Date or Note */ - if (stamp_data.rendertime[0]) { - BLF_width_and_height(mono, stamp_data.rendertime, &w, &h); h = h_fixed; + if (TEXT_SIZE_CHECK(stamp_data.rendertime, w, h)) { y -= h; /* and space for background. */ @@ -1731,8 +1730,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec y = 0; /* Bottom left corner, leaving space for timing */ - if (stamp_data.marker[0]) { - BLF_width_and_height(mono, stamp_data.marker, &w, &h); h = h_fixed; + if (TEXT_SIZE_CHECK(stamp_data.marker, w, h)) { /* extra space for background. */ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display, @@ -1747,8 +1745,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec } /* Left bottom corner */ - if (stamp_data.time[0]) { - BLF_width_and_height(mono, stamp_data.time, &w, &h); h = h_fixed; + if (TEXT_SIZE_CHECK(stamp_data.time, w, h)) { /* extra space for background */ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display, @@ -1762,8 +1759,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec x += w + pad; } - if (stamp_data.frame[0]) { - BLF_width_and_height(mono, stamp_data.frame, &w, &h); h = h_fixed; + if (TEXT_SIZE_CHECK(stamp_data.frame, w, h)) { /* extra space for background. */ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display, @@ -1777,8 +1773,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec x += w + pad; } - if (stamp_data.camera[0]) { - BLF_width_and_height(mono, stamp_data.camera, &w, &h); h = h_fixed; + if (TEXT_SIZE_CHECK(stamp_data.camera, w, h)) { /* extra space for background. */ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display, @@ -1790,8 +1785,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec x += w + pad; } - if (stamp_data.cameralens[0]) { - BLF_width_and_height(mono, stamp_data.cameralens, &w, &h); h = h_fixed; + if (TEXT_SIZE_CHECK(stamp_data.cameralens, w, h)) { /* extra space for background. */ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display, @@ -1800,8 +1794,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec BLF_draw_buffer(mono, stamp_data.cameralens); } - if (stamp_data.scene[0]) { - BLF_width_and_height(mono, stamp_data.scene, &w, &h); h = h_fixed; + if (TEXT_SIZE_CHECK(stamp_data.scene, w, h)) { /* Bottom right corner, with an extra space because blenfont is too strict! */ x = width - w - 2; @@ -1815,8 +1808,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec BLF_draw_buffer(mono, stamp_data.scene); } - if (stamp_data.strip[0]) { - BLF_width_and_height(mono, stamp_data.strip, &w, &h); h = h_fixed; + if (TEXT_SIZE_CHECK(stamp_data.strip, w, h)) { /* Top right corner, with an extra space because blenfont is too strict! */ x = width - w - pad; @@ -1833,6 +1825,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec /* cleanup the buffer. */ BLF_buffer(mono, NULL, NULL, 0, 0, 0, NULL); +#undef TEXT_SIZE_CHECK #undef BUFF_MARGIN_X #undef BUFF_MARGIN_Y } @@ -2855,7 +2848,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ return ibuf; } -static void image_get_fame_and_index(Image *ima, ImageUser *iuser, int *frame_r, int *index_r) +static void image_get_frame_and_index(Image *ima, ImageUser *iuser, int *frame_r, int *index_r) { int frame = 0, index = 0; @@ -3176,7 +3169,7 @@ ImBuf *BKE_image_pool_acquire_ibuf(Image *ima, ImageUser *iuser, ImagePool *pool return BKE_image_acquire_ibuf(ima, iuser, NULL); } - image_get_fame_and_index(ima, iuser, &frame, &index); + image_get_frame_and_index(ima, iuser, &frame, &index); ibuf = image_pool_find_entry(pool, ima, frame, index, &found); if (found) |