diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-02-20 02:52:50 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-02-26 20:13:14 +0300 |
commit | d675cf20a13ac09a55ce04d6a30105eaf87f5ebe (patch) | |
tree | b084bb14d8b97f14290be3ae2efdc04a18277444 /intern/cycles/render/image.h | |
parent | 78391def6e41f994e9089b346332c909b9ccc58a (diff) |
Cleanup: add ImageKey to avoid longer argument lists and duplicated code
Diffstat (limited to 'intern/cycles/render/image.h')
-rw-r--r-- | intern/cycles/render/image.h | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index bc04a667953..ee60390d628 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -72,38 +72,46 @@ class ImageMetaData { } }; +class ImageKey { + public: + string filename; + void *builtin_data; + bool animated; + InterpolationType interpolation; + ExtensionType extension; + ImageAlphaType alpha_type; + ustring colorspace; + + ImageKey() + : builtin_data(NULL), + animated(false), + interpolation(INTERPOLATION_LINEAR), + extension(EXTENSION_CLIP), + alpha_type(IMAGE_ALPHA_AUTO), + colorspace(u_colorspace_raw) + { + } + + bool operator==(const ImageKey &other) const + { + return (filename == other.filename && builtin_data == other.builtin_data && + animated == other.animated && interpolation == other.interpolation && + extension == other.extension && alpha_type == other.alpha_type && + colorspace == other.colorspace); + } +}; + class ImageManager { public: explicit ImageManager(const DeviceInfo &info); ~ImageManager(); - int add_image(const string &filename, - void *builtin_data, - bool animated, - float frame, - InterpolationType interpolation, - ExtensionType extension, - ImageAlphaType alpha_type, - ustring colorspace, - ImageMetaData &metadata); + int add_image(const ImageKey &key, float frame, ImageMetaData &metadata); void add_image_user(int flat_slot); void remove_image(int flat_slot); - void remove_image(const string &filename, - void *builtin_data, - InterpolationType interpolation, - ExtensionType extension, - ImageAlphaType alpha_type, - ustring colorspace); - void tag_reload_image(const string &filename, - void *builtin_data, - InterpolationType interpolation, - ExtensionType extension, - ImageAlphaType alpha_type, - ustring colorspace); - bool get_image_metadata(const string &filename, - void *builtin_data, - ustring colorspace, - ImageMetaData &metadata); + void remove_image(const ImageKey &key); + void tag_reload_image(const ImageKey &key); + bool get_image_metadata(const ImageKey &key, ImageMetaData &metadata); bool get_image_metadata(int flat_slot, ImageMetaData &metadata); void device_update(Device *device, Scene *scene, Progress &progress); @@ -146,17 +154,11 @@ class ImageManager { builtin_image_float_pixels_cb; struct Image { - string filename; - void *builtin_data; + ImageKey key; ImageMetaData metadata; - ustring colorspace; - ImageAlphaType alpha_type; - bool need_load; - bool animated; float frame; - InterpolationType interpolation; - ExtensionType extension; + bool need_load; string mem_name; device_memory *mem; |