| 2039 | } |
| 2040 | |
| 2041 | void ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel) |
| 2042 | { |
| 2043 | // Convert to RGBA32 format on demand |
| 2044 | // Although it is likely to be the most commonly used format, our font rendering is 1 channel / 8 bpp |
| 2045 | if (!TexPixelsRGBA32) |
| 2046 | { |
| 2047 | unsigned char* pixels = NULL; |
| 2048 | GetTexDataAsAlpha8(&pixels, NULL, NULL); |
| 2049 | if (pixels) |
| 2050 | { |
| 2051 | TexPixelsRGBA32 = (unsigned int*)IM_ALLOC((size_t)TexWidth * (size_t)TexHeight * 4); |
| 2052 | const unsigned char* src = pixels; |
| 2053 | unsigned int* dst = TexPixelsRGBA32; |
| 2054 | for (int n = TexWidth * TexHeight; n > 0; n--) |
| 2055 | *dst++ = IM_COL32(255, 255, 255, (unsigned int)(*src++)); |
| 2056 | } |
| 2057 | } |
| 2058 | |
| 2059 | *out_pixels = (unsigned char*)TexPixelsRGBA32; |
| 2060 | if (out_width) *out_width = TexWidth; |
| 2061 | if (out_height) *out_height = TexHeight; |
| 2062 | if (out_bytes_per_pixel) *out_bytes_per_pixel = 4; |
| 2063 | } |
| 2064 | |
| 2065 | ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg) |
| 2066 | { |
no outgoing calls
no test coverage detected