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

Method AddCustomRect

src/imgui/imgui_draw.cpp:3246–3266  ·  view source on GitHub ↗

At it is common to do an AddCustomRect() followed by a GetCustomRect(), we provide an optional 'ImFontAtlasRect* out_r = NULL' argument to retrieve the info straight away.

Source from the content-addressed store, hash-verified

3244
3245// At it is common to do an AddCustomRect() followed by a GetCustomRect(), we provide an optional 'ImFontAtlasRect* out_r = NULL' argument to retrieve the info straight away.
3246ImFontAtlasRectId ImFontAtlas::AddCustomRect(int width, int height, ImFontAtlasRect* out_r)
3247{
3248 IM_ASSERT(width > 0 && width <= 0xFFFF);
3249 IM_ASSERT(height > 0 && height <= 0xFFFF);
3250
3251 if (Builder == NULL)
3252 ImFontAtlasBuildInit(this);
3253
3254 ImFontAtlasRectId r_id = ImFontAtlasPackAddRect(this, width, height);
3255 if (r_id == ImFontAtlasRectId_Invalid)
3256 return ImFontAtlasRectId_Invalid;
3257 if (out_r != NULL)
3258 GetCustomRect(r_id, out_r);
3259
3260 if (RendererHasTextures)
3261 {
3262 ImTextureRect* r = ImFontAtlasPackGetRect(this, r_id);
3263 ImFontAtlasTextureBlockQueueUpload(this, TexData, r->x, r->y, r->w, r->h);
3264 }
3265 return r_id;
3266}
3267
3268void ImFontAtlas::RemoveCustomRect(ImFontAtlasRectId id)
3269{

Calls 4

ImFontAtlasBuildInitFunction · 0.85
ImFontAtlasPackAddRectFunction · 0.85
ImFontAtlasPackGetRectFunction · 0.85

Tested by

no test coverage detected