font: set alpha to 0xff in rasterizer
Since fonts now use dual source blending, the pixel colors are interpreted as individual alpha channels. The A component should be set to 1.0, so that's what we do here. refs: #1025
This commit is contained in:
1 parent
311bd78902
commit
18ddf38174
1 file changed
+2
-4
@@ -124,7 +124,6 @@ impl FreeTypeRasterizer {
|
||||
let dest_offset = y * width * 4;
|
||||
for x in 0..width {
|
||||
let linear_gray = data[src_offset + x];
|
||||
|
||||
let gray = linear_u8_to_srgb8(linear_gray);
|
||||
|
||||
// Texture is SRGBA, which in OpenGL means
|
||||
@@ -135,7 +134,7 @@ impl FreeTypeRasterizer {
|
||||
rgba[dest_offset + (x * 4)] = gray;
|
||||
rgba[dest_offset + (x * 4) + 1] = gray;
|
||||
rgba[dest_offset + (x * 4) + 2] = gray;
|
||||
rgba[dest_offset + (x * 4) + 3] = linear_gray;
|
||||
rgba[dest_offset + (x * 4) + 3] = 0xff;
|
||||
}
|
||||
}
|
||||
RasterizedGlyph {
|
||||
@@ -165,7 +164,6 @@ impl FreeTypeRasterizer {
|
||||
let red = data[src_offset + (x * 3)];
|
||||
let green = data[src_offset + (x * 3) + 1];
|
||||
let blue = data[src_offset + (x * 3) + 2];
|
||||
let alpha = red.max(green).max(blue);
|
||||
|
||||
// Texture is SRGBA, which in OpenGL means
|
||||
// that the RGB values are gamma adjusted
|
||||
@@ -179,7 +177,7 @@ impl FreeTypeRasterizer {
|
||||
rgba[dest_offset + (x * 4)] = red;
|
||||
rgba[dest_offset + (x * 4) + 1] = green;
|
||||
rgba[dest_offset + (x * 4) + 2] = blue;
|
||||
rgba[dest_offset + (x * 4) + 3] = alpha;
|
||||
rgba[dest_offset + (x * 4) + 3] = 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user