MCPcopy Create free account
hub / github.com/Wemino/MarkerPatch / ImTextureDataQueueUpload

Function ImTextureDataQueueUpload

include/imgui/imgui_draw.cpp:2991–3014  ·  view source on GitHub ↗

Queue texture block update for renderer backend

Source from the content-addressed store, hash-verified

2989
2990// Queue texture block update for renderer backend
2991void 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
3017static void GetTexDataAsFormat(ImFontAtlas* atlas, ImTextureFormat format, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)

Callers 1

Calls 3

ImMaxFunction · 0.85
ImMinFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected