[Bf-blender-cvs] [dc05d81] master: Correction to the mipmaps generation
Sergey Sharybin
noreply at git.blender.org
Mon Aug 18 14:05:00 CEST 2014
Commit: dc05d817eb2d37b3d65ced0fcefa96f23548d2f3
Author: Sergey Sharybin
Date: Mon Aug 18 18:03:56 2014 +0600
Branches: master
https://developer.blender.org/rBdc05d817eb2d37b3d65ced0fcefa96f23548d2f3
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.
===================================================================
M source/blender/imbuf/intern/scaling.c
===================================================================
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index 40e4322..e480f06 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]);
}
}
More information about the Bf-blender-cvs
mailing list