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:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-08-18 16:03:56 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-08-18 16:03:56 +0400
commitdc05d817eb2d37b3d65ced0fcefa96f23548d2f3 (patch)
tree8762a96a4e41a914348208eac8f17a7e9f972a3d /source/blender/imbuf/intern/scaling.c
parent6c7467e0da9cf241b1eac7dfe91e6aefe1d985ce (diff)
Correction to the mipmaps generation
Seem we've always were wrong with multiplying alpha by 255, other channels seems to be multiplied by 256 with the shift operations.
Diffstat (limited to 'source/blender/imbuf/intern/scaling.c')
-rw-r--r--source/blender/imbuf/intern/scaling.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index 40e43224f3f..e480f06da2b 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -320,7 +320,7 @@ MINLINE void straight_uchar_to_premul_ushort(unsigned short result[4], const uns
result[0] = color[0] * alpha;
result[1] = color[1] * alpha;
result[2] = color[2] * alpha;
- result[3] = alpha * 255;
+ result[3] = alpha * 256;
}
MINLINE void premul_ushort_to_straight_uchar(unsigned char *result, const unsigned short color[4])
@@ -332,11 +332,11 @@ MINLINE void premul_ushort_to_straight_uchar(unsigned char *result, const unsign
result[3] = USHORTTOUCHAR(color[3]);
}
else {
- unsigned short alpha = color[3] / 255;
+ unsigned short alpha = color[3] / 256;
- result[0] = USHORTTOUCHAR(color[0] / alpha * 255);
- result[1] = USHORTTOUCHAR(color[1] / alpha * 255);
- result[2] = USHORTTOUCHAR(color[2] / alpha * 255);
+ result[0] = USHORTTOUCHAR(color[0] / alpha * 256);
+ result[1] = USHORTTOUCHAR(color[1] / alpha * 256);
+ result[2] = USHORTTOUCHAR(color[2] / alpha * 256);
result[3] = USHORTTOUCHAR(color[3]);
}
}