summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2022-07-09 09:58:58 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2022-07-09 10:14:09 -0400
commit16b87600d545b7c0e8f4b6629f553eb235f19f0c (patch)
treec3e3348bcf96d3015666352cf452ce87905b580e
parenta87be5ae94148f163a7b009df3d41a26a478d800 (diff)
downloadxorg-lib-libXft-16b87600d545b7c0e8f4b6629f553eb235f19f0c.tar.gz
fix new gcc warnings
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r--src/xftfreetype.c9
-rw-r--r--src/xftglyphs.c38
2 files changed, 25 insertions, 22 deletions
diff --git a/src/xftfreetype.c b/src/xftfreetype.c
index b2e09e2..b91f8f4 100644
--- a/src/xftfreetype.c
+++ b/src/xftfreetype.c
@@ -494,10 +494,11 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
mid = 1;
while (FcPatternGetMatrix (pattern, FC_MATRIX, mid, &font_matrix) == FcResultMatch) {
FcMatrixInit(&fm1);
- fm1.xx = fi->matrix.xx / (double) 0x10000L;
- fm1.yy = fi->matrix.yy / (double) 0x10000L;
- fm1.xy = fi->matrix.xy / (double) 0x10000L;
- fm1.yx = fi->matrix.yx / (double) 0x10000L;
+#define PreScale(value) ((double) (value) / (double) 0x10000L)
+ fm1.xx = PreScale(fi->matrix.xx);
+ fm1.yy = PreScale(fi->matrix.yy);
+ fm1.xy = PreScale(fi->matrix.xy);
+ fm1.yx = PreScale(fi->matrix.yx);
FcMatrixMultiply(&fm1, font_matrix, &fm1);
fi->matrix.xx = (FT_Fixed)(0x10000L * fm1.xx);
fi->matrix.yy = (FT_Fixed)(0x10000L * fm1.yy);
diff --git a/src/xftglyphs.c b/src/xftglyphs.c
index abce48c..7f89e24 100644
--- a/src/xftglyphs.c
+++ b/src/xftglyphs.c
@@ -236,13 +236,13 @@ _compute_xrender_bitmap_size( FT_Bitmap* target,
vector.x = vector.y = 0;
FT_Vector_Transform(&vector, &inverse);
- left = vector.x;
- bottom = vector.y;
+ left = (int)vector.x;
+ bottom = (int)vector.y;
vector.x = width;
vector.y = height;
FT_Vector_Transform(&vector, &inverse);
- right = vector.x;
- top = vector.y;
+ right = (int)vector.x;
+ top = (int)vector.y;
left = (right - left) - (int)ftbit->width;
bottom = (top - bottom) - (int)ftbit->rows;
@@ -341,7 +341,7 @@ _scaled_fill_xrender_bitmap( FT_Bitmap* target,
int sample_count;
if ( src_pitch < 0 )
- src_buf -= src_pitch*(source->rows-1);
+ src_buf -= ((unsigned) src_pitch * (source->rows - 1));
/* compute how many source pixels a target pixel spans */
vector.x = 1;
@@ -350,8 +350,8 @@ _scaled_fill_xrender_bitmap( FT_Bitmap* target,
vector0.x = 0;
vector0.y = 0;
m3x3_transform(&vector0, m);
- sampling_width = (vector.x - vector0.x) / 2;
- sampling_height = (vector.y - vector0.y) / 2;
+ sampling_width = (int) ((vector.x - vector0.x) / 2);
+ sampling_height = (int) ((vector.y - vector0.y) / 2);
if (sampling_width < 0) sampling_width = -sampling_width;
if (sampling_height < 0) sampling_height = -sampling_height;
sample_count = (2 * sampling_width + 1) * (2 * sampling_height + 1);
@@ -369,9 +369,11 @@ _scaled_fill_xrender_bitmap( FT_Bitmap* target,
if (source->pixel_mode == FT_PIXEL_MODE_BGRA)
{
- if (vector.x < -sampling_width || vector.x > source->width + sampling_width)
+ if (vector.x < -sampling_width
+ || vector.x > (source->width + (unsigned) sampling_width))
continue;
- if (vector.y < -sampling_height || vector.y > source->rows + sampling_height)
+ if (vector.y < -sampling_height
+ || vector.y > (source->rows + (unsigned) sampling_height))
continue;
}
else
@@ -402,16 +404,16 @@ _scaled_fill_xrender_bitmap( FT_Bitmap* target,
for (sample_y = - sampling_height; sample_y < sampling_height + 1; ++sample_y)
{
- int src_y = vector.y + sample_y;
+ int src_y = (int) (vector.y + sample_y);
- if (src_y < 0 || src_y >= source->rows)
+ if (src_y < 0 || (FT_Pos) src_y >= source->rows)
continue;
src = src_buf + (src_y * src_pitch);
for (sample_x = - sampling_width; sample_x < sampling_width + 1; ++sample_x)
{
- int src_x = vector.x + sample_x;
+ int src_x = (int) (vector.x + sample_x);
- if (src_x < 0 || src_x >= source->width)
+ if (src_x < 0 || (FT_Pos) src_x >= source->width)
continue;
for (i = 0; i < 4; ++i)
bgra[i] += src[src_x * 4 + i];
@@ -419,7 +421,7 @@ _scaled_fill_xrender_bitmap( FT_Bitmap* target,
}
for (i = 0; i < 4; ++i)
- dst_line[4 * x + i] = bgra[i] / sample_count;
+ dst_line[4 * x + i] = (unsigned char) (bgra[i] / sample_count);
break;
}
}
@@ -1014,10 +1016,10 @@ XftFontLoadGlyphs (Display *dpy,
Pixmap pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), local.width, local.rows, 32);
GC gc = XCreateGC(dpy, pixmap, 0, NULL);
XImage image = {
- local.width, local.rows, 0, ZPixmap, (char *)bufBitmap,
+ (int) local.width, (int) local.rows, 0, ZPixmap, (char *)bufBitmap,
dpy->byte_order, dpy->bitmap_unit, dpy->bitmap_bit_order, 32,
- 32, local.width * 4 - local.pitch, 32,
- 0, 0, 0
+ 32, (int) (local.width * 4 - (unsigned) local.pitch), 32,
+ 0, 0, 0, NULL, { NULL }
};
XInitImage(&image);
@@ -1031,7 +1033,7 @@ XftFontLoadGlyphs (Display *dpy,
* pictures, and maximum for rotated pictures.
*/
if (font->info.matrix.xy || font->info.matrix.yx)
- xftg->glyph_memory += font->max_glyph_memory - size;
+ xftg->glyph_memory += font->max_glyph_memory - (unsigned long) size;
else
xftg->glyph_memory += (size_t)size * 255;
}