From 008863daec1249d1f17bc69e1105e336db690d63 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 7 May 2010 15:18:04 +0000 Subject: Merge image related changes from the render branch. This includes the image tile cache code in imbuf, but it is not hooked up to the render engine. Imbuf module: some small refactoring and removing a lot of unused or old code (about 6.5k lines). * Added a ImFileType struct with callbacks to make adding an file format type, or making changes to the API easier. * Move imbuf init/exit code into IMB_init()/IMB_exit() functions. * Increased mipmap levels from 10 to 20, you run into this limit already with a 2k image. * Removed hamx, amiga, anim5 format support. * Removed colormap saving, only simple colormap code now for reading tga. * Removed gen_dynlibtiff.py, editing this is almost as much work as just editing the code directly. * Functions removed that were only used for sequencer plugin API: IMB_anim_nextpic, IMB_clever_double, IMB_antialias, IMB_gamwarp, IMB_scalefieldImBuf, IMB_scalefastfieldImBuf, IMB_onethird, IMB_halflace, IMB_dit0, IMB_dit2, IMB_cspace * Write metadata info into OpenEXR images. Can be viewed with the command line utility 'exrheader' For the image tile cache code, see this page: http://wiki.blender.org/index.php/Dev:2.5/Source/Imaging/ImageTileCache --- source/blender/blenlib/BLI_math_vector.h | 1 + source/blender/blenlib/BLI_path_util.h | 6 +----- source/blender/blenlib/BLI_storage.h | 3 +++ source/blender/blenlib/intern/math_vector_inline.c | 8 ++++++++ source/blender/blenlib/intern/path_util.c | 18 ++++++++++++++++++ source/blender/blenlib/intern/storage.c | 11 +++++++++++ 6 files changed, 42 insertions(+), 5 deletions(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 91e743271d2..02d5fb27dc9 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -71,6 +71,7 @@ MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f); MINLINE void mul_v2_v2(float r[2], const float a[2]); MINLINE void mul_v3_v3(float r[3], const float a[3]); MINLINE void mul_v3_v3v3(float r[3], const float a[3], const float b[3]); +MINLINE void mul_v4_fl(float r[4], float f); MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f); MINLINE void madd_v3_v3v3(float r[3], const float a[3], const float b[3]); diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 45bbd9f60a2..9bdc6c431e8 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -33,11 +33,6 @@ #ifndef BLI_UTIL_H #define BLI_UTIL_H -/* XXX doesn't seem to be used, marded for removal -#define mallocstructN(x,y,name) (x*)MEM_mallocN((y)* sizeof(x),name) -#define callocstructN(x,y,name) (x*)MEM_callocN((y)* sizeof(x),name) -*/ - struct ListBase; struct direntry; @@ -61,6 +56,7 @@ void BLI_join_dirfile(char *string, const char *dir, const char *file); int BKE_rebase_path(char *abs, int abs_size, char *rel, int rel_size, const char *base_dir, const char *src_dir, const char *dest_dir); void BLI_getlastdir(const char* dir, char *last, int maxlen); int BLI_testextensie(const char *str, const char *ext); +int BLI_replace_extension(char *path, int maxlen, const char *ext); void BLI_uniquename(struct ListBase *list, void *vlink, const char defname[], char delim, short name_offs, short len); void BLI_newname(char * name, int add); int BLI_stringdec(const char *string, char *head, char *start, unsigned short *numlen); diff --git a/source/blender/blenlib/BLI_storage.h b/source/blender/blenlib/BLI_storage.h index 61f175cb772..0d9db40fc97 100644 --- a/source/blender/blenlib/BLI_storage.h +++ b/source/blender/blenlib/BLI_storage.h @@ -76,5 +76,8 @@ struct LinkNode *BLI_read_file_as_lines(char *name); */ void BLI_free_file_lines(struct LinkNode *lines); + /* Compare if one was last modified before the other */ +int BLI_file_older(const char *file1, const char *file2); + #endif /* BLI_STORAGE_H */ diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 974832051af..fa8d1a30269 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -188,6 +188,14 @@ MINLINE void mul_v3_v3(float r[3], const float a[3]) r[2] *= a[2]; } +MINLINE void mul_v4_fl(float r[4], float f) +{ + r[0]*= f; + r[1]*= f; + r[2]*= f; + r[3]*= f; +} + MINLINE void madd_v2_v2fl(float r[2], const float a[2], float f) { r[0] += a[0]*f; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 454663df1ae..85d18d99f96 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1109,6 +1109,24 @@ int BLI_testextensie(const char *str, const char *ext) return (retval); } +int BLI_replace_extension(char *path, int maxlen, const char *ext) +{ + int a; + + for(a=strlen(path)-1; a>=0; a--) + if(path[a] == '.' || path[a] == '/' || path[a] == '\\') + break; + + if(path[a] != '.') + a= strlen(path); + + if(a + strlen(ext) >= maxlen) + return 0; + + strcpy(path+a, ext); + return 1; +} + /* Converts "/foo/bar.txt" to "/foo/" and "bar.txt" * - wont change 'string' * - wont create any directories diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index d9fea2483b9..51d5f0354f9 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -500,3 +500,14 @@ void BLI_free_file_lines(LinkNode *lines) { BLI_linklist_free(lines, (void(*)(void*)) MEM_freeN); } + +int BLI_file_older(const char *file1, const char *file2) +{ + struct stat st1, st2; + + if(stat(file1, &st1)) return 0; + if(stat(file2, &st2)) return 0; + + return (st1.st_mtime < st2.st_mtime); +} + -- cgit v1.2.3