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