diff options
author | Hans Goudey <h.goudey@me.com> | 2022-06-10 11:29:35 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-06-10 11:29:35 +0300 |
commit | 6a11cd036cefd99689866ddd8f63861f9383766a (patch) | |
tree | c3ebdfc383cb77c08364c6cffab5fe6adee75a32 /source/blender/imbuf/intern | |
parent | aebca2bd652dd7434a3026882c0b6584422eb718 (diff) |
Cleanup: Clang tidy
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 10 | ||||
-rw-r--r-- | source/blender/imbuf/intern/thumbs.c | 5 | ||||
-rw-r--r-- | source/blender/imbuf/intern/transform.cc | 23 |
3 files changed, 22 insertions, 16 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 54ef5438c23..0414fa1268d 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -174,14 +174,14 @@ class IMMapStream : public Imf::IStream { imb_mmap_lock(); _mmap_file = BLI_mmap_open(file); imb_mmap_unlock(); - if (_mmap_file == NULL) { + if (_mmap_file == nullptr) { throw IEX_NAMESPACE::InputExc("BLI_mmap_open failed"); } close(file); _exrbuf = (unsigned char *)BLI_mmap_get_pointer(_mmap_file); } - ~IMMapStream() + ~IMMapStream() override { imb_mmap_lock(); BLI_mmap_free(_mmap_file); @@ -512,7 +512,7 @@ static bool imb_save_openexr_half(ImBuf *ibuf, const char *name, const int flags /* we store first everything in half array */ std::vector<RGBAZ> pixels(height * width); - RGBAZ *to = &pixels[0]; + RGBAZ *to = pixels.data(); int xstride = sizeof(RGBAZ); int ystride = xstride * width; @@ -1010,7 +1010,7 @@ void IMB_exrtile_begin_write( /* manually create ofstream, so we can handle utf-8 filepaths on windows */ try { data->ofile_stream = new OFileStream(filepath); - data->mpofile = new MultiPartOutputFile(*(data->ofile_stream), &headers[0], headers.size()); + data->mpofile = new MultiPartOutputFile(*(data->ofile_stream), headers.data(), headers.size()); } catch (const std::exception &) { delete data->mpofile; @@ -2209,7 +2209,7 @@ struct ImBuf *imb_load_filepath_thumbnail_openexr(const char *filepath, if (file->header().hasPreviewImage()) { const Imf::PreviewImage &preview = file->header().previewImage(); ImBuf *ibuf = IMB_allocFromBuffer( - (unsigned int *)preview.pixels(), NULL, preview.width(), preview.height(), 4); + (unsigned int *)preview.pixels(), nullptr, preview.width(), preview.height(), 4); delete file; delete stream; IMB_flipy(ibuf); diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index f2c9c82fa66..6f39009d38d 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -30,7 +30,6 @@ #include "IMB_thumbs.h" #include <ctype.h> -#include <stdio.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> @@ -514,7 +513,7 @@ void IMB_thumb_delete(const char *filepath, ThumbSize size) } } -ImBuf *IMB_thumb_manage(const char *org_path, ThumbSize size, ThumbSource source) +ImBuf *IMB_thumb_manage(const char *filepath, ThumbSize size, ThumbSource source) { char thumb_path[FILE_MAX]; char thumb_name[40]; @@ -526,7 +525,7 @@ ImBuf *IMB_thumb_manage(const char *org_path, ThumbSize size, ThumbSource source ImBuf *img = NULL; char *blen_group = NULL, *blen_id = NULL; - path = file_path = org_path; + path = file_path = filepath; if (source == THB_SOURCE_BLEND) { if (BLO_library_path_explode(path, path_buff, &blen_group, &blen_id)) { if (blen_group) { diff --git a/source/blender/imbuf/intern/transform.cc b/source/blender/imbuf/intern/transform.cc index edb47c8c7ce..1499c1071e3 100644 --- a/source/blender/imbuf/intern/transform.cc +++ b/source/blender/imbuf/intern/transform.cc @@ -293,30 +293,37 @@ class Sampler { NumChannels == 4) { const float wrapped_u = uv_wrapper.modify_u(source, u); const float wrapped_v = uv_wrapper.modify_v(source, v); - bilinear_interpolation_color_fl(source, nullptr, &r_sample[0], wrapped_u, wrapped_v); + bilinear_interpolation_color_fl(source, nullptr, r_sample.data(), wrapped_u, wrapped_v); } else if constexpr (Filter == IMB_FILTER_NEAREST && std::is_same_v<StorageType, unsigned char> && NumChannels == 4) { const float wrapped_u = uv_wrapper.modify_u(source, u); const float wrapped_v = uv_wrapper.modify_v(source, v); - nearest_interpolation_color_char(source, &r_sample[0], nullptr, wrapped_u, wrapped_v); + nearest_interpolation_color_char(source, r_sample.data(), nullptr, wrapped_u, wrapped_v); } else if constexpr (Filter == IMB_FILTER_BILINEAR && std::is_same_v<StorageType, unsigned char> && NumChannels == 4) { const float wrapped_u = uv_wrapper.modify_u(source, u); const float wrapped_v = uv_wrapper.modify_v(source, v); - bilinear_interpolation_color_char(source, &r_sample[0], nullptr, wrapped_u, wrapped_v); + bilinear_interpolation_color_char(source, r_sample.data(), nullptr, wrapped_u, wrapped_v); } else if constexpr (Filter == IMB_FILTER_BILINEAR && std::is_same_v<StorageType, float>) { if constexpr (std::is_same_v<UVWrapping, WrapRepeatUV>) { - BLI_bilinear_interpolation_wrap_fl( - source->rect_float, &r_sample[0], source->x, source->y, NumChannels, u, v, true, true); + BLI_bilinear_interpolation_wrap_fl(source->rect_float, + r_sample.data(), + source->x, + source->y, + NumChannels, + u, + v, + true, + true); } else { const float wrapped_u = uv_wrapper.modify_u(source, u); const float wrapped_v = uv_wrapper.modify_v(source, v); BLI_bilinear_interpolation_fl(source->rect_float, - &r_sample[0], + r_sample.data(), source->x, source->y, NumChannels, @@ -390,11 +397,11 @@ class ChannelConverter { BLI_STATIC_ASSERT(SourceNumChannels == 4, "Unsigned chars always have 4 channels."); BLI_STATIC_ASSERT(DestinationNumChannels == 4, "Unsigned chars always have 4 channels."); - copy_v4_v4_uchar(pixel_pointer.get_pointer(), &sample[0]); + copy_v4_v4_uchar(pixel_pointer.get_pointer(), sample.data()); } else if constexpr (std::is_same_v<StorageType, float> && SourceNumChannels == 4 && DestinationNumChannels == 4) { - copy_v4_v4(pixel_pointer.get_pointer(), &sample[0]); + copy_v4_v4(pixel_pointer.get_pointer(), sample.data()); } else if constexpr (std::is_same_v<StorageType, float> && SourceNumChannels == 3 && DestinationNumChannels == 4) { |