[Commits] [wesnoth/wesnoth] 4523fb: Fix for unusual [theme] font_rgb attribute behavio...

GitHub noreply at github.com
Sat Mar 1 03:52:50 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 4523fb087540cca2931cc3d29b3f611f390e9109
      https://github.com/wesnoth/wesnoth/commit/4523fb087540cca2931cc3d29b3f611f390e9109
  Author: Ignacio R. Morelle <shadowm at wesnoth.org>
  Date:   2014-02-28 (Fri, 28 Feb 2014)

  Changed paths:
    M changelog
    M src/display.cpp

  Log Message:
  -----------
  Fix for unusual [theme] font_rgb attribute behavior with unit status labels

Internally, the font_rgb="RR,GG,BB" specification for theme elements is
converted and packed into an unsigned 32-bits integer using the
0x00RRGGBB layout many SDL functions expect. However, for displaying the
unit status report we use ttext (the Pango+Cairo text rendering type),
which expects a different layout: 0xRRGGBBAA. This caused unit status
labels to lack a red channel value and use the blue channel as alpha.

Since the theme UI implementation ignores the alpha value by design (it
only expects three values), force alpha to be 0xFF and shift the color
value to the left so it matches ttext's expectations.

If I had to guess where this bug came from, I'd expect it was
accidentally introduced when converting the theme sidebar to use
Pango+Cairo since the font_rgb attribute seems to have gone unused and
undocumented for years.





More information about the Commits mailing list