MCPcopy Create free account
hub / github.com/cinder/Cinder / ImFontAtlasTextureBlockQueueUpload

Function ImFontAtlasTextureBlockQueueUpload

src/imgui/imgui_draw.cpp:2942–2967  ·  view source on GitHub ↗

Queue texture block update for renderer backend

Source from the content-addressed store, hash-verified

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

Calls 3

ImMaxFunction · 0.85
ImMinFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected