mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-01 19:38:03 +02:00
[ft] Fix math
This commit is contained in:
parent
9444ef09cc
commit
7d26341072
1 changed files with 2 additions and 7 deletions
|
|
@ -1252,16 +1252,11 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
|
|||
if (bitmap->num_grays != 256)
|
||||
{
|
||||
unsigned int x, y;
|
||||
unsigned int shift;
|
||||
switch (bitmap->num_grays) {
|
||||
case 4: shift = 6; break;
|
||||
case 16: shift = 4; break;
|
||||
default: shift = 0; break;
|
||||
}
|
||||
unsigned int mul = 255 / (bitmap->num_grays - 1);
|
||||
FT_Byte *p = bitmap->buffer;
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
p[x] <<= shift;
|
||||
p[x] *= mul;
|
||||
p += bitmap->pitch;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue