sync pyglet

This commit is contained in:
shenjack 2023-10-19 20:39:59 +08:00
parent b8b511dd27
commit 0b32173374
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -540,18 +540,15 @@ class _GlyphBox(_AbstractBox):
x1 = x2 x1 = x2
if background_vertices: if background_vertices:
background_indices = [] bg_count = len(background_vertices) // 3
bg_count = len(background_vertices) // 2 background_indices = [(0, 1, 2, 0, 2, 3)[i % 6] for i in range(bg_count * 3)]
decoration_program = get_default_decoration_shader() decoration_program = get_default_decoration_shader()
for bg_idx in range(bg_count): background_list = decoration_program.vertex_list_indexed(bg_count, GL_TRIANGLES, background_indices,
background_indices.extend([element + (bg_idx * 4) for element in [0, 1, 2, 0, 2, 3]])
background_list = decoration_program.vertex_list_indexed(bg_count * 4, GL_TRIANGLES, background_indices,
layout.batch, layout.background_decoration_group, layout.batch, layout.background_decoration_group,
position=('f', background_vertices), position=('f', background_vertices),
colors=('Bn', background_colors), colors=('Bn', background_colors),
rotation=('f', (rotation,) * 4), rotation=('f', (rotation,) * bg_count),
anchor=('f', (anchor_x, anchor_y) * 4)) anchor=('f', (anchor_x, anchor_y) * bg_count))
context.add_list(background_list) context.add_list(background_list)
if underline_vertices: if underline_vertices: