diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-09-07 17:12:26 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2019-09-12 04:13:03 +0300 |
commit | 74c447d9d78ee95e437a523b8daf72dadbdf7805 (patch) | |
tree | 813af415e2621ac0d59ea237f55056a386dff867 /source/blender/imbuf | |
parent | 95d9ec6a37f38b5cafc6613bf17104d08069110e (diff) |
Cleanup: use post increment/decrement
When the result isn't used, prefer post increment/decrement
(already used nearly everywhere in Blender).
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/intern/dds/FlipDXT.cpp | 8 | ||||
-rw-r--r-- | source/blender/imbuf/intern/indexer.c | 6 | ||||
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 16 | ||||
-rw-r--r-- | source/blender/imbuf/intern/targa.c | 4 |
4 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp index cf228cea3ea..bfd19f40493 100644 --- a/source/blender/imbuf/intern/dds/FlipDXT.cpp +++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp @@ -208,7 +208,7 @@ int FlipDXTCImage( unsigned int mip_width = width; unsigned int mip_height = height; - for (unsigned int i = 0; i < levels; ++i) { + for (unsigned int i = 0; i < levels; i++) { unsigned int blocks_per_row = (mip_width + 3) / 4; unsigned int blocks_per_col = (mip_height + 3) / 4; unsigned int blocks = blocks_per_row * blocks_per_col; @@ -219,13 +219,13 @@ int FlipDXTCImage( } else if (mip_height == 2) { // flip the first 2 lines in each block. - for (unsigned int i = 0; i < blocks_per_row; ++i) { + for (unsigned int i = 0; i < blocks_per_row; i++) { half_block_function(data + i * block_bytes); } } else { // flip each block. - for (unsigned int i = 0; i < blocks; ++i) { + for (unsigned int i = 0; i < blocks; i++) { full_block_function(data + i * block_bytes); } @@ -235,7 +235,7 @@ int FlipDXTCImage( unsigned int row_bytes = block_bytes * blocks_per_row; uint8_t *temp_line = new uint8_t[row_bytes]; - for (unsigned int y = 0; y < blocks_per_col / 2; ++y) { + for (unsigned int y = 0; y < blocks_per_col / 2; y++) { uint8_t *line1 = data + y * row_bytes; uint8_t *line2 = data + (blocks_per_col - y - 1) * row_bytes; diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index dd31dafd148..66e0a681f8f 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -1150,7 +1150,7 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, /* Don't generate the same file twice! */ if (file_list) { - for (i = 0; i < IMB_PROXY_MAX_SLOT; ++i) { + for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) { IMB_Proxy_Size proxy_size = proxy_sizes[i]; if (proxy_size & proxy_sizes_to_build) { char filename[FILE_MAX]; @@ -1172,7 +1172,7 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Proxy_Size built_proxies = IMB_anim_proxy_get_existing(anim); if (built_proxies != 0) { - for (i = 0; i < IMB_PROXY_MAX_SLOT; ++i) { + for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) { IMB_Proxy_Size proxy_size = proxy_sizes[i]; if (proxy_size & built_proxies) { char filename[FILE_MAX]; @@ -1345,7 +1345,7 @@ IMB_Proxy_Size IMB_anim_proxy_get_existing(struct anim *anim) const int num_proxy_sizes = IMB_PROXY_MAX_SLOT; IMB_Proxy_Size existing = 0; int i; - for (i = 0; i < num_proxy_sizes; ++i) { + for (i = 0; i < num_proxy_sizes; i++) { IMB_Proxy_Size proxy_size = proxy_sizes[i]; char filename[FILE_MAX]; get_proxy_filename(anim, proxy_size, filename, false); diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index f18eb2f7303..41db874c2b2 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -718,7 +718,7 @@ void IMB_exr_add_view(void *handle, const char *name) static int imb_exr_get_multiView_id(StringVector &views, const std::string &name) { int count = 0; - for (StringVector::const_iterator i = views.begin(); count < views.size(); ++i) { + for (StringVector::const_iterator i = views.begin(); count < views.size(); i++) { if (name == *i) { return count; } @@ -736,7 +736,7 @@ 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) { + for (StringVector::const_iterator i = sv.begin(); i != sv.end(); i++) { views.push_back(*i); } } @@ -1118,7 +1118,7 @@ void IMB_exr_write_channels(void *handle) if (echan->use_half_float) { float *rect = echan->rect; 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]; } half *rect_to_write = current_rect_half + (data->height - 1L) * data->width; @@ -1686,7 +1686,7 @@ 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) { + for (StringVector::const_iterator i = views.begin(); i != views.end(); i++) { printf("OpenEXR-load: Found view %s\n", (*i).c_str()); } } @@ -1701,7 +1701,7 @@ static void exr_print_filecontents(MultiPartInputFile &file) for (int j = 0; j < numparts; j++) { const ChannelList &channels = file.header(j).channels(); - for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i) { + for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); i++) { const Channel &channel = i.channel(); printf("OpenEXR-load: Found channel %s of type %d\n", i.name(), channel.type); } @@ -1713,7 +1713,7 @@ static const char *exr_rgba_channelname(MultiPartInputFile &file, const char *ch { const ChannelList &channels = file.header(0).channels(); - for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i) { + for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); i++) { /* const Channel &channel = i.channel(); */ /* Not used yet */ const char *str = i.name(); int len = strlen(str); @@ -2013,7 +2013,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem, if (!has_rgb && has_luma) { size_t a; if (exr_has_chroma(*file)) { - for (a = 0; a < (size_t)ibuf->x * ibuf->y; ++a) { + for (a = 0; a < (size_t)ibuf->x * ibuf->y; a++) { float *color = ibuf->rect_float + a * 4; ycc_to_rgb(color[0] * 255.0f, color[1] * 255.0f, @@ -2025,7 +2025,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem, } } else { - for (a = 0; a < (size_t)ibuf->x * ibuf->y; ++a) { + for (a = 0; a < (size_t)ibuf->x * ibuf->y; a++) { float *color = ibuf->rect_float + a * 4; color[1] = color[2] = color[0]; } diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index f7b7df52e46..b1077a6ae91 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -748,7 +748,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem, if (cmap) { /* apply color map */ rect = ibuf->rect; - for (size = ibuf->x * ibuf->y; size > 0; --size, ++rect) { + for (size = ibuf->x * ibuf->y; size > 0; size--, rect++) { int cmap_index = *rect; if (cmap_index >= 0 && cmap_index < cmap_max) { *rect = cmap[cmap_index]; @@ -761,7 +761,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem, if (tga.pixsize == 16) { unsigned int col; rect = ibuf->rect; - for (size = ibuf->x * ibuf->y; size > 0; --size, ++rect) { + for (size = ibuf->x * ibuf->y; size > 0; size--, rect++) { col = *rect; cp = (uchar *)rect; mem = (uchar *)&col; |