[Bf-blender-cvs] [66df8fff328] blender-v2.90-release: Compositor: Fix calculation of preview resolution

Sergey Sharybin noreply at git.blender.org
Wed Jul 29 17:18:53 CEST 2020


Commit: 66df8fff328079615dfa222eb7409826a785d6a9
Author: Sergey Sharybin
Date:   Fri Jul 10 11:31:16 2020 +0200
Branches: blender-v2.90-release
https://developer.blender.org/rB66df8fff328079615dfa222eb7409826a785d6a9

Compositor: Fix calculation of preview resolution

Were two issues:

- Divider was calculated in integer domain, causing rounding issues in
  general case, and causing singularity in a corner case when input is
  smaller than the preview size.

- The resolution was scaled down by 1 pixel for no obvious reason.

===================================================================

M	source/blender/compositor/operations/COM_PreviewOperation.cpp

===================================================================

diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp
index 30fe2ca824d..07bf534cd74 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.cpp
+++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp
@@ -130,10 +130,10 @@ void PreviewOperation::determineResolution(unsigned int resolution[2],
   int height = resolution[1];
   this->m_divider = 0.0f;
   if (width > height) {
-    this->m_divider = COM_PREVIEW_SIZE / (width - 1);
+    this->m_divider = (float)COM_PREVIEW_SIZE / (width);
   }
   else {
-    this->m_divider = COM_PREVIEW_SIZE / (height - 1);
+    this->m_divider = (float)COM_PREVIEW_SIZE / (height);
   }
   width = width * this->m_divider;
   height = height * this->m_divider;



More information about the Bf-blender-cvs mailing list