Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/image.cpp
| Context not available. | |||||
| void *builtin_data, | void *builtin_data, | ||||
| InterpolationType interpolation, | InterpolationType interpolation, | ||||
| ExtensionType extension, | ExtensionType extension, | ||||
| bool use_alpha) | bool use_alpha, | ||||
| AlphaMode alpha_mode) | |||||
| { | { | ||||
| return image->filename == filename && | return image->filename == filename && | ||||
| image->builtin_data == builtin_data && | image->builtin_data == builtin_data && | ||||
| image->interpolation == interpolation && | image->interpolation == interpolation && | ||||
| image->extension == extension && | image->extension == extension && | ||||
| image->use_alpha == use_alpha; | image->use_alpha == use_alpha && | ||||
| image->alpha_mode == alpha_mode; | |||||
| } | } | ||||
| int ImageManager::add_image(const string& filename, | int ImageManager::add_image(const string& filename, | ||||
| Context not available. | |||||
| InterpolationType interpolation, | InterpolationType interpolation, | ||||
| ExtensionType extension, | ExtensionType extension, | ||||
| bool use_alpha, | bool use_alpha, | ||||
| AlphaMode alpha_mode, | |||||
| ImageMetaData& metadata) | ImageMetaData& metadata) | ||||
| { | { | ||||
| Image *img; | Image *img; | ||||
| Context not available. | |||||
| builtin_data, | builtin_data, | ||||
| interpolation, | interpolation, | ||||
| extension, | extension, | ||||
| use_alpha)) | use_alpha, | ||||
| alpha_mode)) | |||||
| { | { | ||||
| if(img->frame != frame) { | if(img->frame != frame) { | ||||
| img->frame = frame; | img->frame = frame; | ||||
| img->need_load = true; | img->need_load = true; | ||||
| } | } | ||||
| //TODO redundant check? This will always be false? | |||||
| if(img->use_alpha != use_alpha) { | if(img->use_alpha != use_alpha) { | ||||
| img->use_alpha = use_alpha; | img->use_alpha = use_alpha; | ||||
| img->need_load = true; | img->need_load = true; | ||||
| } | } | ||||
| //TODO redundant check? This will always be false? | |||||
| if(img->alpha_mode != alpha_mode) { | |||||
| img->alpha_mode = alpha_mode; | |||||
| img->need_load = true; | |||||
| } | |||||
| img->users++; | img->users++; | ||||
| return type_index_to_flattened_slot(slot, type); | return type_index_to_flattened_slot(slot, type); | ||||
| } | } | ||||
| Context not available. | |||||
| img->extension = extension; | img->extension = extension; | ||||
| img->users = 1; | img->users = 1; | ||||
| img->use_alpha = use_alpha; | img->use_alpha = use_alpha; | ||||
| img->alpha_mode = alpha_mode; | |||||
| img->mem = NULL; | img->mem = NULL; | ||||
| images[type][slot] = img; | images[type][slot] = img; | ||||
| Context not available. | |||||
| void *builtin_data, | void *builtin_data, | ||||
| InterpolationType interpolation, | InterpolationType interpolation, | ||||
| ExtensionType extension, | ExtensionType extension, | ||||
| bool use_alpha) | bool use_alpha, | ||||
| AlphaMode alpha_mode) | |||||
| { | { | ||||
| size_t slot; | size_t slot; | ||||
| Context not available. | |||||
| builtin_data, | builtin_data, | ||||
| interpolation, | interpolation, | ||||
| extension, | extension, | ||||
| use_alpha)) | use_alpha, | ||||
| alpha_mode)) | |||||
| { | { | ||||
| remove_image(type_index_to_flattened_slot(slot, (ImageDataType)type)); | remove_image(type_index_to_flattened_slot(slot, (ImageDataType)type)); | ||||
| return; | return; | ||||
| Context not available. | |||||
| void *builtin_data, | void *builtin_data, | ||||
| InterpolationType interpolation, | InterpolationType interpolation, | ||||
| ExtensionType extension, | ExtensionType extension, | ||||
| bool use_alpha) | bool use_alpha, | ||||
| AlphaMode alpha_mode) | |||||
| { | { | ||||
| for(size_t type = 0; type < IMAGE_DATA_NUM_TYPES; type++) { | for(size_t type = 0; type < IMAGE_DATA_NUM_TYPES; type++) { | ||||
| for(size_t slot = 0; slot < images[type].size(); slot++) { | for(size_t slot = 0; slot < images[type].size(); slot++) { | ||||
| Context not available. | |||||
| builtin_data, | builtin_data, | ||||
| interpolation, | interpolation, | ||||
| extension, | extension, | ||||
| use_alpha)) | use_alpha, | ||||
| alpha_mode)) | |||||
| { | { | ||||
| images[type][slot]->need_load = true; | images[type][slot]->need_load = true; | ||||
| break; | break; | ||||
| Context not available. | |||||
| ImageSpec spec = ImageSpec(); | ImageSpec spec = ImageSpec(); | ||||
| ImageSpec config = ImageSpec(); | ImageSpec config = ImageSpec(); | ||||
| if(img->use_alpha == false) | if(img->use_alpha == false || img->alpha_mode == unassociated) { | ||||
| config.attribute("oiio:UnassociatedAlpha", 1); | config.attribute("oiio:UnassociatedAlpha", 1); | ||||
| } | |||||
| else if(img->alpha_mode == associated) { | |||||
| config.attribute("oiio:UnassociatedAlpha", 0); | |||||
| } | |||||
| if(!(*in)->open(img->filename, spec, config)) { | if(!(*in)->open(img->filename, spec, config)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* load image using builtin images callbacks */ | /* load image using builtin images callbacks */ | ||||
| Context not available. | |||||