{"id":70,"date":"2022-08-31T00:38:36","date_gmt":"2022-08-31T00:38:36","guid":{"rendered":"https:\/\/blogs.scummvm.org\/raikou\/?p=70"},"modified":"2022-08-31T00:38:36","modified_gmt":"2022-08-31T00:38:36","slug":"week-11-fixed-32bpp-text-in-buttons","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/raikou\/2022\/08\/31\/week-11-fixed-32bpp-text-in-buttons\/","title":{"rendered":"WEEK 11: Fixed 32bpp text in buttons"},"content":{"rendered":"<p>This week, I finally got to the bottom of <a href=\"https:\/\/trello.com\/c\/iVEJwuCN\/329-32bpp-rendering-buttons-have-no-text\">this<\/a> issue. I will describe the cause and the fix.<br \/>\nNow we have the MacButton widget, which inherits from MacText. Basically, we have MacText, which has a shape drawn around it, and that is MacButton for you (a cursory description). I spent time trying to find something around.<br \/>\nThe color we use for rendering text is not the one provided to the widget but the ones stored in _textLines chunks of MacText.<br \/>\nThis then led me to drawString() of Font namespace, then to drawChar(), and then to MacFONTFont::drawChar(), where the surface is filled with pixel data at relevant places.<\/p>\n<p>Now, this flow did not have the issue. It worked as expected. I checked this for anything wrong but everything till the surface population seemed correct.<br \/>\nIn the end, It turned out to be <a href=\"https:\/\/github.com\/scummvm\/scummvm\/blob\/0b7d1be2153313f680b458a86904dcac048e2e0c\/graphics\/macgui\/macwindowmanager.cpp#L1322\">this<\/a>. As you can see, values below 255 were inherently supposed to be 8bpp, and that is where the issue lied. I caught this by passing 100 and 150 as the bgcolor for the MacButton widget. When we might expect a gray color in case of 32bpp, I got green and blue. This clearly meant that it was 8bpp behaviour.<\/p>\n<p>I got around this by templating this function for 8bpp and 32bpp surfaces, as the function which calls it is also templated according to surface. The changes are <a href=\"https:\/\/github.com\/scummvm\/scummvm\/pull\/4214\">here<\/a>.<\/p>\n<p>Apart from this, I got an outline of how to implement the PopUpMenuXObj from sev, where I had some doubts regarding when to render the expanded menu list. That is something I would be completing now, along with the window optiones issue I had paused for some time earlier.<\/p>\n<p>Looking for a great week ahead \ud83d\ude00<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week, I finally got to the bottom of this issue. I will describe the cause and the fix. Now we have the MacButton widget, which inherits from MacText. Basically, we have MacText, which has a shape drawn around it, and that is MacButton for you (a cursory description). I spent time trying to find [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-70","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/raikou\/wp-json\/wp\/v2\/posts\/70","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/raikou\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/raikou\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/raikou\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/raikou\/wp-json\/wp\/v2\/comments?post=70"}],"version-history":[{"count":1,"href":"https:\/\/blogs.scummvm.org\/raikou\/wp-json\/wp\/v2\/posts\/70\/revisions"}],"predecessor-version":[{"id":71,"href":"https:\/\/blogs.scummvm.org\/raikou\/wp-json\/wp\/v2\/posts\/70\/revisions\/71"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/raikou\/wp-json\/wp\/v2\/media?parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/raikou\/wp-json\/wp\/v2\/categories?post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/raikou\/wp-json\/wp\/v2\/tags?post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}