Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenfont/intern/blf_glyph.c
| Show First 20 Lines • Show All 466 Lines • ▼ Show 20 Lines | if (!g->cached) { | ||||
| } | } | ||||
| g->offset = gc->bitmap_len; | g->offset = gc->bitmap_len; | ||||
| int buff_size = g->width * g->height; | int buff_size = g->width * g->height; | ||||
| int bitmap_len = gc->bitmap_len + buff_size; | int bitmap_len = gc->bitmap_len + buff_size; | ||||
| if (bitmap_len > gc->bitmap_len_alloc) { | if (bitmap_len > gc->bitmap_len_alloc) { | ||||
| /* The buffer has to match the size of the texture (w * h). */ | |||||
| int w = font->tex_size_max; | int w = font->tex_size_max; | ||||
| int h = bitmap_len / w + 1; | int h = bitmap_len / w + 1; | ||||
| gc->bitmap_len_alloc = w * h; | gc->bitmap_len_alloc = w * h; | ||||
| gc->bitmap_result = MEM_reallocN(gc->bitmap_result, (size_t)gc->bitmap_len_alloc); | gc->bitmap_result = MEM_reallocN(gc->bitmap_result, (size_t)gc->bitmap_len_alloc); | ||||
| /* Keep in sync with the texture. */ | |||||
| if (gc->texture) { | |||||
| GPU_texture_free(gc->texture); | |||||
| } | |||||
| gc->texture = GPU_texture_create_nD( | |||||
| w, h, 0, 1, NULL, GPU_R8, GPU_DATA_UNSIGNED_BYTE, 0, false, NULL); | |||||
| gc->bitmap_len_landed = 0; | |||||
| } | } | ||||
| memcpy(&gc->bitmap_result[gc->bitmap_len], g->bitmap, (size_t)buff_size); | memcpy(&gc->bitmap_result[gc->bitmap_len], g->bitmap, (size_t)buff_size); | ||||
| gc->bitmap_len = bitmap_len; | gc->bitmap_len = bitmap_len; | ||||
| gc->glyphs_len_free--; | gc->glyphs_len_free--; | ||||
| g->cached = true; | g->cached = true; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines | |||||