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>2015-01-24 08:48:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-01-24 09:26:59 +0300
commitd036ad552faf7e1a245d7b939cef1ddab2c5153a (patch)
tree915118ef79e7cfe0dff8a2d06e24b9ace2778ace /source/blender/blenkernel
parentfcda27cdaedfcf79607b13dbf5c6fe670e95d2ac (diff)
BKE_image: use BKE_image_*** prefix
use bools for return values and some api naming consistency.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_customdata_file.h12
-rw-r--r--source/blender/blenkernel/BKE_image.h25
-rw-r--r--source/blender/blenkernel/intern/customdata_file.c12
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c2
-rw-r--r--source/blender/blenkernel/intern/image.c39
-rw-r--r--source/blender/blenkernel/intern/ocean.c2
-rw-r--r--source/blender/blenkernel/intern/writeavi.c2
7 files changed, 52 insertions, 42 deletions
diff --git a/source/blender/blenkernel/BKE_customdata_file.h b/source/blender/blenkernel/BKE_customdata_file.h
index 978db8a6c1a..242897f968f 100644
--- a/source/blender/blenkernel/BKE_customdata_file.h
+++ b/source/blender/blenkernel/BKE_customdata_file.h
@@ -40,14 +40,14 @@ void cdf_free(CDataFile *cdf);
/* File read/write/remove */
-int cdf_read_open(CDataFile *cdf, const char *filename);
-int cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay);
-int cdf_read_data(CDataFile *cdf, unsigned int size, void *data);
+bool cdf_read_open(CDataFile *cdf, const char *filename);
+bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay);
+bool cdf_read_data(CDataFile *cdf, unsigned int size, void *data);
void cdf_read_close(CDataFile *cdf);
-int cdf_write_open(CDataFile *cdf, const char *filename);
-int cdf_write_layer(CDataFile *cdf, CDataFileLayer *blay);
-int cdf_write_data(CDataFile *cdf, unsigned int size, void *data);
+bool cdf_write_open(CDataFile *cdf, const char *filename);
+bool cdf_write_layer(CDataFile *cdf, CDataFileLayer *blay);
+bool cdf_write_data(CDataFile *cdf, unsigned int size, void *data);
void cdf_write_close(CDataFile *cdf);
void cdf_remove(const char *filename);
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index a225a27a00b..5ee8ae231d8 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -57,19 +57,25 @@ void BKE_image_free_buffers(struct Image *image);
void BKE_image_free(struct Image *image);
void BKE_imbuf_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf);
-void BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels);
+void BKE_image_stamp_buf(
+ struct Scene *scene, struct Object *camera,
+ unsigned char *rect, float *rectf, int width, int height, int channels);
bool BKE_imbuf_alpha_test(struct ImBuf *ibuf);
int BKE_imbuf_write_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
int BKE_imbuf_write(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
int BKE_imbuf_write_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const bool is_copy);
-void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame,
- const struct ImageFormatData *im_format, const bool use_ext, const bool use_frames);
-void BKE_makepicstring_from_type(char *string, const char *base, const char *relbase, int frame,
- const char imtype, const bool use_ext, const bool use_frames);
-int BKE_add_image_extension(char *string, const struct ImageFormatData *im_format);
-int BKE_add_image_extension_from_type(char *string, const char imtype);
-char BKE_ftype_to_imtype(const int ftype);
-int BKE_imtype_to_ftype(const char imtype);
+
+void BKE_image_path_from_imformat(
+ char *string, const char *base, const char *relbase, int frame,
+ const struct ImageFormatData *im_format, const bool use_ext, const bool use_frames);
+void BKE_image_path_from_imtype(
+ char *string, const char *base, const char *relbase, int frame,
+ const char imtype, const bool use_ext, const bool use_frames);
+
+bool BKE_image_path_ensure_ext_from_imformat(char *string, const struct ImageFormatData *im_format);
+bool BKE_image_path_ensure_ext_from_imtype(char *string, const char imtype);
+char BKE_image_ftype_to_imtype(const int ftype);
+int BKE_image_imtype_to_ftype(const char imtype);
bool BKE_imtype_is_movie(const char imtype);
int BKE_imtype_supports_zbuf(const char imtype);
@@ -91,7 +97,6 @@ void BKE_image_de_interlace(struct Image *ima, int odd);
void BKE_image_make_local(struct Image *ima);
void BKE_image_tag_time(struct Image *ima);
-void free_old_images(void);
/* ********************************** NEW IMAGE API *********************** */
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index c72eea50e40..97972cca30c 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -276,7 +276,7 @@ static int cdf_write_header(CDataFile *cdf)
return 1;
}
-int cdf_read_open(CDataFile *cdf, const char *filename)
+bool cdf_read_open(CDataFile *cdf, const char *filename)
{
FILE *f;
@@ -299,7 +299,7 @@ int cdf_read_open(CDataFile *cdf, const char *filename)
return 1;
}
-int cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay)
+bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay)
{
size_t offset;
int a;
@@ -316,7 +316,7 @@ int cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay)
return (fseek(cdf->readf, offset, SEEK_SET) == 0);
}
-int cdf_read_data(CDataFile *cdf, unsigned int size, void *data)
+bool cdf_read_data(CDataFile *cdf, unsigned int size, void *data)
{
/* read data */
if (!fread(data, size, 1, cdf->readf))
@@ -338,7 +338,7 @@ void cdf_read_close(CDataFile *cdf)
}
}
-int cdf_write_open(CDataFile *cdf, const char *filename)
+bool cdf_write_open(CDataFile *cdf, const char *filename)
{
CDataFileHeader *header;
CDataFileImageHeader *image;
@@ -380,12 +380,12 @@ int cdf_write_open(CDataFile *cdf, const char *filename)
return 1;
}
-int cdf_write_layer(CDataFile *UNUSED(cdf), CDataFileLayer *UNUSED(blay))
+bool cdf_write_layer(CDataFile *UNUSED(cdf), CDataFileLayer *UNUSED(blay))
{
return 1;
}
-int cdf_write_data(CDataFile *cdf, unsigned int size, void *data)
+bool cdf_write_data(CDataFile *cdf, unsigned int size, void *data)
{
/* write data */
if (!fwrite(data, size, 1, cdf->writef))
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index e3fa4733e6c..3541b3fba3f 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -2705,7 +2705,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam
if (format == R_IMF_IMTYPE_OPENEXR) format = R_IMF_IMTYPE_PNG;
#endif
BLI_strncpy(output_file, filename, sizeof(output_file));
- BKE_add_image_extension_from_type(output_file, format);
+ BKE_image_path_ensure_ext_from_imtype(output_file, format);
/* Validate output file path */
BLI_path_abs(output_file, G.main->name);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 870c077ff78..27165042cb2 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1011,7 +1011,7 @@ void BKE_image_all_free_anim_ibufs(int cfra)
/* *********** READ AND WRITE ************** */
-int BKE_imtype_to_ftype(const char imtype)
+int BKE_image_imtype_to_ftype(const char imtype)
{
if (imtype == R_IMF_IMTYPE_TARGA)
return TGA;
@@ -1051,7 +1051,7 @@ int BKE_imtype_to_ftype(const char imtype)
return JPG | 90;
}
-char BKE_ftype_to_imtype(const int ftype)
+char BKE_image_ftype_to_imtype(const int ftype)
{
if (ftype == 0)
return R_IMF_IMTYPE_TARGA;
@@ -1258,7 +1258,7 @@ char BKE_imtype_from_arg(const char *imtype_arg)
else return R_IMF_IMTYPE_INVALID;
}
-static bool do_add_image_extension(char *string, const char imtype, const ImageFormatData *im_format)
+static bool image_path_ensure_ext(char *string, const char imtype, const ImageFormatData *im_format)
{
const char *extension = NULL;
const char *extension_test;
@@ -1368,14 +1368,14 @@ static bool do_add_image_extension(char *string, const char imtype, const ImageF
}
}
-int BKE_add_image_extension(char *string, const ImageFormatData *im_format)
+bool BKE_image_path_ensure_ext_from_imformat(char *string, const ImageFormatData *im_format)
{
- return do_add_image_extension(string, im_format->imtype, im_format);
+ return image_path_ensure_ext(string, im_format->imtype, im_format);
}
-int BKE_add_image_extension_from_type(char *string, const char imtype)
+bool BKE_image_path_ensure_ext_from_imtype(char *string, const char imtype)
{
- return do_add_image_extension(string, imtype, NULL);
+ return image_path_ensure_ext(string, imtype, NULL);
}
void BKE_imformat_defaults(ImageFormatData *im_format)
@@ -1651,7 +1651,9 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
}
}
-void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels)
+void BKE_image_stamp_buf(
+ Scene *scene, Object *camera,
+ unsigned char *rect, float *rectf, int width, int height, int channels)
{
struct StampData stamp_data;
float w, h, pad;
@@ -2076,8 +2078,9 @@ int BKE_imbuf_write_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, cons
}
-static void do_makepicstring(char *string, const char *base, const char *relbase, int frame, const char imtype,
- const ImageFormatData *im_format, const short use_ext, const short use_frames)
+static void image_path_makepicstring(
+ char *string, const char *base, const char *relbase, int frame, const char imtype,
+ const ImageFormatData *im_format, const short use_ext, const short use_frames)
{
if (string == NULL) return;
BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */
@@ -2087,19 +2090,21 @@ static void do_makepicstring(char *string, const char *base, const char *relbase
BLI_path_frame(string, frame, 4);
if (use_ext)
- do_add_image_extension(string, imtype, im_format);
+ image_path_ensure_ext(string, imtype, im_format);
}
-void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame,
- const ImageFormatData *im_format, const bool use_ext, const bool use_frames)
+void BKE_image_path_from_imformat(
+ char *string, const char *base, const char *relbase, int frame,
+ const ImageFormatData *im_format, const bool use_ext, const bool use_frames)
{
- do_makepicstring(string, base, relbase, frame, im_format->imtype, im_format, use_ext, use_frames);
+ image_path_makepicstring(string, base, relbase, frame, im_format->imtype, im_format, use_ext, use_frames);
}
-void BKE_makepicstring_from_type(char *string, const char *base, const char *relbase, int frame,
- const char imtype, const bool use_ext, const bool use_frames)
+void BKE_image_path_from_imtype(
+ char *string, const char *base, const char *relbase, int frame,
+ const char imtype, const bool use_ext, const bool use_frames)
{
- do_makepicstring(string, base, relbase, frame, imtype, NULL, use_ext, use_frames);
+ image_path_makepicstring(string, base, relbase, frame, imtype, NULL, use_ext, use_frames);
}
/* used by sequencer too */
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 373ad34e7bd..12e82d3a34f 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -1002,7 +1002,7 @@ static void cache_filename(char *string, const char *path, const char *relbase,
BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname);
- BKE_makepicstring_from_type(string, cachepath, relbase, frame, R_IMF_IMTYPE_OPENEXR, true, true);
+ BKE_image_path_from_imtype(string, cachepath, relbase, frame, R_IMF_IMTYPE_OPENEXR, true, true);
}
/* silly functions but useful to inline when the args do a lot of indirections */
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index 8a6a0438b84..85eac1f21ed 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -253,7 +253,7 @@ static void end_avi(void)
}
#endif /* WITH_AVI */
-/* similar to BKE_makepicstring() */
+/* similar to BKE_image_path_from_imformat() */
void BKE_movie_filepath_get(char *string, RenderData *rd)
{
bMovieHandle *mh = BKE_movie_handle_get(rd->im_format.imtype);