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:
authorCampbell Barton <campbell@blender.org>2022-09-25 11:33:28 +0300
committerCampbell Barton <campbell@blender.org>2022-09-25 13:17:08 +0300
commitf68cfd6bb078482c4a779a6e26a56e2734edb5b8 (patch)
tree2878e5b80dba5bdeba186d99661d604eb38879cd /source/blender/compositor/intern
parentc7b247a118e302a3afc6473797e53b6af28b69e2 (diff)
Cleanup: replace C-style casts with functional casts for numeric types
Diffstat (limited to 'source/blender/compositor/intern')
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrderHotspot.cc4
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.cc20
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.cc8
-rw-r--r--source/blender/compositor/intern/COM_OpenCLDevice.cc4
-rw-r--r--source/blender/compositor/intern/COM_compositor.cc6
5 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/compositor/intern/COM_ChunkOrderHotspot.cc b/source/blender/compositor/intern/COM_ChunkOrderHotspot.cc
index b9179c0a910..5b9d2fa2797 100644
--- a/source/blender/compositor/intern/COM_ChunkOrderHotspot.cc
+++ b/source/blender/compositor/intern/COM_ChunkOrderHotspot.cc
@@ -10,8 +10,8 @@ double ChunkOrderHotspot::calc_distance(int x, int y)
{
int dx = this->x - x;
int dy = this->y - y;
- double result = sqrt((double)(dx * dx + dy * dy));
- result += (double)this->addition;
+ double result = sqrt(double(dx * dx + dy * dy));
+ result += double(this->addition);
return result;
}
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc
index 9b4c46654f2..c9002b535ed 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cc
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc
@@ -436,8 +436,8 @@ inline void ExecutionGroup::determine_chunk_rect(rcti *r_rect,
else {
const uint minx = x_chunk * chunk_size_ + viewer_border_.xmin;
const uint miny = y_chunk * chunk_size_ + viewer_border_.ymin;
- const uint width = MIN2((uint)viewer_border_.xmax, width_);
- const uint height = MIN2((uint)viewer_border_.ymax, height_);
+ const uint width = MIN2(uint(viewer_border_.xmax), width_);
+ const uint height = MIN2(uint(viewer_border_.ymax), height_);
BLI_rcti_init(r_rect,
MIN2(minx, width_),
MIN2(minx + chunk_size_, width),
@@ -480,14 +480,14 @@ bool ExecutionGroup::schedule_area_when_possible(ExecutionSystem *graph, rcti *a
int maxx = min_ii(area->xmax - viewer_border_.xmin, viewer_border_.xmax - viewer_border_.xmin);
int miny = max_ii(area->ymin - viewer_border_.ymin, 0);
int maxy = min_ii(area->ymax - viewer_border_.ymin, viewer_border_.ymax - viewer_border_.ymin);
- int minxchunk = minx / (int)chunk_size_;
- int maxxchunk = (maxx + (int)chunk_size_ - 1) / (int)chunk_size_;
- int minychunk = miny / (int)chunk_size_;
- int maxychunk = (maxy + (int)chunk_size_ - 1) / (int)chunk_size_;
+ int minxchunk = minx / int(chunk_size_);
+ int maxxchunk = (maxx + int(chunk_size_) - 1) / int(chunk_size_);
+ int minychunk = miny / int(chunk_size_);
+ int maxychunk = (maxy + int(chunk_size_) - 1) / int(chunk_size_);
minxchunk = max_ii(minxchunk, 0);
minychunk = max_ii(minychunk, 0);
- maxxchunk = min_ii(maxxchunk, (int)x_chunks_len_);
- maxychunk = min_ii(maxychunk, (int)y_chunks_len_);
+ maxxchunk = min_ii(maxxchunk, int(x_chunks_len_));
+ maxychunk = min_ii(maxychunk, int(y_chunks_len_));
bool result = true;
for (indexx = minxchunk; indexx < maxxchunk; indexx++) {
@@ -516,10 +516,10 @@ bool ExecutionGroup::schedule_chunk_when_possible(ExecutionSystem *graph,
const int chunk_x,
const int chunk_y)
{
- if (chunk_x < 0 || chunk_x >= (int)x_chunks_len_) {
+ if (chunk_x < 0 || chunk_x >= int(x_chunks_len_)) {
return true;
}
- if (chunk_y < 0 || chunk_y >= (int)y_chunks_len_) {
+ if (chunk_y < 0 || chunk_y >= int(y_chunks_len_)) {
return true;
}
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc b/source/blender/compositor/intern/COM_MemoryBuffer.cc
index 95bb233ff6c..539e1179bc8 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cc
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc
@@ -266,7 +266,7 @@ void MemoryBuffer::copy_from(const uchar *src,
const float *row_end = to_elem + width * this->elem_stride;
while (to_elem < row_end) {
for (int i = 0; i < elem_size; i++) {
- to_elem[i] = ((float)from_elem[i]) * (1.0f / 255.0f);
+ to_elem[i] = float(from_elem[i]) * (1.0f / 255.0f);
}
to_elem += this->elem_stride;
from_elem += elem_stride;
@@ -427,7 +427,7 @@ void MemoryBuffer::read_elem_filtered(
const float deriv[2][2] = {{dx[0], dx[1]}, {dy[0], dy[1]}};
- float inv_width = 1.0f / (float)this->get_width(), inv_height = 1.0f / (float)this->get_height();
+ float inv_width = 1.0f / float(this->get_width()), inv_height = 1.0f / float(this->get_height());
/* TODO(sergey): Render pipeline uses normalized coordinates and derivatives,
* but compositor uses pixel space. For now let's just divide the values and
* switch compositor to normalized space for EWA later.
@@ -463,8 +463,8 @@ void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivat
}
else {
BLI_assert(datatype_ == DataType::Color);
- float inv_width = 1.0f / (float)this->get_width(),
- inv_height = 1.0f / (float)this->get_height();
+ float inv_width = 1.0f / float(this->get_width()),
+ inv_height = 1.0f / float(this->get_height());
/* TODO(sergey): Render pipeline uses normalized coordinates and derivatives,
* but compositor uses pixel space. For now let's just divide the values and
* switch compositor to normalized space for EWA later.
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cc b/source/blender/compositor/intern/COM_OpenCLDevice.cc
index 5d5751944b2..188389b88c9 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.cc
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.cc
@@ -187,8 +187,8 @@ void OpenCLDevice::COM_cl_enqueue_range(cl_kernel kernel, MemoryBuffer *output_m
{
cl_int error;
const size_t size[] = {
- (size_t)output_memory_buffer->get_width(),
- (size_t)output_memory_buffer->get_height(),
+ size_t(output_memory_buffer->get_width()),
+ size_t(output_memory_buffer->get_height()),
};
error = clEnqueueNDRangeKernel(queue_, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr);
diff --git a/source/blender/compositor/intern/COM_compositor.cc b/source/blender/compositor/intern/COM_compositor.cc
index 519ad93bcaf..1ffc749ce64 100644
--- a/source/blender/compositor/intern/COM_compositor.cc
+++ b/source/blender/compositor/intern/COM_compositor.cc
@@ -25,15 +25,15 @@ static void compositor_init_node_previews(const RenderData *render_data, bNodeTr
/* We fit the aspect into COM_PREVIEW_SIZE x COM_PREVIEW_SIZE image to avoid
* insane preview resolution, which might even overflow preview dimensions. */
const float aspect = render_data->xsch > 0 ?
- (float)render_data->ysch / (float)render_data->xsch :
+ float(render_data->ysch) / float(render_data->xsch) :
1.0f;
int preview_width, preview_height;
if (aspect < 1.0f) {
preview_width = blender::compositor::COM_PREVIEW_SIZE;
- preview_height = (int)(blender::compositor::COM_PREVIEW_SIZE * aspect);
+ preview_height = int(blender::compositor::COM_PREVIEW_SIZE * aspect);
}
else {
- preview_width = (int)(blender::compositor::COM_PREVIEW_SIZE / aspect);
+ preview_width = int(blender::compositor::COM_PREVIEW_SIZE / aspect);
preview_height = blender::compositor::COM_PREVIEW_SIZE;
}
BKE_node_preview_init_tree(node_tree, preview_width, preview_height);