| 2094 | } |
| 2095 | |
| 2096 | void ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel) |
| 2097 | { |
| 2098 | // Convert to RGBA32 format on demand |
| 2099 | // Although it is likely to be the most commonly used format, our font rendering is 1 channel / 8 bpp |
| 2100 | if (!TexPixelsRGBA32) |
| 2101 | { |
| 2102 | unsigned char* pixels = NULL; |
| 2103 | GetTexDataAsAlpha8(&pixels, NULL, NULL); |
| 2104 | if (pixels) |
| 2105 | { |
| 2106 | TexPixelsRGBA32 = (unsigned int*)IM_ALLOC((size_t)TexWidth * (size_t)TexHeight * 4); |
| 2107 | const unsigned char* src = pixels; |
| 2108 | unsigned int* dst = TexPixelsRGBA32; |
| 2109 | for (int n = TexWidth * TexHeight; n > 0; n--) |
| 2110 | *dst++ = IM_COL32(255, 255, 255, (unsigned int)(*src++)); |
| 2111 | } |
| 2112 | } |
| 2113 | |
| 2114 | *out_pixels = (unsigned char*)TexPixelsRGBA32; |
| 2115 | if (out_width) *out_width = TexWidth; |
| 2116 | if (out_height) *out_height = TexHeight; |
| 2117 | if (out_bytes_per_pixel) *out_bytes_per_pixel = 4; |
| 2118 | } |
| 2119 | |
| 2120 | ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg) |
| 2121 | { |
no outgoing calls
no test coverage detected