mcst-linux-kernel/patches-2024.06.26/xorg-server-21.1.8/0047-Glamor-fix-mirrored-gl...

57 lines
2.3 KiB
Diff

Index: xorg-server-21.1.3/glamor/glamor_glyphblt.c
===================================================================
--- xorg-server-21.1.3.orig/glamor/glamor_glyphblt.c
+++ xorg-server-21.1.3/glamor/glamor_glyphblt.c
@@ -101,7 +101,11 @@ glamor_poly_glyph_blt_gl(DrawablePtr dra
int pt_x_i = glyph_x + xx;
int pt_y_i = glyph_y + yy;
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ if (!(*glyph & (128 >> (xx & 7))))
+#else
if (!(*glyph & (1 << (xx & 7))))
+#endif
continue;
if (!RegionContainsPoint(clip, pt_x_i, pt_y_i, NULL))
@@ -208,7 +212,11 @@ glamor_push_pixels_gl(GCPtr gc, PixmapPt
for (yy = 0; yy < h; yy++) {
uint8_t *bitmap_row = bitmap_data + yy * bitmap_stride;
for (xx = 0; xx < w; xx++) {
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ if (bitmap_row[xx / 8] & (128 >> xx % 8) &&
+#else
if (bitmap_row[xx / 8] & (1 << xx % 8) &&
+#endif
RegionContainsPoint(clip,
x + xx,
y + yy,
Index: xorg-server-21.1.3/glamor/glamor_text.c
===================================================================
--- xorg-server-21.1.3.orig/glamor/glamor_text.c
+++ xorg-server-21.1.3/glamor/glamor_text.c
@@ -235,7 +235,11 @@ static const char fs_vars_text[] =
static const char fs_exec_text[] =
" ivec2 itile_texture = ivec2(glyph_pos);\n"
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ " uint x = uint(7) - uint(itile_texture.x & 7);\n"
+#else
" uint x = uint(itile_texture.x & 7);\n"
+#endif
" itile_texture.x >>= 3;\n"
" uint texel = texelFetch(font, itile_texture, 0).x;\n"
" uint bit = (texel >> x) & uint(1);\n"
@@ -244,7 +248,11 @@ static const char fs_exec_text[] =
static const char fs_exec_te[] =
" ivec2 itile_texture = ivec2(glyph_pos);\n"
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ " uint x = uint(7) - uint(itile_texture.x & 7);\n"
+#else
" uint x = uint(itile_texture.x & 7);\n"
+#endif
" itile_texture.x >>= 3;\n"
" uint texel = texelFetch(font, itile_texture, 0).x;\n"
" uint bit = (texel >> x) & uint(1);\n"