Queue texture block update for renderer backend
| 2940 | |
| 2941 | // Queue texture block update for renderer backend |
| 2942 | void ImFontAtlasTextureBlockQueueUpload(ImFontAtlas* atlas, ImTextureData* tex, int x, int y, int w, int h) |
| 2943 | { |
| 2944 | IM_ASSERT(tex->Status != ImTextureStatus_WantDestroy && tex->Status != ImTextureStatus_Destroyed); |
| 2945 | IM_ASSERT(x >= 0 && x <= 0xFFFF && y >= 0 && y <= 0xFFFF && w >= 0 && x + w <= 0x10000 && h >= 0 && y + h <= 0x10000); |
| 2946 | IM_UNUSED(atlas); |
| 2947 | |
| 2948 | ImTextureRect req = { (unsigned short)x, (unsigned short)y, (unsigned short)w, (unsigned short)h }; |
| 2949 | int new_x1 = ImMax(tex->UpdateRect.w == 0 ? 0 : tex->UpdateRect.x + tex->UpdateRect.w, req.x + req.w); |
| 2950 | int new_y1 = ImMax(tex->UpdateRect.h == 0 ? 0 : tex->UpdateRect.y + tex->UpdateRect.h, req.y + req.h); |
| 2951 | tex->UpdateRect.x = ImMin(tex->UpdateRect.x, req.x); |
| 2952 | tex->UpdateRect.y = ImMin(tex->UpdateRect.y, req.y); |
| 2953 | tex->UpdateRect.w = (unsigned short)(new_x1 - tex->UpdateRect.x); |
| 2954 | tex->UpdateRect.h = (unsigned short)(new_y1 - tex->UpdateRect.y); |
| 2955 | tex->UsedRect.x = ImMin(tex->UsedRect.x, req.x); |
| 2956 | tex->UsedRect.y = ImMin(tex->UsedRect.y, req.y); |
| 2957 | tex->UsedRect.w = (unsigned short)(ImMax(tex->UsedRect.x + tex->UsedRect.w, req.x + req.w) - tex->UsedRect.x); |
| 2958 | tex->UsedRect.h = (unsigned short)(ImMax(tex->UsedRect.y + tex->UsedRect.h, req.y + req.h) - tex->UsedRect.y); |
| 2959 | atlas->TexIsBuilt = false; |
| 2960 | |
| 2961 | // No need to queue if status is == ImTextureStatus_WantCreate |
| 2962 | if (tex->Status == ImTextureStatus_OK || tex->Status == ImTextureStatus_WantUpdates) |
| 2963 | { |
| 2964 | tex->Status = ImTextureStatus_WantUpdates; |
| 2965 | tex->Updates.push_back(req); |
| 2966 | } |
| 2967 | } |
| 2968 | |
| 2969 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS |
| 2970 | static void GetTexDataAsFormat(ImFontAtlas* atlas, ImTextureFormat format, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel) |
no test coverage detected