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:
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/dds/BlockDXT.cpp4
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.cpp16
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp51
3 files changed, 32 insertions, 39 deletions
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp
index 2d9c300a147..4e4fca864a0 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.cpp
+++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp
@@ -608,8 +608,8 @@ void mem_read(Stream &mem, BlockDXT1 &block)
void mem_read(Stream &mem, AlphaBlockDXT3 &block)
{
- for (unsigned int i = 0; i < 4; i++) {
- mem_read(mem, block.row[i]);
+ for (unsigned short &alpha : block.row) {
+ mem_read(mem, alpha);
}
}
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp
index 7c8b7c1d345..00fa0111d1c 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.cpp
+++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp
@@ -150,12 +150,12 @@ static inline uint8 component(Color32 c, uint i)
void ColorBlock::swizzle(uint x, uint y, uint z, uint w)
{
- for (int i = 0; i < 16; i++) {
- Color32 c = m_color[i];
- m_color[i].r = component(c, x);
- m_color[i].g = component(c, y);
- m_color[i].b = component(c, z);
- m_color[i].a = component(c, w);
+ for (Color32 &color : m_color) {
+ const Color32 c = color;
+ color.r = component(c, x);
+ color.g = component(c, y);
+ color.b = component(c, z);
+ color.a = component(c, w);
}
}
@@ -243,8 +243,8 @@ Color32 ColorBlock::averageColor() const
/** Return true if the block is not fully opaque. */
bool ColorBlock::hasAlpha() const
{
- for (uint i = 0; i < 16; i++) {
- if (m_color[i].a != 255) {
+ for (const auto &i : m_color) {
+ if (i.a != 255) {
return true;
}
}
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 087e001b0b3..12faa48c81c 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -733,8 +733,8 @@ static void imb_exr_get_views(MultiPartInputFile &file, StringVector &views)
if (exr_has_multipart_file(file) == false) {
if (exr_has_multiview(file)) {
StringVector sv = multiView(file.header(0));
- for (StringVector::const_iterator i = sv.begin(); i != sv.end(); ++i) {
- views.push_back(*i);
+ for (const std::string &view_name : sv) {
+ views.push_back(view_name);
}
}
}
@@ -991,21 +991,15 @@ int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *heig
std::vector<MultiViewChannelName> channels;
GetChannelsInMultiPartFile(*data->ifile, channels);
- for (size_t i = 0; i < channels.size(); i++) {
- IMB_exr_add_channel(data,
- nullptr,
- channels[i].name.c_str(),
- channels[i].view.c_str(),
- 0,
- 0,
- nullptr,
- false);
+ for (const MultiViewChannelName &channel : channels) {
+ IMB_exr_add_channel(
+ data, nullptr, channel.name.c_str(), channel.view.c_str(), 0, 0, nullptr, false);
echan = (ExrChannel *)data->channels.last;
- echan->m->name = channels[i].name;
- echan->m->view = channels[i].view;
- echan->m->part_number = channels[i].part_number;
- echan->m->internal_name = channels[i].internal_name;
+ echan->m->name = channel.name;
+ echan->m->view = channel.view;
+ echan->m->part_number = channel.part_number;
+ echan->m->internal_name = channel.internal_name;
}
return 1;
@@ -1311,9 +1305,8 @@ void IMB_exr_multilayer_convert(void *handle,
}
else {
/* add views to RenderResult */
- for (StringVector::const_iterator i = data->multiView->begin(); i != data->multiView->end();
- ++i) {
- addview(base, (*i).c_str());
+ for (const std::string &view_name : *data->multiView) {
+ addview(base, view_name.c_str());
}
}
@@ -1554,15 +1547,15 @@ static ExrHandle *imb_exr_begin_read_mem(IStream &file_stream,
imb_exr_get_views(*data->ifile, *data->multiView);
- for (size_t i = 0; i < channels.size(); i++) {
+ for (const MultiViewChannelName &channel : channels) {
IMB_exr_add_channel(
- data, nullptr, channels[i].name.c_str(), channels[i].view.c_str(), 0, 0, nullptr, false);
+ data, nullptr, channel.name.c_str(), channel.view.c_str(), 0, 0, nullptr, false);
echan = (ExrChannel *)data->channels.last;
- echan->m->name = channels[i].name;
- echan->m->view = channels[i].view;
- echan->m->part_number = channels[i].part_number;
- echan->m->internal_name = channels[i].internal_name;
+ echan->m->name = channel.name;
+ echan->m->view = channel.view;
+ echan->m->part_number = channel.part_number;
+ echan->m->internal_name = channel.internal_name;
}
/* now try to sort out how to assign memory to the channels */
@@ -1689,8 +1682,8 @@ static void exr_print_filecontents(MultiPartInputFile &file)
const StringVector views = multiView(file.header(0));
printf("OpenEXR-load: MultiView file\n");
printf("OpenEXR-load: Default view: %s\n", defaultViewName(views).c_str());
- for (StringVector::const_iterator i = views.begin(); i != views.end(); ++i) {
- printf("OpenEXR-load: Found view %s\n", (*i).c_str());
+ for (const std::string &view : views) {
+ printf("OpenEXR-load: Found view %s\n", view.c_str());
}
}
else if (numparts > 1) {
@@ -1835,10 +1828,10 @@ static void imb_exr_type_by_channels(ChannelList &channels,
* with non-empty ones in the file.
*/
for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); i++) {
- for (std::set<string>::iterator i = layerNames.begin(); i != layerNames.end(); i++) {
+ for (const std::string &layer_name : layerNames) {
/* see if any layername differs from a viewname */
- if (imb_exr_get_multiView_id(views, *i) == -1) {
- std::string layerName = *i;
+ if (imb_exr_get_multiView_id(views, layer_name) == -1) {
+ std::string layerName = layer_name;
size_t pos = layerName.rfind('.');
if (pos == std::string::npos) {