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:
authorBrecht Van Lommel <brecht@blender.org>2022-07-14 21:16:34 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-07-15 14:40:04 +0300
commit9ea1b88f0f01a617f452d5eaa44ecbebbaa95c4e (patch)
tree87dd1c363d2e8ea17178559b6df61bf9d54fbe13 /source/blender/compositor/operations
parentb8ffd43bd28ff93c5420d8a50c2cde5a061be118 (diff)
Cleanup: add utlity function to compute render resolution
Instead of duplicating logic many times.
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.cc9
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersProg.cc4
-rw-r--r--source/blender/compositor/operations/COM_TextureOperation.cc5
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.cc4
4 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cc b/source/blender/compositor/operations/COM_CompositorOperation.cc
index e8b61ff229e..c0cc3fa1ba4 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cc
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cc
@@ -5,6 +5,7 @@
#include "BKE_global.h"
#include "BKE_image.h"
+#include "BKE_scene.h"
#include "RE_pipeline.h"
@@ -164,8 +165,8 @@ void CompositorOperation::execute_region(rcti *rect, unsigned int /*tile_number*
* Full frame
*/
- int full_width = rd->xsch * rd->size / 100;
- int full_height = rd->ysch * rd->size / 100;
+ int full_width, full_height;
+ BKE_render_resolution(rd, false, &full_width, &full_height);
dx = rd->border.xmin * full_width - (full_width - this->get_width()) / 2.0f;
dy = rd->border.ymin * full_height - (full_height - this->get_height()) / 2.0f;
@@ -214,8 +215,8 @@ void CompositorOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(outp
void CompositorOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area)
{
- int width = rd_->xsch * rd_->size / 100;
- int height = rd_->ysch * rd_->size / 100;
+ int width, height;
+ BKE_render_resolution(rd_, false, &width, &height);
/* Check actual render resolution with cropping it may differ with cropped border.rendering
* Fix for T31777 Border Crop gives black (easy). */
diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cc b/source/blender/compositor/operations/COM_RenderLayersProg.cc
index 522086658f8..40f2187b27b 100644
--- a/source/blender/compositor/operations/COM_RenderLayersProg.cc
+++ b/source/blender/compositor/operations/COM_RenderLayersProg.cc
@@ -109,8 +109,8 @@ void RenderLayersProg::execute_pixel_sampled(float output[4],
/* see comment in execute_region describing coordinate mapping,
* here it simply goes other way around
*/
- int full_width = rd->xsch * rd->size / 100;
- int full_height = rd->ysch * rd->size / 100;
+ int full_width, full_height;
+ BKE_render_resolution(rd, false, &full_width, &full_height);
dx = rd->border.xmin * full_width - (full_width - this->get_width()) / 2.0f;
dy = rd->border.ymin * full_height - (full_height - this->get_height()) / 2.0f;
diff --git a/source/blender/compositor/operations/COM_TextureOperation.cc b/source/blender/compositor/operations/COM_TextureOperation.cc
index 8b27c3aded4..c1c8db2ae3f 100644
--- a/source/blender/compositor/operations/COM_TextureOperation.cc
+++ b/source/blender/compositor/operations/COM_TextureOperation.cc
@@ -6,6 +6,7 @@
#include "BKE_image.h"
#include "BKE_node.h"
+#include "BKE_scene.h"
#include "NOD_texture.h"
@@ -59,8 +60,8 @@ void TextureBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_
{
r_area = preferred_area;
if (BLI_rcti_is_empty(&preferred_area)) {
- int width = rd_->xsch * rd_->size / 100;
- int height = rd_->ysch * rd_->size / 100;
+ int width, height;
+ BKE_render_resolution(rd_, false, &width, &height);
r_area.xmax = preferred_area.xmin + width;
r_area.ymax = preferred_area.ymin + height;
}
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc
index 58392b8a638..aeadf8f255d 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cc
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cc
@@ -104,8 +104,8 @@ void ViewerOperation::execute_region(rcti *rect, unsigned int /*tile_number*/)
void ViewerOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
{
- const int scene_render_width = rd_->xsch * rd_->size / 100;
- const int scene_render_height = rd_->ysch * rd_->size / 100;
+ int scene_render_width, scene_render_height;
+ BKE_render_resolution(rd_, false, &scene_render_width, &scene_render_height);
rcti local_preferred = preferred_area;
local_preferred.xmax = local_preferred.xmin + scene_render_width;