Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/openexr/openexr_api.cpp
| Show First 20 Lines • Show All 1,015 Lines • ▼ Show 20 Lines | if (data->channels.first) { | ||||
| /* We allocate teporary storage for half pixels for all the channels at once. */ | /* We allocate teporary storage for half pixels for all the channels at once. */ | ||||
| if (data->num_half_channels != 0) { | if (data->num_half_channels != 0) { | ||||
| rect_half = (half *)MEM_mallocN(sizeof(half) * data->num_half_channels * num_pixels, __func__); | rect_half = (half *)MEM_mallocN(sizeof(half) * data->num_half_channels * num_pixels, __func__); | ||||
| current_rect_half = rect_half; | current_rect_half = rect_half; | ||||
| } | } | ||||
| for (echan = (ExrChannel *)data->channels.first; echan; echan = echan->next) { | for (echan = (ExrChannel *)data->channels.first; echan; echan = echan->next) { | ||||
| /* Writting starts from last scanline, stride negative. */ | /* Writing starts from last scanline, stride negative. */ | ||||
| if (echan->use_half_float) { | if (echan->use_half_float) { | ||||
| float *rect = echan->rect; | float *rect = echan->rect; | ||||
| half *cur = current_rect_half; | half *cur = current_rect_half; | ||||
| for (size_t i = 0; i < num_pixels; ++i, ++cur) { | for (size_t i = 0; i < num_pixels; ++i, ++cur) { | ||||
| *cur = rect[i * echan->xstride]; | *cur = rect[i * echan->xstride]; | ||||
| } | } | ||||
| half *rect_to_write = current_rect_half + (data->height - 1L) * data->width; | half *rect_to_write = current_rect_half + (data->height - 1L) * data->width; | ||||
| frameBuffer.insert(echan->name, Slice(Imf::HALF, (char *)rect_to_write, | frameBuffer.insert(echan->name, Slice(Imf::HALF, (char *)rect_to_write, | ||||
| ▲ Show 20 Lines • Show All 892 Lines • Show Last 20 Lines | |||||