Fix: IMB_scale Box filter for 2px images
Just-introduced in #126390, when source image size is just two pixels it should not advance to the third pixel after reading the first two. Was pointed out by randomly failing tests, yay tests.
This commit is contained in:
@@ -509,8 +509,10 @@ struct ScaleUpX {
|
||||
float4 val = load_pixel(src_ptr);
|
||||
float4 nval = load_pixel(src_ptr + 1);
|
||||
float4 diff = nval - val;
|
||||
src_ptr += 2;
|
||||
counter += 2;
|
||||
if (ibufx > 2) {
|
||||
src_ptr += 2;
|
||||
counter += 2;
|
||||
}
|
||||
for (int x = 0; x < newx; x++) {
|
||||
if (sample >= 1.0f) {
|
||||
sample -= 1.0f;
|
||||
@@ -558,8 +560,10 @@ struct ScaleUpY {
|
||||
float4 val = load_pixel(src_ptr);
|
||||
float4 nval = load_pixel(src_ptr + ibufx);
|
||||
float4 diff = nval - val;
|
||||
src_ptr += ibufx * 2;
|
||||
counter += 2;
|
||||
if (ibufy > 2) {
|
||||
src_ptr += ibufx * 2;
|
||||
counter += 2;
|
||||
}
|
||||
|
||||
for (int y = 0; y < newy; y++) {
|
||||
if (sample >= 1.0f) {
|
||||
|
||||
@@ -181,7 +181,10 @@ TEST(imbuf_scaling, bilinear_fractional_larger)
|
||||
EXPECT_EQ(uint4(got[7 + 0 * res->x]), uint4(52, 100, 16, 255));
|
||||
EXPECT_EQ(uint4(got[2 + 2 * res->x]), uint4(235, 55, 51, 215));
|
||||
EXPECT_EQ(uint4(got[3 + 2 * res->x]), uint4(153, 55, 35, 54));
|
||||
EXPECT_EQ(uint4(got[8 + 6 * res->x]), uint4(37, 0, 62, 162));
|
||||
EXPECT_EQ(uint4(got[8 + 5 * res->x]), uint4(57, 0, 91, 252));
|
||||
EXPECT_EQ(uint4(got[0 + 6 * res->x]), uint4(164, 164, 0, 255));
|
||||
EXPECT_EQ(uint4(got[7 + 6 * res->x]), uint4(55, 36, 57, 254));
|
||||
EXPECT_EQ(uint4(got[8 + 6 * res->x]), uint4(56, 0, 73, 253));
|
||||
IMB_freeImBuf(res);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user