Queue texture block update for renderer backend
| 2989 | |
| 2990 | // Queue texture block update for renderer backend |
| 2991 | void ImTextureDataQueueUpload(ImTextureData* tex, int x, int y, int w, int h) |
| 2992 | { |
| 2993 | IM_ASSERT(tex->Status != ImTextureStatus_WantDestroy && tex->Status != ImTextureStatus_Destroyed); |
| 2994 | IM_ASSERT(x >= 0 && x <= 0xFFFF && y >= 0 && y <= 0xFFFF && w >= 0 && x + w <= 0x10000 && h >= 0 && y + h <= 0x10000); |
| 2995 | |
| 2996 | ImTextureRect req = { (unsigned short)x, (unsigned short)y, (unsigned short)w, (unsigned short)h }; |
| 2997 | int new_x1 = ImMax(tex->UpdateRect.w == 0 ? 0 : tex->UpdateRect.x + tex->UpdateRect.w, req.x + req.w); |
| 2998 | int new_y1 = ImMax(tex->UpdateRect.h == 0 ? 0 : tex->UpdateRect.y + tex->UpdateRect.h, req.y + req.h); |
| 2999 | tex->UpdateRect.x = ImMin(tex->UpdateRect.x, req.x); |
| 3000 | tex->UpdateRect.y = ImMin(tex->UpdateRect.y, req.y); |
| 3001 | tex->UpdateRect.w = (unsigned short)(new_x1 - tex->UpdateRect.x); |
| 3002 | tex->UpdateRect.h = (unsigned short)(new_y1 - tex->UpdateRect.y); |
| 3003 | tex->UsedRect.x = ImMin(tex->UsedRect.x, req.x); |
| 3004 | tex->UsedRect.y = ImMin(tex->UsedRect.y, req.y); |
| 3005 | tex->UsedRect.w = (unsigned short)(ImMax(tex->UsedRect.x + tex->UsedRect.w, req.x + req.w) - tex->UsedRect.x); |
| 3006 | tex->UsedRect.h = (unsigned short)(ImMax(tex->UsedRect.y + tex->UsedRect.h, req.y + req.h) - tex->UsedRect.y); |
| 3007 | |
| 3008 | // No need to queue if status is == ImTextureStatus_WantCreate |
| 3009 | if (tex->Status == ImTextureStatus_OK || tex->Status == ImTextureStatus_WantUpdates) |
| 3010 | { |
| 3011 | tex->Status = ImTextureStatus_WantUpdates; |
| 3012 | tex->Updates.push_back(req); |
| 3013 | } |
| 3014 | } |
| 3015 | |
| 3016 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS |
| 3017 | 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