diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 11:33:28 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 13:17:08 +0300 |
commit | f68cfd6bb078482c4a779a6e26a56e2734edb5b8 (patch) | |
tree | 2878e5b80dba5bdeba186d99661d604eb38879cd /source/blender/imbuf/intern/transform.cc | |
parent | c7b247a118e302a3afc6473797e53b6af28b69e2 (diff) |
Cleanup: replace C-style casts with functional casts for numeric types
Diffstat (limited to 'source/blender/imbuf/intern/transform.cc')
-rw-r--r-- | source/blender/imbuf/intern/transform.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/imbuf/intern/transform.cc b/source/blender/imbuf/intern/transform.cc index 276d31c0557..532652df189 100644 --- a/source/blender/imbuf/intern/transform.cc +++ b/source/blender/imbuf/intern/transform.cc @@ -165,7 +165,7 @@ class PixelPointer { public: void init_pixel_pointer(const ImBuf *image_buffer, int x, int y) { - const size_t offset = (y * (size_t)image_buffer->x + x) * NumChannels; + const size_t offset = (y * size_t(image_buffer->x) + x) * NumChannels; if constexpr (std::is_same_v<StorageType, float>) { pointer = image_buffer->rect_float + offset; @@ -235,7 +235,7 @@ class WrapRepeatUV : public BaseUVWrapping { float modify_u(const ImBuf *source_buffer, float u) override { - int x = (int)floor(u); + int x = int(floor(u)); x = x % source_buffer->x; if (x < 0) { x += source_buffer->x; @@ -245,7 +245,7 @@ class WrapRepeatUV : public BaseUVWrapping { float modify_v(const ImBuf *source_buffer, float v) override { - int y = (int)floor(v); + int y = int(floor(v)); y = y % source_buffer->y; if (y < 0) { y += source_buffer->y; @@ -349,8 +349,8 @@ class Sampler { BLI_STATIC_ASSERT(std::is_same_v<StorageType, float>); /* ImBuf in must have a valid rect or rect_float, assume this is already checked */ - int x1 = (int)(u); - int y1 = (int)(v); + int x1 = int(u); + int y1 = int(v); /* Break when sample outside image is requested. */ if (x1 < 0 || x1 >= source->x || y1 < 0 || y1 >= source->y) { @@ -360,7 +360,7 @@ class Sampler { return; } - const size_t offset = ((size_t)source->x * y1 + x1) * NumChannels; + const size_t offset = (size_t(source->x) * y1 + x1) * NumChannels; const float *dataF = source->rect_float + offset; for (int i = 0; i < NumChannels; i++) { r_sample[i] = dataF[i]; |