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:
authorRichard Antalik <richardantalik@gmail.com>2021-10-16 00:02:08 +0300
committerRichard Antalik <richardantalik@gmail.com>2021-10-16 00:20:45 +0300
commite11b33fec33392640e74b9f180572fc0a504287e (patch)
treefc5528eeac6e5239b6f48e01ec7db2ba07665db0 /source/blender/imbuf/intern/imageprocess.c
parent81514b0e913b03ab7fb6aa779d23a1d651ad82b7 (diff)
Remove math for 2D affine transform
Commit e1665c3d3190 added math to do 2D affine transformations with 3x3 matrices, but these matrices are also used for 3D transformations. Remove added functions and use 4x4 matrices for 2D transformation. Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D12510
Diffstat (limited to 'source/blender/imbuf/intern/imageprocess.c')
-rw-r--r--source/blender/imbuf/intern/imageprocess.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c
index e7ad6153cd2..f01d2efa3ed 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -374,36 +374,39 @@ typedef struct TransformUserData {
rctf src_crop;
} TransformUserData;
-static void imb_transform_calc_start_uv(const float transform_matrix[3][3], float r_start_uv[2])
+static void imb_transform_calc_start_uv(const float transform_matrix[4][4], float r_start_uv[2])
{
- float orig[2];
- orig[0] = 0.0f;
- orig[1] = 0.0f;
- mul_v2_m3v2(r_start_uv, transform_matrix, orig);
+ float r_start_uv_temp[3];
+ float orig[3];
+ zero_v3(orig);
+ mul_v3_m4v3(r_start_uv_temp, transform_matrix, orig);
+ copy_v2_v2(r_start_uv, r_start_uv_temp);
}
-static void imb_transform_calc_add_x(const float transform_matrix[3][3],
+static void imb_transform_calc_add_x(const float transform_matrix[4][4],
const float start_uv[2],
const int width,
float r_add_x[2])
{
- float uv_max_x[2];
+ float uv_max_x[3];
+ zero_v3(uv_max_x);
uv_max_x[0] = width;
uv_max_x[1] = 0.0f;
- mul_v2_m3v2(r_add_x, transform_matrix, uv_max_x);
+ mul_v3_m4v3(r_add_x, transform_matrix, uv_max_x);
sub_v2_v2(r_add_x, start_uv);
mul_v2_fl(r_add_x, 1.0f / width);
}
-static void imb_transform_calc_add_y(const float transform_matrix[3][3],
+static void imb_transform_calc_add_y(const float transform_matrix[4][4],
const float start_uv[2],
const int height,
float r_add_y[2])
{
- float uv_max_y[2];
+ float uv_max_y[3];
+ zero_v3(uv_max_y);
uv_max_y[0] = 0.0f;
uv_max_y[1] = height;
- mul_v2_m3v2(r_add_y, transform_matrix, uv_max_y);
+ mul_v3_m4v3(r_add_y, transform_matrix, uv_max_y);
sub_v2_v2(r_add_y, start_uv);
mul_v2_fl(r_add_y, 1.0f / height);
}
@@ -480,7 +483,7 @@ static ScanlineThreadFunc imb_transform_scanline_func(const eIMBInterpolationFil
void IMB_transform(struct ImBuf *src,
struct ImBuf *dst,
- float transform_matrix[3][3],
+ float transform_matrix[4][4],
struct rctf *src_crop,
const eIMBInterpolationFilterMode filter)
{