| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) |
| 29 | #define _CRT_SECURE_NO_WARNINGS |
| 30 | #endif |
| 31 | |
| 32 | #ifndef IMGUI_DEFINE_MATH_OPERATORS |
| 33 | #define IMGUI_DEFINE_MATH_OPERATORS |
| 34 | #endif |
| 35 | |
| 36 | #include "imgui.h" |
| 37 | #ifndef IMGUI_DISABLE |
| 38 | #include "imgui_internal.h" |
| 39 | #ifdef IMGUI_ENABLE_FREETYPE |
| 40 | #include "misc/freetype/imgui_freetype.h" |
| 41 | #endif |
| 42 | |
| 43 | #include <stdio.h> |
| 44 | #include <stdint.h> |
| 45 | |
| 46 | |
| 47 | #ifdef _MSC_VER |
| 48 | #pragma warning (disable: 4127) |
| 49 | #pragma warning (disable: 4505) |
| 50 | #pragma warning (disable: 4996) |
| 51 | #pragma warning (disable: 26451) |
| 52 | #pragma warning (disable: 26812) |
| 53 | #endif |
| 54 | |
| 55 | |
| 56 | #if defined(__clang__) |
| 57 | #if __has_warning("-Wunknown-warning-option") |
| 58 | #pragma clang diagnostic ignored "-Wunknown-warning-option" |
| 59 | #endif |
| 60 | #pragma clang diagnostic ignored "-Wunknown-pragmas" |
| 61 | #pragma clang diagnostic ignored "-Wold-style-cast" |
| 62 | #pragma clang diagnostic ignored "-Wfloat-equal" |
| 63 | #pragma clang diagnostic ignored "-Wglobal-constructors" |
| 64 | #pragma clang diagnostic ignored "-Wsign-conversion" |
| 65 | #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" |
| 66 | #pragma clang diagnostic ignored "-Wcomma" |
| 67 | #pragma clang diagnostic ignored "-Wreserved-id-macro" |
| 68 | #pragma clang diagnostic ignored "-Wdouble-promotion" |
| 69 | #pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" |
| 70 | #pragma clang diagnostic ignored "-Wreserved-identifier" |
| 71 | #pragma clang diagnostic ignored "-Wunsafe-buffer-usage" |
| 72 | #pragma clang diagnostic ignored "-Wnontrivial-memaccess" |
| 73 | #pragma clang diagnostic ignored "-Wcast-qual" |
| 74 | #pragma clang diagnostic ignored "-Wswitch-default" |
| 75 | #elif defined(__GNUC__) |
| 76 | #pragma GCC diagnostic ignored "-Wpragmas" |
| 77 | #pragma GCC diagnostic ignored "-Wunused-function" |
| 78 | #pragma GCC diagnostic ignored "-Wfloat-equal" |
| 79 | #pragma GCC diagnostic ignored "-Wdouble-promotion" |
| 80 | #pragma GCC diagnostic ignored "-Wconversion" |
| 81 | #pragma GCC diagnostic ignored "-Wstack-protector" |
| 82 | #pragma GCC diagnostic ignored "-Wstrict-overflow" |
| 83 | #pragma GCC diagnostic ignored "-Wclass-memaccess" |
| 84 | #pragma GCC diagnostic ignored "-Wcast-qual" |
| 85 | #pragma GCC diagnostic ignored "-Wsign-conversion" |
| 86 | #endif |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | #ifdef IMGUI_STB_NAMESPACE |
| 100 | namespace IMGUI_STB_NAMESPACE |
| 101 | { |
| 102 | #endif |
| 103 | |
| 104 | #ifdef _MSC_VER |
| 105 | #pragma warning (push) |
| 106 | #pragma warning (disable: 4456) |
| 107 | #pragma warning (disable: 6011) |
| 108 | #pragma warning (disable: 5262) |
| 109 | #pragma warning (disable: 6385) |
| 110 | #pragma warning (disable: 28182) |
| 111 | #endif |
| 112 | |
| 113 | #if defined(__clang__) |
| 114 | #pragma clang diagnostic push |
| 115 | #pragma clang diagnostic ignored "-Wunused-function" |
| 116 | #pragma clang diagnostic ignored "-Wmissing-prototypes" |
| 117 | #pragma clang diagnostic ignored "-Wimplicit-fallthrough" |
| 118 | #endif |
| 119 | |
| 120 | #if defined(__GNUC__) |
| 121 | #pragma GCC diagnostic push |
| 122 | #pragma GCC diagnostic ignored "-Wtype-limits" |
| 123 | #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" |
| 124 | #endif |
| 125 | |
| 126 | #ifndef STB_RECT_PACK_IMPLEMENTATION |
| 127 | #ifndef IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION |
| 128 | #define STBRP_STATIC |
| 129 | #define STBRP_ASSERT(x) do { IM_ASSERT(x); } while (0) |
| 130 | #define STBRP_SORT ImQsort |
| 131 | #define STB_RECT_PACK_IMPLEMENTATION |
| 132 | #endif |
| 133 | #ifdef IMGUI_STB_RECT_PACK_FILENAME |
| 134 | #include IMGUI_STB_RECT_PACK_FILENAME |
| 135 | #else |
| 136 | #include "imstb_rectpack.h" |
| 137 | #endif |
| 138 | #endif |
| 139 | |
| 140 | #ifdef IMGUI_ENABLE_STB_TRUETYPE |
| 141 | #ifndef STB_TRUETYPE_IMPLEMENTATION |
| 142 | #ifndef IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION |
| 143 | #define STBTT_malloc(x,u) ((void)(u), IM_ALLOC(x)) |
| 144 | #define STBTT_free(x,u) ((void)(u), IM_FREE(x)) |
| 145 | #define STBTT_assert(x) do { IM_ASSERT(x); } while(0) |
| 146 | #define STBTT_fmod(x,y) ImFmod(x,y) |
| 147 | #define STBTT_sqrt(x) ImSqrt(x) |
| 148 | #define STBTT_pow(x,y) ImPow(x,y) |
| 149 | #define STBTT_fabs(x) ImFabs(x) |
| 150 | #define STBTT_ifloor(x) ((int)ImFloor(x)) |
| 151 | #define STBTT_iceil(x) ((int)ImCeil(x)) |
| 152 | #define STBTT_strlen(x) ImStrlen(x) |
| 153 | #define STBTT_STATIC |
| 154 | #define STB_TRUETYPE_IMPLEMENTATION |
| 155 | #else |
| 156 | #define STBTT_DEF extern |
| 157 | #endif |
| 158 | #ifdef IMGUI_STB_TRUETYPE_FILENAME |
| 159 | #include IMGUI_STB_TRUETYPE_FILENAME |
| 160 | #else |
| 161 | #include "imstb_truetype.h" |
| 162 | #endif |
| 163 | #endif |
| 164 | #endif |
| 165 | |
| 166 | #if defined(__GNUC__) |
| 167 | #pragma GCC diagnostic pop |
| 168 | #endif |
| 169 | |
| 170 | #if defined(__clang__) |
| 171 | #pragma clang diagnostic pop |
| 172 | #endif |
| 173 | |
| 174 | #if defined(_MSC_VER) |
| 175 | #pragma warning (pop) |
| 176 | #endif |
| 177 | |
| 178 | #ifdef IMGUI_STB_NAMESPACE |
| 179 | } |
| 180 | using namespace IMGUI_STB_NAMESPACE; |
| 181 | #endif |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | void ImGui::StyleColorsDark(ImGuiStyle* dst) |
| 188 | { |
| 189 | ImGuiStyle* style = dst ? dst : &ImGui::GetStyle(); |
| 190 | ImVec4* colors = style->Colors; |
| 191 | |
| 192 | colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); |
| 193 | colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f); |
| 194 | colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.06f, 0.06f, 0.94f); |
| 195 | colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |
| 196 | colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f); |
| 197 | colors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f); |
| 198 | colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |
| 199 | colors[ImGuiCol_FrameBg] = ImVec4(0.16f, 0.29f, 0.48f, 0.54f); |
| 200 | colors[ImGuiCol_FrameBgHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f); |
| 201 | colors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f); |
| 202 | colors[ImGuiCol_TitleBg] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f); |
| 203 | colors[ImGuiCol_TitleBgActive] = ImVec4(0.16f, 0.29f, 0.48f, 1.00f); |
| 204 | colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f); |
| 205 | colors[ImGuiCol_MenuBarBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f); |
| 206 | colors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.53f); |
| 207 | colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f); |
| 208 | colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f); |
| 209 | colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.51f, 0.51f, 0.51f, 1.00f); |
| 210 | colors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); |
| 211 | colors[ImGuiCol_CheckboxSelectedBg] = ImLerp(colors[ImGuiCol_FrameBg], colors[ImGuiCol_FrameBgHovered], 0.65f); |
| 212 | colors[ImGuiCol_SliderGrab] = ImVec4(0.24f, 0.52f, 0.88f, 1.00f); |
| 213 | colors[ImGuiCol_SliderGrabActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); |
| 214 | colors[ImGuiCol_Button] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f); |
| 215 | colors[ImGuiCol_ButtonHovered] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); |
| 216 | colors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f); |
| 217 | colors[ImGuiCol_Header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f); |
| 218 | colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f); |
| 219 | colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); |
| 220 | colors[ImGuiCol_Separator] = colors[ImGuiCol_Border]; |
| 221 | colors[ImGuiCol_SeparatorHovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.78f); |
| 222 | colors[ImGuiCol_SeparatorActive] = ImVec4(0.10f, 0.40f, 0.75f, 1.00f); |
| 223 | colors[ImGuiCol_ResizeGrip] = ImVec4(0.26f, 0.59f, 0.98f, 0.20f); |
| 224 | colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f); |
| 225 | colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f); |
| 226 | colors[ImGuiCol_InputTextCursor] = colors[ImGuiCol_Text]; |
| 227 | colors[ImGuiCol_TabHovered] = colors[ImGuiCol_HeaderHovered]; |
| 228 | colors[ImGuiCol_Tab] = ImLerp(colors[ImGuiCol_Header], colors[ImGuiCol_TitleBgActive], 0.80f); |
| 229 | colors[ImGuiCol_TabSelected] = ImLerp(colors[ImGuiCol_HeaderActive], colors[ImGuiCol_TitleBgActive], 0.60f); |
| 230 | colors[ImGuiCol_TabSelectedOverline] = colors[ImGuiCol_HeaderActive]; |
| 231 | colors[ImGuiCol_TabDimmed] = ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f); |
| 232 | colors[ImGuiCol_TabDimmedSelected] = ImLerp(colors[ImGuiCol_TabSelected], colors[ImGuiCol_TitleBg], 0.40f); |
| 233 | colors[ImGuiCol_TabDimmedSelectedOverline] = ImVec4(0.50f, 0.50f, 0.50f, 0.00f); |
| 234 | colors[ImGuiCol_DockingPreview] = colors[ImGuiCol_HeaderActive] * ImVec4(1.0f, 1.0f, 1.0f, 0.7f); |
| 235 | colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); |
| 236 | colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f); |
| 237 | colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f); |
| 238 | colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); |
| 239 | colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); |
| 240 | colors[ImGuiCol_TableHeaderBg] = ImVec4(0.19f, 0.19f, 0.20f, 1.00f); |
| 241 | colors[ImGuiCol_TableBorderStrong] = ImVec4(0.31f, 0.31f, 0.35f, 1.00f); |
| 242 | colors[ImGuiCol_TableBorderLight] = ImVec4(0.23f, 0.23f, 0.25f, 1.00f); |
| 243 | colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |
| 244 | colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.06f); |
| 245 | colors[ImGuiCol_TextLink] = colors[ImGuiCol_HeaderActive]; |
| 246 | colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f); |
| 247 | colors[ImGuiCol_TreeLines] = colors[ImGuiCol_Border]; |
| 248 | colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f); |
| 249 | colors[ImGuiCol_DragDropTargetBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |
| 250 | colors[ImGuiCol_UnsavedMarker] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); |
| 251 | colors[ImGuiCol_NavCursor] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); |
| 252 | colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f); |
| 253 | colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f); |
| 254 | colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f); |
| 255 | } |
| 256 | |
| 257 | void ImGui::StyleColorsClassic(ImGuiStyle* dst) |
| 258 | { |
| 259 | ImGuiStyle* style = dst ? dst : &ImGui::GetStyle(); |
| 260 | ImVec4* colors = style->Colors; |
| 261 | |
| 262 | colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f); |
| 263 | colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f); |
| 264 | colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.85f); |
| 265 | colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |
| 266 | colors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.11f, 0.14f, 0.92f); |
| 267 | colors[ImGuiCol_Border] = ImVec4(0.50f, 0.50f, 0.50f, 0.50f); |
| 268 | colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |
| 269 | colors[ImGuiCol_FrameBg] = ImVec4(0.43f, 0.43f, 0.43f, 0.39f); |
| 270 | colors[ImGuiCol_FrameBgHovered] = ImVec4(0.47f, 0.47f, 0.69f, 0.40f); |
| 271 | colors[ImGuiCol_FrameBgActive] = ImVec4(0.42f, 0.41f, 0.64f, 0.69f); |
| 272 | colors[ImGuiCol_TitleBg] = ImVec4(0.27f, 0.27f, 0.54f, 0.83f); |
| 273 | colors[ImGuiCol_TitleBgActive] = ImVec4(0.32f, 0.32f, 0.63f, 0.87f); |
| 274 | colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.40f, 0.40f, 0.80f, 0.20f); |
| 275 | colors[ImGuiCol_MenuBarBg] = ImVec4(0.40f, 0.40f, 0.55f, 0.80f); |
| 276 | colors[ImGuiCol_ScrollbarBg] = ImVec4(0.20f, 0.25f, 0.30f, 0.60f); |
| 277 | colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.80f, 0.30f); |
| 278 | colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.40f, 0.80f, 0.40f); |
| 279 | colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.41f, 0.39f, 0.80f, 0.60f); |
| 280 | colors[ImGuiCol_CheckMark] = ImVec4(0.90f, 0.90f, 0.90f, 0.50f); |
| 281 | colors[ImGuiCol_CheckboxSelectedBg] = ImLerp(colors[ImGuiCol_FrameBg], colors[ImGuiCol_FrameBgActive], 0.65f); |
| 282 | colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f); |
| 283 | colors[ImGuiCol_SliderGrabActive] = ImVec4(0.41f, 0.39f, 0.80f, 0.60f); |
| 284 | colors[ImGuiCol_Button] = ImVec4(0.35f, 0.40f, 0.61f, 0.62f); |
| 285 | colors[ImGuiCol_ButtonHovered] = ImVec4(0.40f, 0.48f, 0.71f, 0.79f); |
| 286 | colors[ImGuiCol_ButtonActive] = ImVec4(0.46f, 0.54f, 0.80f, 1.00f); |
| 287 | colors[ImGuiCol_Header] = ImVec4(0.40f, 0.40f, 0.90f, 0.45f); |
| 288 | colors[ImGuiCol_HeaderHovered] = ImVec4(0.45f, 0.45f, 0.90f, 0.80f); |
| 289 | colors[ImGuiCol_HeaderActive] = ImVec4(0.53f, 0.53f, 0.87f, 0.80f); |
| 290 | colors[ImGuiCol_Separator] = ImVec4(0.50f, 0.50f, 0.50f, 0.60f); |
| 291 | colors[ImGuiCol_SeparatorHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f); |
| 292 | colors[ImGuiCol_SeparatorActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f); |
| 293 | colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.10f); |
| 294 | colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f); |
| 295 | colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f); |
| 296 | colors[ImGuiCol_InputTextCursor] = colors[ImGuiCol_Text]; |
| 297 | colors[ImGuiCol_TabHovered] = colors[ImGuiCol_HeaderHovered]; |
| 298 | colors[ImGuiCol_Tab] = ImLerp(colors[ImGuiCol_Header], colors[ImGuiCol_TitleBgActive], 0.80f); |
| 299 | colors[ImGuiCol_TabSelected] = ImLerp(colors[ImGuiCol_HeaderActive], colors[ImGuiCol_TitleBgActive], 0.60f); |
| 300 | colors[ImGuiCol_TabSelectedOverline] = colors[ImGuiCol_HeaderActive]; |
| 301 | colors[ImGuiCol_TabDimmed] = ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f); |
| 302 | colors[ImGuiCol_TabDimmedSelected] = ImLerp(colors[ImGuiCol_TabSelected], colors[ImGuiCol_TitleBg], 0.40f); |
| 303 | colors[ImGuiCol_TabDimmedSelectedOverline] = ImVec4(0.53f, 0.53f, 0.87f, 0.00f); |
| 304 | colors[ImGuiCol_DockingPreview] = colors[ImGuiCol_Header] * ImVec4(1.0f, 1.0f, 1.0f, 0.7f); |
| 305 | colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); |
| 306 | colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); |
| 307 | colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); |
| 308 | colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); |
| 309 | colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); |
| 310 | colors[ImGuiCol_TableHeaderBg] = ImVec4(0.27f, 0.27f, 0.38f, 1.00f); |
| 311 | colors[ImGuiCol_TableBorderStrong] = ImVec4(0.31f, 0.31f, 0.45f, 1.00f); |
| 312 | colors[ImGuiCol_TableBorderLight] = ImVec4(0.26f, 0.26f, 0.28f, 1.00f); |
| 313 | colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |
| 314 | colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.07f); |
| 315 | colors[ImGuiCol_TextLink] = colors[ImGuiCol_HeaderActive]; |
| 316 | colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f); |
| 317 | colors[ImGuiCol_TreeLines] = colors[ImGuiCol_Border]; |
| 318 | colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f); |
| 319 | colors[ImGuiCol_DragDropTargetBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |
| 320 | colors[ImGuiCol_UnsavedMarker] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f); |
| 321 | colors[ImGuiCol_NavCursor] = colors[ImGuiCol_HeaderHovered]; |
| 322 | colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f); |
| 323 | colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f); |
| 324 | colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f); |
| 325 | } |
| 326 | |
| 327 | |
| 328 | void ImGui::StyleColorsLight(ImGuiStyle* dst) |
| 329 | { |
| 330 | ImGuiStyle* style = dst ? dst : &ImGui::GetStyle(); |
| 331 | ImVec4* colors = style->Colors; |
| 332 | |
| 333 | colors[ImGuiCol_Text] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); |
| 334 | colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f); |
| 335 | colors[ImGuiCol_WindowBg] = ImVec4(0.94f, 0.94f, 0.94f, 1.00f); |
| 336 | colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |
| 337 | colors[ImGuiCol_PopupBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.98f); |
| 338 | colors[ImGuiCol_Border] = ImVec4(0.00f, 0.00f, 0.00f, 0.30f); |
| 339 | colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |
| 340 | colors[ImGuiCol_FrameBg] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); |
| 341 | colors[ImGuiCol_FrameBgHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f); |
| 342 | colors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f); |
| 343 | colors[ImGuiCol_TitleBg] = ImVec4(0.96f, 0.96f, 0.96f, 1.00f); |
| 344 | colors[ImGuiCol_TitleBgActive] = ImVec4(0.82f, 0.82f, 0.82f, 1.00f); |
| 345 | colors[ImGuiCol_TitleBgCollapsed] = ImVec4(1.00f, 1.00f, 1.00f, 0.51f); |
| 346 | colors[ImGuiCol_MenuBarBg] = ImVec4(0.86f, 0.86f, 0.86f, 1.00f); |
| 347 | colors[ImGuiCol_ScrollbarBg] = ImVec4(0.98f, 0.98f, 0.98f, 0.53f); |
| 348 | colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.69f, 0.69f, 0.69f, 0.80f); |
| 349 | colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.49f, 0.49f, 0.49f, 0.80f); |
| 350 | colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.49f, 0.49f, 0.49f, 1.00f); |
| 351 | colors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); |
| 352 | colors[ImGuiCol_CheckboxSelectedBg] = ImVec4(0.95f, 0.97f, 1.00f, 1.00f); |
| 353 | colors[ImGuiCol_SliderGrab] = ImVec4(0.26f, 0.59f, 0.98f, 0.78f); |
| 354 | colors[ImGuiCol_SliderGrabActive] = ImVec4(0.46f, 0.54f, 0.80f, 0.60f); |
| 355 | colors[ImGuiCol_Button] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f); |
| 356 | colors[ImGuiCol_ButtonHovered] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); |
| 357 | colors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f); |
| 358 | colors[ImGuiCol_Header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f); |
| 359 | colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f); |
| 360 | colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); |
| 361 | colors[ImGuiCol_Separator] = ImVec4(0.39f, 0.39f, 0.39f, 0.62f); |
| 362 | colors[ImGuiCol_SeparatorHovered] = ImVec4(0.14f, 0.44f, 0.80f, 0.78f); |
| 363 | colors[ImGuiCol_SeparatorActive] = ImVec4(0.14f, 0.44f, 0.80f, 1.00f); |
| 364 | colors[ImGuiCol_ResizeGrip] = ImVec4(0.35f, 0.35f, 0.35f, 0.17f); |
| 365 | colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f); |
| 366 | colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f); |
| 367 | colors[ImGuiCol_InputTextCursor] = colors[ImGuiCol_Text]; |
| 368 | colors[ImGuiCol_TabHovered] = colors[ImGuiCol_HeaderHovered]; |
| 369 | colors[ImGuiCol_Tab] = ImLerp(colors[ImGuiCol_Header], colors[ImGuiCol_TitleBgActive], 0.90f); |
| 370 | colors[ImGuiCol_TabSelected] = ImLerp(colors[ImGuiCol_HeaderActive], colors[ImGuiCol_TitleBgActive], 0.60f); |
| 371 | colors[ImGuiCol_TabSelectedOverline] = colors[ImGuiCol_HeaderActive]; |
| 372 | colors[ImGuiCol_TabDimmed] = ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f); |
| 373 | colors[ImGuiCol_TabDimmedSelected] = ImLerp(colors[ImGuiCol_TabSelected], colors[ImGuiCol_TitleBg], 0.40f); |
| 374 | colors[ImGuiCol_TabDimmedSelectedOverline] = ImVec4(0.26f, 0.59f, 1.00f, 0.00f); |
| 375 | colors[ImGuiCol_DockingPreview] = colors[ImGuiCol_Header] * ImVec4(1.0f, 1.0f, 1.0f, 0.7f); |
| 376 | colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); |
| 377 | colors[ImGuiCol_PlotLines] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f); |
| 378 | colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f); |
| 379 | colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); |
| 380 | colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.45f, 0.00f, 1.00f); |
| 381 | colors[ImGuiCol_TableHeaderBg] = ImVec4(0.78f, 0.87f, 0.98f, 1.00f); |
| 382 | colors[ImGuiCol_TableBorderStrong] = ImVec4(0.57f, 0.57f, 0.64f, 1.00f); |
| 383 | colors[ImGuiCol_TableBorderLight] = ImVec4(0.68f, 0.68f, 0.74f, 1.00f); |
| 384 | colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |
| 385 | colors[ImGuiCol_TableRowBgAlt] = ImVec4(0.30f, 0.30f, 0.30f, 0.09f); |
| 386 | colors[ImGuiCol_TextLink] = colors[ImGuiCol_HeaderActive]; |
| 387 | colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f); |
| 388 | colors[ImGuiCol_TreeLines] = colors[ImGuiCol_Border]; |
| 389 | colors[ImGuiCol_DragDropTarget] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f); |
| 390 | colors[ImGuiCol_DragDropTargetBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |
| 391 | colors[ImGuiCol_UnsavedMarker] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); |
| 392 | colors[ImGuiCol_NavCursor] = colors[ImGuiCol_HeaderHovered]; |
| 393 | colors[ImGuiCol_NavWindowingHighlight] = ImVec4(0.70f, 0.70f, 0.70f, 0.70f); |
| 394 | colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.20f); |
| 395 | colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f); |
| 396 | } |
| 397 | |
| 398 | |
| 399 | |
| 400 | |
| 401 | |
| 402 | ImDrawListSharedData::ImDrawListSharedData() |
| 403 | { |
| 404 | memset((void*)this, 0, sizeof(*this)); |
| 405 | InitialFringeScale = 1.0f; |
| 406 | for (int i = 0; i < IM_COUNTOF(ArcFastVtx); i++) |
| 407 | { |
| 408 | const float a = ((float)i * 2 * IM_PI) / (float)IM_COUNTOF(ArcFastVtx); |
| 409 | ArcFastVtx[i] = ImVec2(ImCos(a), ImSin(a)); |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | ImDrawListSharedData::~ImDrawListSharedData() |
| 414 | { |
| 415 | IM_ASSERT(DrawLists.Size == 0); |
| 416 | } |
| 417 | |
| 418 | void ImDrawListSharedData::SetCircleTessellationMaxError(float max_error) |
| 419 | { |
| 420 | if (CircleTessellationMaxError == max_error) |
| 421 | return; |
| 422 | |
| 423 | IM_ASSERT(max_error > 0.0f); |
| 424 | CircleTessellationMaxError = max_error; |
| 425 | for (int i = 0; i < IM_COUNTOF(CircleSegmentCounts); i++) |
| 426 | { |
| 427 | const float radius = (float)i; |
| 428 | CircleSegmentCounts[i] = (ImU8)((i > 0) ? IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, CircleTessellationMaxError) : IM_DRAWLIST_ARCFAST_SAMPLE_MAX); |
| 429 | } |
| 430 | ArcFastRadiusCutoff = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(IM_DRAWLIST_ARCFAST_SAMPLE_MAX, CircleTessellationMaxError); |
| 431 | } |
| 432 | |
| 433 | ImDrawList::ImDrawList(ImDrawListSharedData* shared_data) |
| 434 | { |
| 435 | memset((void*)this, 0, sizeof(*this)); |
| 436 | _SetDrawListSharedData(shared_data); |
| 437 | } |
| 438 | |
| 439 | ImDrawList::~ImDrawList() |
| 440 | { |
| 441 | _ClearFreeMemory(); |
| 442 | _SetDrawListSharedData(NULL); |
| 443 | } |
| 444 | |
| 445 | void ImDrawList::_SetDrawListSharedData(ImDrawListSharedData* data) |
| 446 | { |
| 447 | if (_Data != NULL) |
| 448 | _Data->DrawLists.find_erase_unsorted(this); |
| 449 | _Data = data; |
| 450 | if (_Data != NULL) |
| 451 | _Data->DrawLists.push_back(this); |
| 452 | } |
| 453 | |
| 454 | |
| 455 | |
| 456 | void ImDrawList::_ResetForNewFrame() |
| 457 | { |
| 458 | |
| 459 | IM_STATIC_ASSERT(offsetof(ImDrawCmd, ClipRect) == 0); |
| 460 | IM_STATIC_ASSERT(offsetof(ImDrawCmd, TexRef) == sizeof(ImVec4)); |
| 461 | IM_STATIC_ASSERT(offsetof(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureRef)); |
| 462 | IM_STATIC_ASSERT(offsetof(ImDrawCmd, ClipRect) == offsetof(ImDrawCmdHeader, ClipRect)); |
| 463 | IM_STATIC_ASSERT(offsetof(ImDrawCmd, TexRef) == offsetof(ImDrawCmdHeader, TexRef)); |
| 464 | IM_STATIC_ASSERT(offsetof(ImDrawCmd, VtxOffset) == offsetof(ImDrawCmdHeader, VtxOffset)); |
| 465 | if (_Splitter._Count > 1) |
| 466 | _Splitter.Merge(this); |
| 467 | |
| 468 | CmdBuffer.resize(0); |
| 469 | IdxBuffer.resize(0); |
| 470 | VtxBuffer.resize(0); |
| 471 | Flags = _Data->InitialFlags; |
| 472 | memset(&_CmdHeader, 0, sizeof(_CmdHeader)); |
| 473 | _VtxCurrentIdx = 0; |
| 474 | _VtxWritePtr = NULL; |
| 475 | _IdxWritePtr = NULL; |
| 476 | _ClipRectStack.resize(0); |
| 477 | _TextureStack.resize(0); |
| 478 | _CallbacksDataBuf.resize(0); |
| 479 | _Path.resize(0); |
| 480 | _Splitter.Clear(); |
| 481 | CmdBuffer.push_back(ImDrawCmd()); |
| 482 | _FringeScale = _Data->InitialFringeScale; |
| 483 | } |
| 484 | |
| 485 | void ImDrawList::_ClearFreeMemory() |
| 486 | { |
| 487 | CmdBuffer.clear(); |
| 488 | IdxBuffer.clear(); |
| 489 | VtxBuffer.clear(); |
| 490 | Flags = ImDrawListFlags_None; |
| 491 | _VtxCurrentIdx = 0; |
| 492 | _VtxWritePtr = NULL; |
| 493 | _IdxWritePtr = NULL; |
| 494 | _ClipRectStack.clear(); |
| 495 | _TextureStack.clear(); |
| 496 | _CallbacksDataBuf.clear(); |
| 497 | _Path.clear(); |
| 498 | _Splitter.ClearFreeMemory(); |
| 499 | } |
| 500 | |
| 501 | |
| 502 | ImDrawList* ImDrawList::CloneOutput() const |
| 503 | { |
| 504 | ImDrawList* dst = IM_NEW(ImDrawList(NULL)); |
| 505 | dst->CmdBuffer = CmdBuffer; |
| 506 | dst->IdxBuffer = IdxBuffer; |
| 507 | dst->VtxBuffer = VtxBuffer; |
| 508 | dst->Flags = Flags; |
| 509 | return dst; |
| 510 | } |
| 511 | |
| 512 | void ImDrawList::AddDrawCmd() |
| 513 | { |
| 514 | ImDrawCmd draw_cmd; |
| 515 | draw_cmd.ClipRect = _CmdHeader.ClipRect; |
| 516 | draw_cmd.TexRef = _CmdHeader.TexRef; |
| 517 | draw_cmd.VtxOffset = _CmdHeader.VtxOffset; |
| 518 | draw_cmd.IdxOffset = IdxBuffer.Size; |
| 519 | |
| 520 | IM_ASSERT(draw_cmd.ClipRect.x <= draw_cmd.ClipRect.z && draw_cmd.ClipRect.y <= draw_cmd.ClipRect.w); |
| 521 | CmdBuffer.push_back(draw_cmd); |
| 522 | } |
| 523 | |
| 524 | |
| 525 | |
| 526 | void ImDrawList::_PopUnusedDrawCmd() |
| 527 | { |
| 528 | while (CmdBuffer.Size > 0) |
| 529 | { |
| 530 | ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; |
| 531 | if (curr_cmd->ElemCount != 0 || curr_cmd->UserCallback != NULL) |
| 532 | return; |
| 533 | CmdBuffer.pop_back(); |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | void ImDrawList::AddCallback(ImDrawCallback callback, void* userdata, size_t userdata_size) |
| 538 | { |
| 539 | IM_ASSERT(callback != NULL); |
| 540 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS |
| 541 | if (callback == ImDrawCallback_ResetRenderState && _Data->Context != NULL && _Data->Context->PlatformIO.DrawCallback_ResetRenderState != NULL) |
| 542 | callback = _Data->Context->PlatformIO.DrawCallback_ResetRenderState; |
| 543 | #endif |
| 544 | |
| 545 | IM_ASSERT_PARANOID(CmdBuffer.Size > 0); |
| 546 | ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; |
| 547 | IM_ASSERT(curr_cmd->UserCallback == NULL); |
| 548 | if (curr_cmd->ElemCount != 0) |
| 549 | { |
| 550 | AddDrawCmd(); |
| 551 | curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; |
| 552 | } |
| 553 | |
| 554 | curr_cmd->UserCallback = callback; |
| 555 | if (userdata_size == 0) |
| 556 | { |
| 557 | |
| 558 | curr_cmd->UserCallbackData = userdata; |
| 559 | curr_cmd->UserCallbackDataSize = 0; |
| 560 | curr_cmd->UserCallbackDataOffset = -1; |
| 561 | } |
| 562 | else |
| 563 | { |
| 564 | |
| 565 | IM_ASSERT(userdata != NULL); |
| 566 | IM_ASSERT(userdata_size < (1u << 31)); |
| 567 | curr_cmd->UserCallbackData = NULL; |
| 568 | curr_cmd->UserCallbackDataSize = (int)userdata_size; |
| 569 | curr_cmd->UserCallbackDataOffset = _CallbacksDataBuf.Size; |
| 570 | _CallbacksDataBuf.resize(_CallbacksDataBuf.Size + (int)userdata_size); |
| 571 | memcpy(_CallbacksDataBuf.Data + (size_t)curr_cmd->UserCallbackDataOffset, userdata, userdata_size); |
| 572 | } |
| 573 | |
| 574 | AddDrawCmd(); |
| 575 | } |
| 576 | |
| 577 | |
| 578 | #define ImDrawCmd_HeaderSize (offsetof(ImDrawCmd, VtxOffset) + sizeof(unsigned int)) |
| 579 | #define ImDrawCmd_HeaderCompare(CMD_LHS, CMD_RHS) (memcmp(CMD_LHS, CMD_RHS, ImDrawCmd_HeaderSize)) |
| 580 | #define ImDrawCmd_HeaderCopy(CMD_DST, CMD_SRC) (memcpy(CMD_DST, CMD_SRC, ImDrawCmd_HeaderSize)) |
| 581 | #define ImDrawCmd_AreSequentialIdxOffset(CMD_0, CMD_1) (CMD_0->IdxOffset + CMD_0->ElemCount == CMD_1->IdxOffset) |
| 582 | |
| 583 | |
| 584 | void ImDrawList::_TryMergeDrawCmds() |
| 585 | { |
| 586 | IM_ASSERT_PARANOID(CmdBuffer.Size > 0); |
| 587 | ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; |
| 588 | ImDrawCmd* prev_cmd = curr_cmd - 1; |
| 589 | if (ImDrawCmd_HeaderCompare(curr_cmd, prev_cmd) == 0 && ImDrawCmd_AreSequentialIdxOffset(prev_cmd, curr_cmd) && curr_cmd->UserCallback == NULL && prev_cmd->UserCallback == NULL) |
| 590 | { |
| 591 | prev_cmd->ElemCount += curr_cmd->ElemCount; |
| 592 | CmdBuffer.pop_back(); |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | |
| 597 | |
| 598 | void ImDrawList::_OnChangedClipRect() |
| 599 | { |
| 600 | |
| 601 | IM_ASSERT_PARANOID(CmdBuffer.Size > 0); |
| 602 | ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; |
| 603 | if (curr_cmd->ElemCount != 0 && memcmp(&curr_cmd->ClipRect, &_CmdHeader.ClipRect, sizeof(ImVec4)) != 0) |
| 604 | { |
| 605 | AddDrawCmd(); |
| 606 | return; |
| 607 | } |
| 608 | IM_ASSERT(curr_cmd->UserCallback == NULL); |
| 609 | |
| 610 | |
| 611 | ImDrawCmd* prev_cmd = curr_cmd - 1; |
| 612 | if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1 && ImDrawCmd_HeaderCompare(&_CmdHeader, prev_cmd) == 0 && ImDrawCmd_AreSequentialIdxOffset(prev_cmd, curr_cmd) && prev_cmd->UserCallback == NULL) |
| 613 | { |
| 614 | CmdBuffer.pop_back(); |
| 615 | return; |
| 616 | } |
| 617 | curr_cmd->ClipRect = _CmdHeader.ClipRect; |
| 618 | } |
| 619 | |
| 620 | void ImDrawList::_OnChangedTexture() |
| 621 | { |
| 622 | |
| 623 | IM_ASSERT_PARANOID(CmdBuffer.Size > 0); |
| 624 | ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; |
| 625 | if (curr_cmd->ElemCount != 0 && curr_cmd->TexRef != _CmdHeader.TexRef) |
| 626 | { |
| 627 | AddDrawCmd(); |
| 628 | return; |
| 629 | } |
| 630 | |
| 631 | |
| 632 | if (curr_cmd->UserCallback != NULL) |
| 633 | return; |
| 634 | |
| 635 | |
| 636 | ImDrawCmd* prev_cmd = curr_cmd - 1; |
| 637 | if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1 && ImDrawCmd_HeaderCompare(&_CmdHeader, prev_cmd) == 0 && ImDrawCmd_AreSequentialIdxOffset(prev_cmd, curr_cmd) && prev_cmd->UserCallback == NULL) |
| 638 | { |
| 639 | CmdBuffer.pop_back(); |
| 640 | return; |
| 641 | } |
| 642 | curr_cmd->TexRef = _CmdHeader.TexRef; |
| 643 | } |
| 644 | |
| 645 | void ImDrawList::_OnChangedVtxOffset() |
| 646 | { |
| 647 | |
| 648 | _VtxCurrentIdx = 0; |
| 649 | IM_ASSERT_PARANOID(CmdBuffer.Size > 0); |
| 650 | ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; |
| 651 | |
| 652 | if (curr_cmd->ElemCount != 0) |
| 653 | { |
| 654 | AddDrawCmd(); |
| 655 | return; |
| 656 | } |
| 657 | IM_ASSERT(curr_cmd->UserCallback == NULL); |
| 658 | curr_cmd->VtxOffset = _CmdHeader.VtxOffset; |
| 659 | } |
| 660 | |
| 661 | int ImDrawList::_CalcCircleAutoSegmentCount(float radius) const |
| 662 | { |
| 663 | |
| 664 | const int radius_idx = (int)(radius + 0.999f); |
| 665 | if (radius_idx >= 0 && radius_idx < IM_COUNTOF(_Data->CircleSegmentCounts)) |
| 666 | return _Data->CircleSegmentCounts[radius_idx]; |
| 667 | else |
| 668 | return IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, _Data->CircleTessellationMaxError); |
| 669 | } |
| 670 | |
| 671 | |
| 672 | void ImDrawList::PushClipRect(const ImVec2& cr_min, const ImVec2& cr_max, bool intersect_with_current_clip_rect) |
| 673 | { |
| 674 | ImVec4 cr(cr_min.x, cr_min.y, cr_max.x, cr_max.y); |
| 675 | if (intersect_with_current_clip_rect) |
| 676 | { |
| 677 | ImVec4 current = _CmdHeader.ClipRect; |
| 678 | if (cr.x < current.x) cr.x = current.x; |
| 679 | if (cr.y < current.y) cr.y = current.y; |
| 680 | if (cr.z > current.z) cr.z = current.z; |
| 681 | if (cr.w > current.w) cr.w = current.w; |
| 682 | } |
| 683 | cr.z = ImMax(cr.x, cr.z); |
| 684 | cr.w = ImMax(cr.y, cr.w); |
| 685 | |
| 686 | _ClipRectStack.push_back(cr); |
| 687 | _CmdHeader.ClipRect = cr; |
| 688 | _OnChangedClipRect(); |
| 689 | } |
| 690 | |
| 691 | void ImDrawList::PushClipRectFullScreen() |
| 692 | { |
| 693 | PushClipRect(ImVec2(_Data->ClipRectFullscreen.x, _Data->ClipRectFullscreen.y), ImVec2(_Data->ClipRectFullscreen.z, _Data->ClipRectFullscreen.w)); |
| 694 | } |
| 695 | |
| 696 | void ImDrawList::PopClipRect() |
| 697 | { |
| 698 | _ClipRectStack.pop_back(); |
| 699 | _CmdHeader.ClipRect = (_ClipRectStack.Size == 0) ? _Data->ClipRectFullscreen : _ClipRectStack.Data[_ClipRectStack.Size - 1]; |
| 700 | _OnChangedClipRect(); |
| 701 | } |
| 702 | |
| 703 | void ImDrawList::PushTexture(ImTextureRef tex_ref) |
| 704 | { |
| 705 | _TextureStack.push_back(tex_ref); |
| 706 | _CmdHeader.TexRef = tex_ref; |
| 707 | if (tex_ref._TexData != NULL) |
| 708 | IM_ASSERT(tex_ref._TexData->WantDestroyNextFrame == false); |
| 709 | _OnChangedTexture(); |
| 710 | } |
| 711 | |
| 712 | void ImDrawList::PopTexture() |
| 713 | { |
| 714 | _TextureStack.pop_back(); |
| 715 | _CmdHeader.TexRef = (_TextureStack.Size == 0) ? ImTextureRef() : _TextureStack.Data[_TextureStack.Size - 1]; |
| 716 | _OnChangedTexture(); |
| 717 | } |
| 718 | |
| 719 | |
| 720 | void ImDrawList::_SetTexture(ImTextureRef tex_ref) |
| 721 | { |
| 722 | if (_CmdHeader.TexRef == tex_ref) |
| 723 | return; |
| 724 | _CmdHeader.TexRef = tex_ref; |
| 725 | _TextureStack.back() = tex_ref; |
| 726 | _OnChangedTexture(); |
| 727 | } |
| 728 | |
| 729 | |
| 730 | |
| 731 | |
| 732 | void ImDrawList::PrimReserve(int idx_count, int vtx_count) |
| 733 | { |
| 734 | |
| 735 | IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0); |
| 736 | if (sizeof(ImDrawIdx) == 2 && (_VtxCurrentIdx + vtx_count >= (1 << 16)) && (Flags & ImDrawListFlags_AllowVtxOffset)) |
| 737 | { |
| 738 | |
| 739 | |
| 740 | |
| 741 | _CmdHeader.VtxOffset = VtxBuffer.Size; |
| 742 | _OnChangedVtxOffset(); |
| 743 | } |
| 744 | |
| 745 | ImDrawCmd* draw_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; |
| 746 | draw_cmd->ElemCount += idx_count; |
| 747 | |
| 748 | int vtx_buffer_old_size = VtxBuffer.Size; |
| 749 | VtxBuffer.resize(vtx_buffer_old_size + vtx_count); |
| 750 | _VtxWritePtr = VtxBuffer.Data + vtx_buffer_old_size; |
| 751 | |
| 752 | int idx_buffer_old_size = IdxBuffer.Size; |
| 753 | IdxBuffer.resize(idx_buffer_old_size + idx_count); |
| 754 | _IdxWritePtr = IdxBuffer.Data + idx_buffer_old_size; |
| 755 | } |
| 756 | |
| 757 | |
| 758 | void ImDrawList::PrimUnreserve(int idx_count, int vtx_count) |
| 759 | { |
| 760 | IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0); |
| 761 | |
| 762 | ImDrawCmd* draw_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; |
| 763 | draw_cmd->ElemCount -= idx_count; |
| 764 | VtxBuffer.shrink(VtxBuffer.Size - vtx_count); |
| 765 | IdxBuffer.shrink(IdxBuffer.Size - idx_count); |
| 766 | } |
| 767 | |
| 768 | |
| 769 | void ImDrawList::PrimRect(const ImVec2& a, const ImVec2& c, ImU32 col) |
| 770 | { |
| 771 | ImVec2 b(c.x, a.y), d(a.x, c.y), uv(_Data->TexUvWhitePixel); |
| 772 | ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx; |
| 773 | _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2); |
| 774 | _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3); |
| 775 | _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col; |
| 776 | _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col; |
| 777 | _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv; _VtxWritePtr[2].col = col; |
| 778 | _VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv; _VtxWritePtr[3].col = col; |
| 779 | _VtxWritePtr += 4; |
| 780 | _VtxCurrentIdx += 4; |
| 781 | _IdxWritePtr += 6; |
| 782 | } |
| 783 | |
| 784 | void ImDrawList::PrimRectUV(const ImVec2& a, const ImVec2& c, const ImVec2& uv_a, const ImVec2& uv_c, ImU32 col) |
| 785 | { |
| 786 | ImVec2 b(c.x, a.y), d(a.x, c.y), uv_b(uv_c.x, uv_a.y), uv_d(uv_a.x, uv_c.y); |
| 787 | ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx; |
| 788 | _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2); |
| 789 | _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3); |
| 790 | _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv_a; _VtxWritePtr[0].col = col; |
| 791 | _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv_b; _VtxWritePtr[1].col = col; |
| 792 | _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv_c; _VtxWritePtr[2].col = col; |
| 793 | _VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv_d; _VtxWritePtr[3].col = col; |
| 794 | _VtxWritePtr += 4; |
| 795 | _VtxCurrentIdx += 4; |
| 796 | _IdxWritePtr += 6; |
| 797 | } |
| 798 | |
| 799 | void ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col) |
| 800 | { |
| 801 | ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx; |
| 802 | _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2); |
| 803 | _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3); |
| 804 | _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv_a; _VtxWritePtr[0].col = col; |
| 805 | _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv_b; _VtxWritePtr[1].col = col; |
| 806 | _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv_c; _VtxWritePtr[2].col = col; |
| 807 | _VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv_d; _VtxWritePtr[3].col = col; |
| 808 | _VtxWritePtr += 4; |
| 809 | _VtxCurrentIdx += 4; |
| 810 | _IdxWritePtr += 6; |
| 811 | } |
| 812 | |
| 813 | |
| 814 | |
| 815 | |
| 816 | #define IM_NORMALIZE2F_OVER_ZERO(VX,VY) { float d2 = VX*VX + VY*VY; if (d2 > 0.0f) { float inv_len = ImRsqrt(d2); VX *= inv_len; VY *= inv_len; } } (void)0 |
| 817 | #define IM_FIXNORMAL2F_MAX_INVLEN2 100.0f |
| 818 | #define IM_FIXNORMAL2F(VX,VY) { float d2 = VX*VX + VY*VY; if (d2 > 0.000001f) { float inv_len2 = 1.0f / d2; if (inv_len2 > IM_FIXNORMAL2F_MAX_INVLEN2) inv_len2 = IM_FIXNORMAL2F_MAX_INVLEN2; VX *= inv_len2; VY *= inv_len2; } } (void)0 |
| 819 | |
| 820 | |
| 821 | |
| 822 | void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 col, float thickness, ImDrawFlags flags) |
| 823 | { |
| 824 | if (points_count < 2 || (col & IM_COL32_A_MASK) == 0) |
| 825 | return; |
| 826 | |
| 827 | const bool closed = (flags & ImDrawFlags_Closed) != 0; |
| 828 | const ImVec2 opaque_uv = _Data->TexUvWhitePixel; |
| 829 | const int count = closed ? points_count : points_count - 1; |
| 830 | const bool thick_line = (thickness > _FringeScale); |
| 831 | |
| 832 | |
| 833 | |
| 834 | |
| 835 | |
| 836 | IM_ASSERT_USER_ERROR_RET((flags & ImDrawFlags_InvalidMask_) == 0, "Incorrect parameter. Did you swap 'thickness' and 'flags'?"); |
| 837 | |
| 838 | if (Flags & ImDrawListFlags_AntiAliasedLines) |
| 839 | { |
| 840 | |
| 841 | const float AA_SIZE = _FringeScale; |
| 842 | const ImU32 col_trans = col & ~IM_COL32_A_MASK; |
| 843 | |
| 844 | |
| 845 | thickness = ImMax(thickness, 1.0f); |
| 846 | const int integer_thickness = (int)thickness; |
| 847 | const float fractional_thickness = thickness - integer_thickness; |
| 848 | |
| 849 | |
| 850 | |
| 851 | |
| 852 | const bool use_texture = (Flags & ImDrawListFlags_AntiAliasedLinesUseTex) && (integer_thickness < IM_DRAWLIST_TEX_LINES_WIDTH_MAX) && (fractional_thickness <= 0.00001f) && (AA_SIZE == 1.0f); |
| 853 | |
| 854 | |
| 855 | IM_ASSERT_PARANOID(!use_texture || !(_Data->Font->OwnerAtlas->Flags & ImFontAtlasFlags_NoBakedLines)); |
| 856 | |
| 857 | const int idx_count = use_texture ? (count * 6) : (thick_line ? count * 18 : count * 12); |
| 858 | const int vtx_count = use_texture ? (points_count * 2) : (thick_line ? points_count * 4 : points_count * 3); |
| 859 | PrimReserve(idx_count, vtx_count); |
| 860 | |
| 861 | |
| 862 | |
| 863 | _Data->TempBuffer.reserve_discard(points_count * ((use_texture || !thick_line) ? 3 : 5)); |
| 864 | ImVec2* temp_normals = _Data->TempBuffer.Data; |
| 865 | ImVec2* temp_points = temp_normals + points_count; |
| 866 | |
| 867 | |
| 868 | for (int i1 = 0; i1 < count; i1++) |
| 869 | { |
| 870 | const int i2 = (i1 + 1) == points_count ? 0 : i1 + 1; |
| 871 | float dx = points[i2].x - points[i1].x; |
| 872 | float dy = points[i2].y - points[i1].y; |
| 873 | IM_NORMALIZE2F_OVER_ZERO(dx, dy); |
| 874 | temp_normals[i1].x = dy; |
| 875 | temp_normals[i1].y = -dx; |
| 876 | } |
| 877 | if (!closed) |
| 878 | temp_normals[points_count - 1] = temp_normals[points_count - 2]; |
| 879 | |
| 880 | |
| 881 | if (use_texture || !thick_line) |
| 882 | { |
| 883 | |
| 884 | |
| 885 | |
| 886 | |
| 887 | |
| 888 | |
| 889 | |
| 890 | |
| 891 | const float half_draw_size = use_texture ? ((thickness * 0.5f) + 1) : AA_SIZE; |
| 892 | |
| 893 | |
| 894 | if (!closed) |
| 895 | { |
| 896 | temp_points[0] = points[0] + temp_normals[0] * half_draw_size; |
| 897 | temp_points[1] = points[0] - temp_normals[0] * half_draw_size; |
| 898 | temp_points[(points_count-1)*2+0] = points[points_count-1] + temp_normals[points_count-1] * half_draw_size; |
| 899 | temp_points[(points_count-1)*2+1] = points[points_count-1] - temp_normals[points_count-1] * half_draw_size; |
| 900 | } |
| 901 | |
| 902 | |
| 903 | |
| 904 | |
| 905 | unsigned int idx1 = _VtxCurrentIdx; |
| 906 | for (int i1 = 0; i1 < count; i1++) |
| 907 | { |
| 908 | const int i2 = (i1 + 1) == points_count ? 0 : i1 + 1; |
| 909 | const unsigned int idx2 = ((i1 + 1) == points_count) ? _VtxCurrentIdx : (idx1 + (use_texture ? 2 : 3)); |
| 910 | |
| 911 | |
| 912 | float dm_x = (temp_normals[i1].x + temp_normals[i2].x) * 0.5f; |
| 913 | float dm_y = (temp_normals[i1].y + temp_normals[i2].y) * 0.5f; |
| 914 | IM_FIXNORMAL2F(dm_x, dm_y); |
| 915 | dm_x *= half_draw_size; |
| 916 | dm_y *= half_draw_size; |
| 917 | |
| 918 | |
| 919 | ImVec2* out_vtx = &temp_points[i2 * 2]; |
| 920 | out_vtx[0].x = points[i2].x + dm_x; |
| 921 | out_vtx[0].y = points[i2].y + dm_y; |
| 922 | out_vtx[1].x = points[i2].x - dm_x; |
| 923 | out_vtx[1].y = points[i2].y - dm_y; |
| 924 | |
| 925 | if (use_texture) |
| 926 | { |
| 927 | |
| 928 | _IdxWritePtr[0] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[1] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[2] = (ImDrawIdx)(idx1 + 1); |
| 929 | _IdxWritePtr[3] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[4] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[5] = (ImDrawIdx)(idx2 + 0); |
| 930 | _IdxWritePtr += 6; |
| 931 | } |
| 932 | else |
| 933 | { |
| 934 | |
| 935 | _IdxWritePtr[0] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[1] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[2] = (ImDrawIdx)(idx1 + 2); |
| 936 | _IdxWritePtr[3] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[4] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[5] = (ImDrawIdx)(idx2 + 0); |
| 937 | _IdxWritePtr[6] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[7] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[8] = (ImDrawIdx)(idx1 + 0); |
| 938 | _IdxWritePtr[9] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[10] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[11] = (ImDrawIdx)(idx2 + 1); |
| 939 | _IdxWritePtr += 12; |
| 940 | } |
| 941 | |
| 942 | idx1 = idx2; |
| 943 | } |
| 944 | |
| 945 | |
| 946 | if (use_texture) |
| 947 | { |
| 948 | |
| 949 | ImVec4 tex_uvs = _Data->TexUvLines[integer_thickness]; |
| 950 | |
| 951 | |
| 952 | |
| 953 | |
| 954 | |
| 955 | |
| 956 | |
| 957 | |
| 958 | ImVec2 tex_uv0(tex_uvs.x, tex_uvs.y); |
| 959 | ImVec2 tex_uv1(tex_uvs.z, tex_uvs.w); |
| 960 | for (int i = 0; i < points_count; i++) |
| 961 | { |
| 962 | _VtxWritePtr[0].pos = temp_points[i * 2 + 0]; _VtxWritePtr[0].uv = tex_uv0; _VtxWritePtr[0].col = col; |
| 963 | _VtxWritePtr[1].pos = temp_points[i * 2 + 1]; _VtxWritePtr[1].uv = tex_uv1; _VtxWritePtr[1].col = col; |
| 964 | _VtxWritePtr += 2; |
| 965 | } |
| 966 | } |
| 967 | else |
| 968 | { |
| 969 | |
| 970 | for (int i = 0; i < points_count; i++) |
| 971 | { |
| 972 | _VtxWritePtr[0].pos = points[i]; _VtxWritePtr[0].uv = opaque_uv; _VtxWritePtr[0].col = col; |
| 973 | _VtxWritePtr[1].pos = temp_points[i * 2 + 0]; _VtxWritePtr[1].uv = opaque_uv; _VtxWritePtr[1].col = col_trans; |
| 974 | _VtxWritePtr[2].pos = temp_points[i * 2 + 1]; _VtxWritePtr[2].uv = opaque_uv; _VtxWritePtr[2].col = col_trans; |
| 975 | _VtxWritePtr += 3; |
| 976 | } |
| 977 | } |
| 978 | } |
| 979 | else |
| 980 | { |
| 981 | |
| 982 | const float half_inner_thickness = (thickness - AA_SIZE) * 0.5f; |
| 983 | |
| 984 | |
| 985 | if (!closed) |
| 986 | { |
| 987 | const int points_last = points_count - 1; |
| 988 | temp_points[0] = points[0] + temp_normals[0] * (half_inner_thickness + AA_SIZE); |
| 989 | temp_points[1] = points[0] + temp_normals[0] * (half_inner_thickness); |
| 990 | temp_points[2] = points[0] - temp_normals[0] * (half_inner_thickness); |
| 991 | temp_points[3] = points[0] - temp_normals[0] * (half_inner_thickness + AA_SIZE); |
| 992 | temp_points[points_last * 4 + 0] = points[points_last] + temp_normals[points_last] * (half_inner_thickness + AA_SIZE); |
| 993 | temp_points[points_last * 4 + 1] = points[points_last] + temp_normals[points_last] * (half_inner_thickness); |
| 994 | temp_points[points_last * 4 + 2] = points[points_last] - temp_normals[points_last] * (half_inner_thickness); |
| 995 | temp_points[points_last * 4 + 3] = points[points_last] - temp_normals[points_last] * (half_inner_thickness + AA_SIZE); |
| 996 | } |
| 997 | |
| 998 | |
| 999 | |
| 1000 | |
| 1001 | unsigned int idx1 = _VtxCurrentIdx; |
| 1002 | for (int i1 = 0; i1 < count; i1++) |
| 1003 | { |
| 1004 | const int i2 = (i1 + 1) == points_count ? 0 : (i1 + 1); |
| 1005 | const unsigned int idx2 = (i1 + 1) == points_count ? _VtxCurrentIdx : (idx1 + 4); |
| 1006 | |
| 1007 | |
| 1008 | float dm_x = (temp_normals[i1].x + temp_normals[i2].x) * 0.5f; |
| 1009 | float dm_y = (temp_normals[i1].y + temp_normals[i2].y) * 0.5f; |
| 1010 | IM_FIXNORMAL2F(dm_x, dm_y); |
| 1011 | float dm_out_x = dm_x * (half_inner_thickness + AA_SIZE); |
| 1012 | float dm_out_y = dm_y * (half_inner_thickness + AA_SIZE); |
| 1013 | float dm_in_x = dm_x * half_inner_thickness; |
| 1014 | float dm_in_y = dm_y * half_inner_thickness; |
| 1015 | |
| 1016 | |
| 1017 | ImVec2* out_vtx = &temp_points[i2 * 4]; |
| 1018 | out_vtx[0].x = points[i2].x + dm_out_x; |
| 1019 | out_vtx[0].y = points[i2].y + dm_out_y; |
| 1020 | out_vtx[1].x = points[i2].x + dm_in_x; |
| 1021 | out_vtx[1].y = points[i2].y + dm_in_y; |
| 1022 | out_vtx[2].x = points[i2].x - dm_in_x; |
| 1023 | out_vtx[2].y = points[i2].y - dm_in_y; |
| 1024 | out_vtx[3].x = points[i2].x - dm_out_x; |
| 1025 | out_vtx[3].y = points[i2].y - dm_out_y; |
| 1026 | |
| 1027 | |
| 1028 | _IdxWritePtr[0] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[1] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[2] = (ImDrawIdx)(idx1 + 2); |
| 1029 | _IdxWritePtr[3] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[4] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[5] = (ImDrawIdx)(idx2 + 1); |
| 1030 | _IdxWritePtr[6] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[7] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[8] = (ImDrawIdx)(idx1 + 0); |
| 1031 | _IdxWritePtr[9] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[10] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[11] = (ImDrawIdx)(idx2 + 1); |
| 1032 | _IdxWritePtr[12] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[13] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[14] = (ImDrawIdx)(idx1 + 3); |
| 1033 | _IdxWritePtr[15] = (ImDrawIdx)(idx1 + 3); _IdxWritePtr[16] = (ImDrawIdx)(idx2 + 3); _IdxWritePtr[17] = (ImDrawIdx)(idx2 + 2); |
| 1034 | _IdxWritePtr += 18; |
| 1035 | |
| 1036 | idx1 = idx2; |
| 1037 | } |
| 1038 | |
| 1039 | |
| 1040 | for (int i = 0; i < points_count; i++) |
| 1041 | { |
| 1042 | _VtxWritePtr[0].pos = temp_points[i * 4 + 0]; _VtxWritePtr[0].uv = opaque_uv; _VtxWritePtr[0].col = col_trans; |
| 1043 | _VtxWritePtr[1].pos = temp_points[i * 4 + 1]; _VtxWritePtr[1].uv = opaque_uv; _VtxWritePtr[1].col = col; |
| 1044 | _VtxWritePtr[2].pos = temp_points[i * 4 + 2]; _VtxWritePtr[2].uv = opaque_uv; _VtxWritePtr[2].col = col; |
| 1045 | _VtxWritePtr[3].pos = temp_points[i * 4 + 3]; _VtxWritePtr[3].uv = opaque_uv; _VtxWritePtr[3].col = col_trans; |
| 1046 | _VtxWritePtr += 4; |
| 1047 | } |
| 1048 | } |
| 1049 | _VtxCurrentIdx += (ImDrawIdx)vtx_count; |
| 1050 | } |
| 1051 | else |
| 1052 | { |
| 1053 | |
| 1054 | const int idx_count = count * 6; |
| 1055 | const int vtx_count = count * 4; |
| 1056 | PrimReserve(idx_count, vtx_count); |
| 1057 | |
| 1058 | for (int i1 = 0; i1 < count; i1++) |
| 1059 | { |
| 1060 | const int i2 = (i1 + 1) == points_count ? 0 : i1 + 1; |
| 1061 | const ImVec2& p1 = points[i1]; |
| 1062 | const ImVec2& p2 = points[i2]; |
| 1063 | |
| 1064 | float dx = p2.x - p1.x; |
| 1065 | float dy = p2.y - p1.y; |
| 1066 | IM_NORMALIZE2F_OVER_ZERO(dx, dy); |
| 1067 | dx *= (thickness * 0.5f); |
| 1068 | dy *= (thickness * 0.5f); |
| 1069 | |
| 1070 | _VtxWritePtr[0].pos.x = p1.x + dy; _VtxWritePtr[0].pos.y = p1.y - dx; _VtxWritePtr[0].uv = opaque_uv; _VtxWritePtr[0].col = col; |
| 1071 | _VtxWritePtr[1].pos.x = p2.x + dy; _VtxWritePtr[1].pos.y = p2.y - dx; _VtxWritePtr[1].uv = opaque_uv; _VtxWritePtr[1].col = col; |
| 1072 | _VtxWritePtr[2].pos.x = p2.x - dy; _VtxWritePtr[2].pos.y = p2.y + dx; _VtxWritePtr[2].uv = opaque_uv; _VtxWritePtr[2].col = col; |
| 1073 | _VtxWritePtr[3].pos.x = p1.x - dy; _VtxWritePtr[3].pos.y = p1.y + dx; _VtxWritePtr[3].uv = opaque_uv; _VtxWritePtr[3].col = col; |
| 1074 | _VtxWritePtr += 4; |
| 1075 | |
| 1076 | _IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx + 1); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx + 2); |
| 1077 | _IdxWritePtr[3] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[4] = (ImDrawIdx)(_VtxCurrentIdx + 2); _IdxWritePtr[5] = (ImDrawIdx)(_VtxCurrentIdx + 3); |
| 1078 | _IdxWritePtr += 6; |
| 1079 | _VtxCurrentIdx += 4; |
| 1080 | } |
| 1081 | } |
| 1082 | } |
| 1083 | |
| 1084 | |
| 1085 | |
| 1086 | void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col) |
| 1087 | { |
| 1088 | if (points_count < 3 || (col & IM_COL32_A_MASK) == 0) |
| 1089 | return; |
| 1090 | |
| 1091 | const ImVec2 uv = _Data->TexUvWhitePixel; |
| 1092 | |
| 1093 | if (Flags & ImDrawListFlags_AntiAliasedFill) |
| 1094 | { |
| 1095 | |
| 1096 | const float AA_SIZE = _FringeScale; |
| 1097 | const ImU32 col_trans = col & ~IM_COL32_A_MASK; |
| 1098 | const int idx_count = (points_count - 2)*3 + points_count * 6; |
| 1099 | const int vtx_count = (points_count * 2); |
| 1100 | PrimReserve(idx_count, vtx_count); |
| 1101 | |
| 1102 | |
| 1103 | unsigned int vtx_inner_idx = _VtxCurrentIdx; |
| 1104 | unsigned int vtx_outer_idx = _VtxCurrentIdx + 1; |
| 1105 | for (int i = 2; i < points_count; i++) |
| 1106 | { |
| 1107 | _IdxWritePtr[0] = (ImDrawIdx)(vtx_inner_idx); _IdxWritePtr[1] = (ImDrawIdx)(vtx_inner_idx + ((i - 1) << 1)); _IdxWritePtr[2] = (ImDrawIdx)(vtx_inner_idx + (i << 1)); |
| 1108 | _IdxWritePtr += 3; |
| 1109 | } |
| 1110 | |
| 1111 | |
| 1112 | _Data->TempBuffer.reserve_discard(points_count); |
| 1113 | ImVec2* temp_normals = _Data->TempBuffer.Data; |
| 1114 | for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++) |
| 1115 | { |
| 1116 | const ImVec2& p0 = points[i0]; |
| 1117 | const ImVec2& p1 = points[i1]; |
| 1118 | float dx = p1.x - p0.x; |
| 1119 | float dy = p1.y - p0.y; |
| 1120 | IM_NORMALIZE2F_OVER_ZERO(dx, dy); |
| 1121 | temp_normals[i0].x = dy; |
| 1122 | temp_normals[i0].y = -dx; |
| 1123 | } |
| 1124 | |
| 1125 | for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++) |
| 1126 | { |
| 1127 | |
| 1128 | const ImVec2& n0 = temp_normals[i0]; |
| 1129 | const ImVec2& n1 = temp_normals[i1]; |
| 1130 | float dm_x = (n0.x + n1.x) * 0.5f; |
| 1131 | float dm_y = (n0.y + n1.y) * 0.5f; |
| 1132 | IM_FIXNORMAL2F(dm_x, dm_y); |
| 1133 | dm_x *= AA_SIZE * 0.5f; |
| 1134 | dm_y *= AA_SIZE * 0.5f; |
| 1135 | |
| 1136 | |
| 1137 | _VtxWritePtr[0].pos.x = (points[i1].x - dm_x); _VtxWritePtr[0].pos.y = (points[i1].y - dm_y); _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col; |
| 1138 | _VtxWritePtr[1].pos.x = (points[i1].x + dm_x); _VtxWritePtr[1].pos.y = (points[i1].y + dm_y); _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col_trans; |
| 1139 | _VtxWritePtr += 2; |
| 1140 | |
| 1141 | |
| 1142 | _IdxWritePtr[0] = (ImDrawIdx)(vtx_inner_idx + (i1 << 1)); _IdxWritePtr[1] = (ImDrawIdx)(vtx_inner_idx + (i0 << 1)); _IdxWritePtr[2] = (ImDrawIdx)(vtx_outer_idx + (i0 << 1)); |
| 1143 | _IdxWritePtr[3] = (ImDrawIdx)(vtx_outer_idx + (i0 << 1)); _IdxWritePtr[4] = (ImDrawIdx)(vtx_outer_idx + (i1 << 1)); _IdxWritePtr[5] = (ImDrawIdx)(vtx_inner_idx + (i1 << 1)); |
| 1144 | _IdxWritePtr += 6; |
| 1145 | } |
| 1146 | _VtxCurrentIdx += (ImDrawIdx)vtx_count; |
| 1147 | } |
| 1148 | else |
| 1149 | { |
| 1150 | |
| 1151 | const int idx_count = (points_count - 2)*3; |
| 1152 | const int vtx_count = points_count; |
| 1153 | PrimReserve(idx_count, vtx_count); |
| 1154 | for (int i = 0; i < vtx_count; i++) |
| 1155 | { |
| 1156 | _VtxWritePtr[0].pos = points[i]; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col; |
| 1157 | _VtxWritePtr++; |
| 1158 | } |
| 1159 | for (int i = 2; i < points_count; i++) |
| 1160 | { |
| 1161 | _IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx + i - 1); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx + i); |
| 1162 | _IdxWritePtr += 3; |
| 1163 | } |
| 1164 | _VtxCurrentIdx += (ImDrawIdx)vtx_count; |
| 1165 | } |
| 1166 | } |
| 1167 | |
| 1168 | void ImDrawList::_PathArcToFastEx(const ImVec2& center, float radius, int a_min_sample, int a_max_sample, int a_step) |
| 1169 | { |
| 1170 | if (radius < 0.5f) |
| 1171 | { |
| 1172 | _Path.push_back(center); |
| 1173 | return; |
| 1174 | } |
| 1175 | |
| 1176 | |
| 1177 | if (a_step <= 0) |
| 1178 | a_step = IM_DRAWLIST_ARCFAST_SAMPLE_MAX / _CalcCircleAutoSegmentCount(radius); |
| 1179 | |
| 1180 | |
| 1181 | a_step = ImClamp(a_step, 1, IM_DRAWLIST_ARCFAST_TABLE_SIZE / 4); |
| 1182 | |
| 1183 | const int sample_range = ImAbs(a_max_sample - a_min_sample); |
| 1184 | const int a_next_step = a_step; |
| 1185 | |
| 1186 | int samples = sample_range + 1; |
| 1187 | bool extra_max_sample = false; |
| 1188 | if (a_step > 1) |
| 1189 | { |
| 1190 | samples = sample_range / a_step + 1; |
| 1191 | const int overstep = sample_range % a_step; |
| 1192 | |
| 1193 | if (overstep > 0) |
| 1194 | { |
| 1195 | extra_max_sample = true; |
| 1196 | samples++; |
| 1197 | |
| 1198 | |
| 1199 | |
| 1200 | if (sample_range > 0) |
| 1201 | a_step -= (a_step - overstep) / 2; |
| 1202 | } |
| 1203 | } |
| 1204 | |
| 1205 | _Path.resize(_Path.Size + samples); |
| 1206 | ImVec2* out_ptr = _Path.Data + (_Path.Size - samples); |
| 1207 | |
| 1208 | int sample_index = a_min_sample; |
| 1209 | if (sample_index < 0 || sample_index >= IM_DRAWLIST_ARCFAST_SAMPLE_MAX) |
| 1210 | { |
| 1211 | sample_index = sample_index % IM_DRAWLIST_ARCFAST_SAMPLE_MAX; |
| 1212 | if (sample_index < 0) |
| 1213 | sample_index += IM_DRAWLIST_ARCFAST_SAMPLE_MAX; |
| 1214 | } |
| 1215 | |
| 1216 | if (a_max_sample >= a_min_sample) |
| 1217 | { |
| 1218 | for (int a = a_min_sample; a <= a_max_sample; a += a_step, sample_index += a_step, a_step = a_next_step) |
| 1219 | { |
| 1220 | |
| 1221 | if (sample_index >= IM_DRAWLIST_ARCFAST_SAMPLE_MAX) |
| 1222 | sample_index -= IM_DRAWLIST_ARCFAST_SAMPLE_MAX; |
| 1223 | |
| 1224 | const ImVec2 s = _Data->ArcFastVtx[sample_index]; |
| 1225 | out_ptr->x = center.x + s.x * radius; |
| 1226 | out_ptr->y = center.y + s.y * radius; |
| 1227 | out_ptr++; |
| 1228 | } |
| 1229 | } |
| 1230 | else |
| 1231 | { |
| 1232 | for (int a = a_min_sample; a >= a_max_sample; a -= a_step, sample_index -= a_step, a_step = a_next_step) |
| 1233 | { |
| 1234 | |
| 1235 | if (sample_index < 0) |
| 1236 | sample_index += IM_DRAWLIST_ARCFAST_SAMPLE_MAX; |
| 1237 | |
| 1238 | const ImVec2 s = _Data->ArcFastVtx[sample_index]; |
| 1239 | out_ptr->x = center.x + s.x * radius; |
| 1240 | out_ptr->y = center.y + s.y * radius; |
| 1241 | out_ptr++; |
| 1242 | } |
| 1243 | } |
| 1244 | |
| 1245 | if (extra_max_sample) |
| 1246 | { |
| 1247 | int normalized_max_sample = a_max_sample % IM_DRAWLIST_ARCFAST_SAMPLE_MAX; |
| 1248 | if (normalized_max_sample < 0) |
| 1249 | normalized_max_sample += IM_DRAWLIST_ARCFAST_SAMPLE_MAX; |
| 1250 | |
| 1251 | const ImVec2 s = _Data->ArcFastVtx[normalized_max_sample]; |
| 1252 | out_ptr->x = center.x + s.x * radius; |
| 1253 | out_ptr->y = center.y + s.y * radius; |
| 1254 | out_ptr++; |
| 1255 | } |
| 1256 | |
| 1257 | IM_ASSERT_PARANOID(_Path.Data + _Path.Size == out_ptr); |
| 1258 | } |
| 1259 | |
| 1260 | void ImDrawList::_PathArcToN(const ImVec2& center, float radius, float a_min, float a_max, int num_segments) |
| 1261 | { |
| 1262 | if (radius < 0.5f) |
| 1263 | { |
| 1264 | _Path.push_back(center); |
| 1265 | return; |
| 1266 | } |
| 1267 | |
| 1268 | |
| 1269 | |
| 1270 | _Path.reserve(_Path.Size + (num_segments + 1)); |
| 1271 | for (int i = 0; i <= num_segments; i++) |
| 1272 | { |
| 1273 | const float a = a_min + ((float)i / (float)num_segments) * (a_max - a_min); |
| 1274 | _Path.push_back(ImVec2(center.x + ImCos(a) * radius, center.y + ImSin(a) * radius)); |
| 1275 | } |
| 1276 | } |
| 1277 | |
| 1278 | |
| 1279 | void ImDrawList::PathArcToFast(const ImVec2& center, float radius, int a_min_of_12, int a_max_of_12) |
| 1280 | { |
| 1281 | if (radius < 0.5f) |
| 1282 | { |
| 1283 | _Path.push_back(center); |
| 1284 | return; |
| 1285 | } |
| 1286 | _PathArcToFastEx(center, radius, a_min_of_12 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, a_max_of_12 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0); |
| 1287 | } |
| 1288 | |
| 1289 | void ImDrawList::PathArcTo(const ImVec2& center, float radius, float a_min, float a_max, int num_segments) |
| 1290 | { |
| 1291 | if (radius < 0.5f) |
| 1292 | { |
| 1293 | _Path.push_back(center); |
| 1294 | return; |
| 1295 | } |
| 1296 | |
| 1297 | if (num_segments > 0) |
| 1298 | { |
| 1299 | _PathArcToN(center, radius, a_min, a_max, num_segments); |
| 1300 | return; |
| 1301 | } |
| 1302 | |
| 1303 | |
| 1304 | if (radius <= _Data->ArcFastRadiusCutoff) |
| 1305 | { |
| 1306 | const bool a_is_reverse = a_max < a_min; |
| 1307 | |
| 1308 | |
| 1309 | |
| 1310 | const float a_min_sample_f = IM_DRAWLIST_ARCFAST_SAMPLE_MAX * a_min / (IM_PI * 2.0f); |
| 1311 | const float a_max_sample_f = IM_DRAWLIST_ARCFAST_SAMPLE_MAX * a_max / (IM_PI * 2.0f); |
| 1312 | |
| 1313 | const int a_min_sample = a_is_reverse ? (int)ImFloor(a_min_sample_f) : (int)ImCeil(a_min_sample_f); |
| 1314 | const int a_max_sample = a_is_reverse ? (int)ImCeil(a_max_sample_f) : (int)ImFloor(a_max_sample_f); |
| 1315 | const int a_mid_samples = a_is_reverse ? ImMax(a_min_sample - a_max_sample, 0) : ImMax(a_max_sample - a_min_sample, 0); |
| 1316 | |
| 1317 | const float a_min_segment_angle = a_min_sample * IM_PI * 2.0f / IM_DRAWLIST_ARCFAST_SAMPLE_MAX; |
| 1318 | const float a_max_segment_angle = a_max_sample * IM_PI * 2.0f / IM_DRAWLIST_ARCFAST_SAMPLE_MAX; |
| 1319 | const bool a_emit_start = ImAbs(a_min_segment_angle - a_min) >= 1e-5f; |
| 1320 | const bool a_emit_end = ImAbs(a_max - a_max_segment_angle) >= 1e-5f; |
| 1321 | |
| 1322 | _Path.reserve(_Path.Size + (a_mid_samples + 1 + (a_emit_start ? 1 : 0) + (a_emit_end ? 1 : 0))); |
| 1323 | if (a_emit_start) |
| 1324 | _Path.push_back(ImVec2(center.x + ImCos(a_min) * radius, center.y + ImSin(a_min) * radius)); |
| 1325 | if (a_mid_samples > 0) |
| 1326 | _PathArcToFastEx(center, radius, a_min_sample, a_max_sample, 0); |
| 1327 | if (a_emit_end) |
| 1328 | _Path.push_back(ImVec2(center.x + ImCos(a_max) * radius, center.y + ImSin(a_max) * radius)); |
| 1329 | } |
| 1330 | else |
| 1331 | { |
| 1332 | const float arc_length = ImAbs(a_max - a_min); |
| 1333 | const int circle_segment_count = _CalcCircleAutoSegmentCount(radius); |
| 1334 | const int arc_segment_count = ImMax((int)ImCeil(circle_segment_count * arc_length / (IM_PI * 2.0f)), 1); |
| 1335 | _PathArcToN(center, radius, a_min, a_max, arc_segment_count); |
| 1336 | } |
| 1337 | } |
| 1338 | |
| 1339 | void ImDrawList::PathEllipticalArcTo(const ImVec2& center, const ImVec2& radius, float rot, float a_min, float a_max, int num_segments) |
| 1340 | { |
| 1341 | if (num_segments <= 0) |
| 1342 | num_segments = _CalcCircleAutoSegmentCount(ImMax(radius.x, radius.y)); |
| 1343 | |
| 1344 | _Path.reserve(_Path.Size + (num_segments + 1)); |
| 1345 | |
| 1346 | const float cos_rot = ImCos(rot); |
| 1347 | const float sin_rot = ImSin(rot); |
| 1348 | for (int i = 0; i <= num_segments; i++) |
| 1349 | { |
| 1350 | const float a = a_min + ((float)i / (float)num_segments) * (a_max - a_min); |
| 1351 | ImVec2 point(ImCos(a) * radius.x, ImSin(a) * radius.y); |
| 1352 | const ImVec2 rel((point.x * cos_rot) - (point.y * sin_rot), (point.x * sin_rot) + (point.y * cos_rot)); |
| 1353 | point.x = rel.x + center.x; |
| 1354 | point.y = rel.y + center.y; |
| 1355 | _Path.push_back(point); |
| 1356 | } |
| 1357 | } |
| 1358 | |
| 1359 | ImVec2 ImBezierCubicCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, float t) |
| 1360 | { |
| 1361 | float u = 1.0f - t; |
| 1362 | float w1 = u * u * u; |
| 1363 | float w2 = 3 * u * u * t; |
| 1364 | float w3 = 3 * u * t * t; |
| 1365 | float w4 = t * t * t; |
| 1366 | return ImVec2(w1 * p1.x + w2 * p2.x + w3 * p3.x + w4 * p4.x, w1 * p1.y + w2 * p2.y + w3 * p3.y + w4 * p4.y); |
| 1367 | } |
| 1368 | |
| 1369 | ImVec2 ImBezierQuadraticCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, float t) |
| 1370 | { |
| 1371 | float u = 1.0f - t; |
| 1372 | float w1 = u * u; |
| 1373 | float w2 = 2 * u * t; |
| 1374 | float w3 = t * t; |
| 1375 | return ImVec2(w1 * p1.x + w2 * p2.x + w3 * p3.x, w1 * p1.y + w2 * p2.y + w3 * p3.y); |
| 1376 | } |
| 1377 | |
| 1378 | |
| 1379 | static void PathBezierCubicCurveToCasteljau(ImVector<ImVec2>* path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float tess_tol, int level) |
| 1380 | { |
| 1381 | float dx = x4 - x1; |
| 1382 | float dy = y4 - y1; |
| 1383 | float d2 = (x2 - x4) * dy - (y2 - y4) * dx; |
| 1384 | float d3 = (x3 - x4) * dy - (y3 - y4) * dx; |
| 1385 | d2 = (d2 >= 0) ? d2 : -d2; |
| 1386 | d3 = (d3 >= 0) ? d3 : -d3; |
| 1387 | if ((d2 + d3) * (d2 + d3) < tess_tol * (dx * dx + dy * dy)) |
| 1388 | { |
| 1389 | path->push_back(ImVec2(x4, y4)); |
| 1390 | } |
| 1391 | else if (level < 10) |
| 1392 | { |
| 1393 | float x12 = (x1 + x2) * 0.5f, y12 = (y1 + y2) * 0.5f; |
| 1394 | float x23 = (x2 + x3) * 0.5f, y23 = (y2 + y3) * 0.5f; |
| 1395 | float x34 = (x3 + x4) * 0.5f, y34 = (y3 + y4) * 0.5f; |
| 1396 | float x123 = (x12 + x23) * 0.5f, y123 = (y12 + y23) * 0.5f; |
| 1397 | float x234 = (x23 + x34) * 0.5f, y234 = (y23 + y34) * 0.5f; |
| 1398 | float x1234 = (x123 + x234) * 0.5f, y1234 = (y123 + y234) * 0.5f; |
| 1399 | PathBezierCubicCurveToCasteljau(path, x1, y1, x12, y12, x123, y123, x1234, y1234, tess_tol, level + 1); |
| 1400 | PathBezierCubicCurveToCasteljau(path, x1234, y1234, x234, y234, x34, y34, x4, y4, tess_tol, level + 1); |
| 1401 | } |
| 1402 | } |
| 1403 | |
| 1404 | static void PathBezierQuadraticCurveToCasteljau(ImVector<ImVec2>* path, float x1, float y1, float x2, float y2, float x3, float y3, float tess_tol, int level) |
| 1405 | { |
| 1406 | float dx = x3 - x1, dy = y3 - y1; |
| 1407 | float det = (x2 - x3) * dy - (y2 - y3) * dx; |
| 1408 | if (det * det * 4.0f < tess_tol * (dx * dx + dy * dy)) |
| 1409 | { |
| 1410 | path->push_back(ImVec2(x3, y3)); |
| 1411 | } |
| 1412 | else if (level < 10) |
| 1413 | { |
| 1414 | float x12 = (x1 + x2) * 0.5f, y12 = (y1 + y2) * 0.5f; |
| 1415 | float x23 = (x2 + x3) * 0.5f, y23 = (y2 + y3) * 0.5f; |
| 1416 | float x123 = (x12 + x23) * 0.5f, y123 = (y12 + y23) * 0.5f; |
| 1417 | PathBezierQuadraticCurveToCasteljau(path, x1, y1, x12, y12, x123, y123, tess_tol, level + 1); |
| 1418 | PathBezierQuadraticCurveToCasteljau(path, x123, y123, x23, y23, x3, y3, tess_tol, level + 1); |
| 1419 | } |
| 1420 | } |
| 1421 | |
| 1422 | void ImDrawList::PathBezierCubicCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments) |
| 1423 | { |
| 1424 | ImVec2 p1 = _Path.back(); |
| 1425 | if (num_segments == 0) |
| 1426 | { |
| 1427 | IM_ASSERT(_Data->CurveTessellationTol > 0.0f); |
| 1428 | PathBezierCubicCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, _Data->CurveTessellationTol, 0); |
| 1429 | } |
| 1430 | else |
| 1431 | { |
| 1432 | float t_step = 1.0f / (float)num_segments; |
| 1433 | for (int i_step = 1; i_step <= num_segments; i_step++) |
| 1434 | _Path.push_back(ImBezierCubicCalc(p1, p2, p3, p4, t_step * i_step)); |
| 1435 | } |
| 1436 | } |
| 1437 | |
| 1438 | void ImDrawList::PathBezierQuadraticCurveTo(const ImVec2& p2, const ImVec2& p3, int num_segments) |
| 1439 | { |
| 1440 | ImVec2 p1 = _Path.back(); |
| 1441 | if (num_segments == 0) |
| 1442 | { |
| 1443 | IM_ASSERT(_Data->CurveTessellationTol > 0.0f); |
| 1444 | PathBezierQuadraticCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, _Data->CurveTessellationTol, 0); |
| 1445 | } |
| 1446 | else |
| 1447 | { |
| 1448 | float t_step = 1.0f / (float)num_segments; |
| 1449 | for (int i_step = 1; i_step <= num_segments; i_step++) |
| 1450 | _Path.push_back(ImBezierQuadraticCalc(p1, p2, p3, t_step * i_step)); |
| 1451 | } |
| 1452 | } |
| 1453 | |
| 1454 | void ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, ImDrawFlags flags) |
| 1455 | { |
| 1456 | if (rounding >= 0.5f) |
| 1457 | { |
| 1458 | if ((flags & ImDrawFlags_RoundCornersMask_) == 0) |
| 1459 | flags |= ImDrawFlags_RoundCornersAll; |
| 1460 | |
| 1461 | rounding = ImMin(rounding, ImFabs(b.x - a.x) * (((flags & ImDrawFlags_RoundCornersTop) == ImDrawFlags_RoundCornersTop) || ((flags & ImDrawFlags_RoundCornersBottom) == ImDrawFlags_RoundCornersBottom) ? 0.5f : 1.0f) - 1.0f); |
| 1462 | rounding = ImMin(rounding, ImFabs(b.y - a.y) * (((flags & ImDrawFlags_RoundCornersLeft) == ImDrawFlags_RoundCornersLeft) || ((flags & ImDrawFlags_RoundCornersRight) == ImDrawFlags_RoundCornersRight) ? 0.5f : 1.0f) - 1.0f); |
| 1463 | } |
| 1464 | if (rounding < 0.5f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone) |
| 1465 | { |
| 1466 | PathLineTo(a); |
| 1467 | PathLineTo(ImVec2(b.x, a.y)); |
| 1468 | PathLineTo(b); |
| 1469 | PathLineTo(ImVec2(a.x, b.y)); |
| 1470 | } |
| 1471 | else |
| 1472 | { |
| 1473 | const float rounding_tl = (flags & ImDrawFlags_RoundCornersTopLeft) ? rounding : 0.0f; |
| 1474 | const float rounding_tr = (flags & ImDrawFlags_RoundCornersTopRight) ? rounding : 0.0f; |
| 1475 | const float rounding_br = (flags & ImDrawFlags_RoundCornersBottomRight) ? rounding : 0.0f; |
| 1476 | const float rounding_bl = (flags & ImDrawFlags_RoundCornersBottomLeft) ? rounding : 0.0f; |
| 1477 | PathArcToFast(ImVec2(a.x + rounding_tl, a.y + rounding_tl), rounding_tl, 6, 9); |
| 1478 | PathArcToFast(ImVec2(b.x - rounding_tr, a.y + rounding_tr), rounding_tr, 9, 12); |
| 1479 | PathArcToFast(ImVec2(b.x - rounding_br, b.y - rounding_br), rounding_br, 0, 3); |
| 1480 | PathArcToFast(ImVec2(a.x + rounding_bl, b.y - rounding_bl), rounding_bl, 3, 6); |
| 1481 | } |
| 1482 | } |
| 1483 | |
| 1484 | void ImDrawList::AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness) |
| 1485 | { |
| 1486 | if ((col & IM_COL32_A_MASK) == 0) |
| 1487 | return; |
| 1488 | const ImVec2 points[2] = { ImVec2(p1.x + 0.5f, p1.y + 0.5f), ImVec2(p2.x + 0.5f, p2.y + 0.5f) }; |
| 1489 | AddPolyline(points, 2, col, thickness); |
| 1490 | } |
| 1491 | |
| 1492 | void ImDrawList::AddLineH(float min_x, float max_x, float y, ImU32 col, float thickness) |
| 1493 | { |
| 1494 | if ((col & IM_COL32_A_MASK) == 0) |
| 1495 | return; |
| 1496 | const ImVec2 points[2] = { ImVec2(min_x + 0.5f, y + 0.5f), ImVec2(max_x + 0.5f, y + 0.5f) }; |
| 1497 | AddPolyline(points, 2, col, thickness); |
| 1498 | } |
| 1499 | |
| 1500 | void ImDrawList::AddLineV(float x, float min_y, float max_y, ImU32 col, float thickness) |
| 1501 | { |
| 1502 | if ((col & IM_COL32_A_MASK) == 0) |
| 1503 | return; |
| 1504 | const ImVec2 points[2] = { ImVec2(x + 0.5f, min_y + 0.5f), ImVec2(x + 0.5f, max_y + 0.5f) }; |
| 1505 | AddPolyline(points, 2, col, thickness); |
| 1506 | } |
| 1507 | |
| 1508 | |
| 1509 | |
| 1510 | void ImDrawList::AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding, float thickness, ImDrawFlags flags) |
| 1511 | { |
| 1512 | |
| 1513 | |
| 1514 | |
| 1515 | |
| 1516 | |
| 1517 | |
| 1518 | |
| 1519 | |
| 1520 | |
| 1521 | IM_ASSERT_USER_ERROR_RET((flags & ImDrawFlags_InvalidMask_) == 0, "Incorrect parameter. Did you swap 'thickness' and 'flags'?"); |
| 1522 | |
| 1523 | if ((col & IM_COL32_A_MASK) == 0) |
| 1524 | return; |
| 1525 | if (Flags & ImDrawListFlags_AntiAliasedLines) |
| 1526 | PathRect(p_min + ImVec2(0.50f, 0.50f), p_max - ImVec2(0.50f, 0.50f), rounding, flags); |
| 1527 | else |
| 1528 | PathRect(p_min + ImVec2(0.50f, 0.50f), p_max - ImVec2(0.49f, 0.49f), rounding, flags); |
| 1529 | PathStroke(col, thickness, ImDrawFlags_Closed); |
| 1530 | } |
| 1531 | |
| 1532 | void ImDrawList::AddRectFilled(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding, ImDrawFlags flags) |
| 1533 | { |
| 1534 | if ((col & IM_COL32_A_MASK) == 0) |
| 1535 | return; |
| 1536 | if (rounding < 0.5f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone) |
| 1537 | { |
| 1538 | PrimReserve(6, 4); |
| 1539 | PrimRect(p_min, p_max, col); |
| 1540 | } |
| 1541 | else |
| 1542 | { |
| 1543 | PathRect(p_min, p_max, rounding, flags); |
| 1544 | PathFillConvex(col); |
| 1545 | } |
| 1546 | } |
| 1547 | |
| 1548 | |
| 1549 | void ImDrawList::AddRectFilledMultiColor(const ImVec2& p_min, const ImVec2& p_max, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left) |
| 1550 | { |
| 1551 | if (((col_upr_left | col_upr_right | col_bot_right | col_bot_left) & IM_COL32_A_MASK) == 0) |
| 1552 | return; |
| 1553 | |
| 1554 | const ImVec2 uv = _Data->TexUvWhitePixel; |
| 1555 | PrimReserve(6, 4); |
| 1556 | PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx + 1)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx + 2)); |
| 1557 | PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx + 2)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx + 3)); |
| 1558 | PrimWriteVtx(p_min, uv, col_upr_left); |
| 1559 | PrimWriteVtx(ImVec2(p_max.x, p_min.y), uv, col_upr_right); |
| 1560 | PrimWriteVtx(p_max, uv, col_bot_right); |
| 1561 | PrimWriteVtx(ImVec2(p_min.x, p_max.y), uv, col_bot_left); |
| 1562 | } |
| 1563 | |
| 1564 | void ImDrawList::AddQuad(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness) |
| 1565 | { |
| 1566 | if ((col & IM_COL32_A_MASK) == 0) |
| 1567 | return; |
| 1568 | |
| 1569 | PathLineTo(p1); |
| 1570 | PathLineTo(p2); |
| 1571 | PathLineTo(p3); |
| 1572 | PathLineTo(p4); |
| 1573 | PathStroke(col, thickness, ImDrawFlags_Closed); |
| 1574 | } |
| 1575 | |
| 1576 | void ImDrawList::AddQuadFilled(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col) |
| 1577 | { |
| 1578 | if ((col & IM_COL32_A_MASK) == 0) |
| 1579 | return; |
| 1580 | |
| 1581 | PathLineTo(p1); |
| 1582 | PathLineTo(p2); |
| 1583 | PathLineTo(p3); |
| 1584 | PathLineTo(p4); |
| 1585 | PathFillConvex(col); |
| 1586 | } |
| 1587 | |
| 1588 | void ImDrawList::AddTriangle(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness) |
| 1589 | { |
| 1590 | if ((col & IM_COL32_A_MASK) == 0) |
| 1591 | return; |
| 1592 | |
| 1593 | PathLineTo(p1); |
| 1594 | PathLineTo(p2); |
| 1595 | PathLineTo(p3); |
| 1596 | PathStroke(col, thickness, ImDrawFlags_Closed); |
| 1597 | } |
| 1598 | |
| 1599 | void ImDrawList::AddTriangleFilled(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col) |
| 1600 | { |
| 1601 | if ((col & IM_COL32_A_MASK) == 0) |
| 1602 | return; |
| 1603 | |
| 1604 | PathLineTo(p1); |
| 1605 | PathLineTo(p2); |
| 1606 | PathLineTo(p3); |
| 1607 | PathFillConvex(col); |
| 1608 | } |
| 1609 | |
| 1610 | void ImDrawList::AddCircle(const ImVec2& center, float radius, ImU32 col, int num_segments, float thickness) |
| 1611 | { |
| 1612 | if ((col & IM_COL32_A_MASK) == 0 || radius < 0.5f) |
| 1613 | return; |
| 1614 | |
| 1615 | if (num_segments <= 0) |
| 1616 | { |
| 1617 | |
| 1618 | _PathArcToFastEx(center, radius - 0.5f, 0, IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0); |
| 1619 | _Path.Size--; |
| 1620 | } |
| 1621 | else |
| 1622 | { |
| 1623 | |
| 1624 | num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX); |
| 1625 | |
| 1626 | |
| 1627 | const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments; |
| 1628 | PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1); |
| 1629 | } |
| 1630 | |
| 1631 | PathStroke(col, thickness, ImDrawFlags_Closed); |
| 1632 | } |
| 1633 | |
| 1634 | void ImDrawList::AddCircleFilled(const ImVec2& center, float radius, ImU32 col, int num_segments) |
| 1635 | { |
| 1636 | if ((col & IM_COL32_A_MASK) == 0 || radius < 0.5f) |
| 1637 | return; |
| 1638 | |
| 1639 | if (num_segments <= 0) |
| 1640 | { |
| 1641 | |
| 1642 | _PathArcToFastEx(center, radius, 0, IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0); |
| 1643 | _Path.Size--; |
| 1644 | } |
| 1645 | else |
| 1646 | { |
| 1647 | |
| 1648 | num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX); |
| 1649 | |
| 1650 | |
| 1651 | const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments; |
| 1652 | PathArcTo(center, radius, 0.0f, a_max, num_segments - 1); |
| 1653 | } |
| 1654 | |
| 1655 | PathFillConvex(col); |
| 1656 | } |
| 1657 | |
| 1658 | |
| 1659 | void ImDrawList::AddNgon(const ImVec2& center, float radius, ImU32 col, int num_segments, float thickness) |
| 1660 | { |
| 1661 | if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2) |
| 1662 | return; |
| 1663 | |
| 1664 | |
| 1665 | const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments; |
| 1666 | PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1); |
| 1667 | PathStroke(col, thickness, ImDrawFlags_Closed); |
| 1668 | } |
| 1669 | |
| 1670 | |
| 1671 | void ImDrawList::AddNgonFilled(const ImVec2& center, float radius, ImU32 col, int num_segments) |
| 1672 | { |
| 1673 | if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2) |
| 1674 | return; |
| 1675 | |
| 1676 | |
| 1677 | const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments; |
| 1678 | PathArcTo(center, radius, 0.0f, a_max, num_segments - 1); |
| 1679 | PathFillConvex(col); |
| 1680 | } |
| 1681 | |
| 1682 | |
| 1683 | void ImDrawList::AddEllipse(const ImVec2& center, const ImVec2& radius, ImU32 col, float rot, int num_segments, float thickness) |
| 1684 | { |
| 1685 | if ((col & IM_COL32_A_MASK) == 0) |
| 1686 | return; |
| 1687 | |
| 1688 | if (num_segments <= 0) |
| 1689 | num_segments = _CalcCircleAutoSegmentCount(ImMax(radius.x, radius.y)); |
| 1690 | |
| 1691 | |
| 1692 | const float a_max = IM_PI * 2.0f * ((float)num_segments - 1.0f) / (float)num_segments; |
| 1693 | PathEllipticalArcTo(center, radius, rot, 0.0f, a_max, num_segments - 1); |
| 1694 | PathStroke(col, thickness, ImDrawFlags_Closed); |
| 1695 | } |
| 1696 | |
| 1697 | void ImDrawList::AddEllipseFilled(const ImVec2& center, const ImVec2& radius, ImU32 col, float rot, int num_segments) |
| 1698 | { |
| 1699 | if ((col & IM_COL32_A_MASK) == 0) |
| 1700 | return; |
| 1701 | |
| 1702 | if (num_segments <= 0) |
| 1703 | num_segments = _CalcCircleAutoSegmentCount(ImMax(radius.x, radius.y)); |
| 1704 | |
| 1705 | |
| 1706 | const float a_max = IM_PI * 2.0f * ((float)num_segments - 1.0f) / (float)num_segments; |
| 1707 | PathEllipticalArcTo(center, radius, rot, 0.0f, a_max, num_segments - 1); |
| 1708 | PathFillConvex(col); |
| 1709 | } |
| 1710 | |
| 1711 | |
| 1712 | void ImDrawList::AddBezierCubic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments) |
| 1713 | { |
| 1714 | if ((col & IM_COL32_A_MASK) == 0) |
| 1715 | return; |
| 1716 | |
| 1717 | PathLineTo(p1); |
| 1718 | PathBezierCubicCurveTo(p2, p3, p4, num_segments); |
| 1719 | PathStroke(col, thickness); |
| 1720 | } |
| 1721 | |
| 1722 | |
| 1723 | void ImDrawList::AddBezierQuadratic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness, int num_segments) |
| 1724 | { |
| 1725 | if ((col & IM_COL32_A_MASK) == 0) |
| 1726 | return; |
| 1727 | |
| 1728 | PathLineTo(p1); |
| 1729 | PathBezierQuadraticCurveTo(p2, p3, num_segments); |
| 1730 | PathStroke(col, thickness); |
| 1731 | } |
| 1732 | |
| 1733 | void ImDrawList::AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width, const ImVec4* cpu_fine_clip_rect) |
| 1734 | { |
| 1735 | if ((col & IM_COL32_A_MASK) == 0) |
| 1736 | return; |
| 1737 | |
| 1738 | |
| 1739 | if (text_begin == text_end || text_begin[0] == 0) |
| 1740 | return; |
| 1741 | |
| 1742 | |
| 1743 | |
| 1744 | if (font == NULL) |
| 1745 | font = _Data->Font; |
| 1746 | if (font_size == 0.0f) |
| 1747 | font_size = _Data->FontSize; |
| 1748 | |
| 1749 | ImVec4 clip_rect = _CmdHeader.ClipRect; |
| 1750 | if (cpu_fine_clip_rect) |
| 1751 | { |
| 1752 | clip_rect.x = ImMax(clip_rect.x, cpu_fine_clip_rect->x); |
| 1753 | clip_rect.y = ImMax(clip_rect.y, cpu_fine_clip_rect->y); |
| 1754 | clip_rect.z = ImMin(clip_rect.z, cpu_fine_clip_rect->z); |
| 1755 | clip_rect.w = ImMin(clip_rect.w, cpu_fine_clip_rect->w); |
| 1756 | } |
| 1757 | font->RenderText(this, font_size, pos, col, clip_rect, text_begin, text_end, wrap_width, (cpu_fine_clip_rect != NULL) ? ImDrawTextFlags_CpuFineClip : ImDrawTextFlags_None); |
| 1758 | } |
| 1759 | |
| 1760 | void ImDrawList::AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end) |
| 1761 | { |
| 1762 | AddText(_Data->Font, _Data->FontSize, pos, col, text_begin, text_end); |
| 1763 | } |
| 1764 | |
| 1765 | void ImDrawList::AddImage(ImTextureRef tex_ref, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col) |
| 1766 | { |
| 1767 | if ((col & IM_COL32_A_MASK) == 0) |
| 1768 | return; |
| 1769 | |
| 1770 | const bool push_texture_id = tex_ref != _CmdHeader.TexRef; |
| 1771 | if (push_texture_id) |
| 1772 | PushTexture(tex_ref); |
| 1773 | |
| 1774 | PrimReserve(6, 4); |
| 1775 | PrimRectUV(p_min, p_max, uv_min, uv_max, col); |
| 1776 | |
| 1777 | if (push_texture_id) |
| 1778 | PopTexture(); |
| 1779 | } |
| 1780 | |
| 1781 | void ImDrawList::AddImageQuad(ImTextureRef tex_ref, const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& uv1, const ImVec2& uv2, const ImVec2& uv3, const ImVec2& uv4, ImU32 col) |
| 1782 | { |
| 1783 | if ((col & IM_COL32_A_MASK) == 0) |
| 1784 | return; |
| 1785 | |
| 1786 | const bool push_texture_id = tex_ref != _CmdHeader.TexRef; |
| 1787 | if (push_texture_id) |
| 1788 | PushTexture(tex_ref); |
| 1789 | |
| 1790 | PrimReserve(6, 4); |
| 1791 | PrimQuadUV(p1, p2, p3, p4, uv1, uv2, uv3, uv4, col); |
| 1792 | |
| 1793 | if (push_texture_id) |
| 1794 | PopTexture(); |
| 1795 | } |
| 1796 | |
| 1797 | void ImDrawList::AddImageRounded(ImTextureRef tex_ref, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col, float rounding, ImDrawFlags flags) |
| 1798 | { |
| 1799 | if ((col & IM_COL32_A_MASK) == 0) |
| 1800 | return; |
| 1801 | |
| 1802 | IM_ASSERT((flags & 0x0F) == 0 && "Misuse of legacy hardcoded ImDrawCornerFlags values!"); |
| 1803 | if ((flags & ImDrawFlags_RoundCornersMask_) == 0) |
| 1804 | flags |= ImDrawFlags_RoundCornersAll; |
| 1805 | |
| 1806 | if (rounding < 0.5f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone) |
| 1807 | { |
| 1808 | AddImage(tex_ref, p_min, p_max, uv_min, uv_max, col); |
| 1809 | return; |
| 1810 | } |
| 1811 | |
| 1812 | const bool push_texture_id = tex_ref != _CmdHeader.TexRef; |
| 1813 | if (push_texture_id) |
| 1814 | PushTexture(tex_ref); |
| 1815 | |
| 1816 | int vert_start_idx = VtxBuffer.Size; |
| 1817 | PathRect(p_min, p_max, rounding, flags); |
| 1818 | PathFillConvex(col); |
| 1819 | int vert_end_idx = VtxBuffer.Size; |
| 1820 | ImGui::ShadeVertsLinearUV(this, vert_start_idx, vert_end_idx, p_min, p_max, uv_min, uv_max, true); |
| 1821 | |
| 1822 | if (push_texture_id) |
| 1823 | PopTexture(); |
| 1824 | } |
| 1825 | |
| 1826 | |
| 1827 | |
| 1828 | |
| 1829 | |
| 1830 | |
| 1831 | |
| 1832 | |
| 1833 | |
| 1834 | |
| 1835 | |
| 1836 | |
| 1837 | enum ImTriangulatorNodeType |
| 1838 | { |
| 1839 | ImTriangulatorNodeType_Convex, |
| 1840 | ImTriangulatorNodeType_Ear, |
| 1841 | ImTriangulatorNodeType_Reflex |
| 1842 | }; |
| 1843 | |
| 1844 | struct ImTriangulatorNode |
| 1845 | { |
| 1846 | ImTriangulatorNodeType Type; |
| 1847 | int Index; |
| 1848 | ImVec2 Pos; |
| 1849 | ImTriangulatorNode* Next; |
| 1850 | ImTriangulatorNode* Prev; |
| 1851 | |
| 1852 | void Unlink() { Next->Prev = Prev; Prev->Next = Next; } |
| 1853 | }; |
| 1854 | |
| 1855 | struct ImTriangulatorNodeSpan |
| 1856 | { |
| 1857 | ImTriangulatorNode** Data = NULL; |
| 1858 | int Size = 0; |
| 1859 | |
| 1860 | void push_back(ImTriangulatorNode* node) { Data[Size++] = node; } |
| 1861 | void find_erase_unsorted(int idx) { for (int i = Size - 1; i >= 0; i--) if (Data[i]->Index == idx) { Data[i] = Data[Size - 1]; Size--; return; } } |
| 1862 | }; |
| 1863 | |
| 1864 | struct ImTriangulator |
| 1865 | { |
| 1866 | static int EstimateTriangleCount(int points_count) { return (points_count < 3) ? 0 : points_count - 2; } |
| 1867 | static int EstimateScratchBufferSize(int points_count) { return sizeof(ImTriangulatorNode) * points_count + sizeof(ImTriangulatorNode*) * points_count * 2; } |
| 1868 | |
| 1869 | void Init(const ImVec2* points, int points_count, void* scratch_buffer); |
| 1870 | void GetNextTriangle(unsigned int out_triangle[3]); |
| 1871 | |
| 1872 | |
| 1873 | void BuildNodes(const ImVec2* points, int points_count); |
| 1874 | void BuildReflexes(); |
| 1875 | void BuildEars(); |
| 1876 | void FlipNodeList(); |
| 1877 | bool IsEar(int i0, int i1, int i2, const ImVec2& v0, const ImVec2& v1, const ImVec2& v2) const; |
| 1878 | void ReclassifyNode(ImTriangulatorNode* node); |
| 1879 | |
| 1880 | |
| 1881 | int _TrianglesLeft = 0; |
| 1882 | ImTriangulatorNode* _Nodes = NULL; |
| 1883 | ImTriangulatorNodeSpan _Ears; |
| 1884 | ImTriangulatorNodeSpan _Reflexes; |
| 1885 | }; |
| 1886 | |
| 1887 | |
| 1888 | |
| 1889 | |
| 1890 | void ImTriangulator::Init(const ImVec2* points, int points_count, void* scratch_buffer) |
| 1891 | { |
| 1892 | IM_ASSERT(scratch_buffer != NULL && points_count >= 3); |
| 1893 | _TrianglesLeft = EstimateTriangleCount(points_count); |
| 1894 | _Nodes = (ImTriangulatorNode*)scratch_buffer; |
| 1895 | _Ears.Data = (ImTriangulatorNode**)(_Nodes + points_count); |
| 1896 | _Reflexes.Data = (ImTriangulatorNode**)(_Nodes + points_count) + points_count; |
| 1897 | BuildNodes(points, points_count); |
| 1898 | BuildReflexes(); |
| 1899 | BuildEars(); |
| 1900 | } |
| 1901 | |
| 1902 | void ImTriangulator::BuildNodes(const ImVec2* points, int points_count) |
| 1903 | { |
| 1904 | for (int i = 0; i < points_count; i++) |
| 1905 | { |
| 1906 | _Nodes[i].Type = ImTriangulatorNodeType_Convex; |
| 1907 | _Nodes[i].Index = i; |
| 1908 | _Nodes[i].Pos = points[i]; |
| 1909 | _Nodes[i].Next = _Nodes + i + 1; |
| 1910 | _Nodes[i].Prev = _Nodes + i - 1; |
| 1911 | } |
| 1912 | _Nodes[0].Prev = _Nodes + points_count - 1; |
| 1913 | _Nodes[points_count - 1].Next = _Nodes; |
| 1914 | } |
| 1915 | |
| 1916 | void ImTriangulator::BuildReflexes() |
| 1917 | { |
| 1918 | ImTriangulatorNode* n1 = _Nodes; |
| 1919 | for (int i = _TrianglesLeft; i >= 0; i--, n1 = n1->Next) |
| 1920 | { |
| 1921 | if (ImTriangleIsClockwise(n1->Prev->Pos, n1->Pos, n1->Next->Pos)) |
| 1922 | continue; |
| 1923 | n1->Type = ImTriangulatorNodeType_Reflex; |
| 1924 | _Reflexes.push_back(n1); |
| 1925 | } |
| 1926 | } |
| 1927 | |
| 1928 | void ImTriangulator::BuildEars() |
| 1929 | { |
| 1930 | ImTriangulatorNode* n1 = _Nodes; |
| 1931 | for (int i = _TrianglesLeft; i >= 0; i--, n1 = n1->Next) |
| 1932 | { |
| 1933 | if (n1->Type != ImTriangulatorNodeType_Convex) |
| 1934 | continue; |
| 1935 | if (!IsEar(n1->Prev->Index, n1->Index, n1->Next->Index, n1->Prev->Pos, n1->Pos, n1->Next->Pos)) |
| 1936 | continue; |
| 1937 | n1->Type = ImTriangulatorNodeType_Ear; |
| 1938 | _Ears.push_back(n1); |
| 1939 | } |
| 1940 | } |
| 1941 | |
| 1942 | void ImTriangulator::GetNextTriangle(unsigned int out_triangle[3]) |
| 1943 | { |
| 1944 | if (_Ears.Size == 0) |
| 1945 | { |
| 1946 | FlipNodeList(); |
| 1947 | |
| 1948 | ImTriangulatorNode* node = _Nodes; |
| 1949 | for (int i = _TrianglesLeft; i >= 0; i--, node = node->Next) |
| 1950 | node->Type = ImTriangulatorNodeType_Convex; |
| 1951 | _Reflexes.Size = 0; |
| 1952 | BuildReflexes(); |
| 1953 | BuildEars(); |
| 1954 | |
| 1955 | |
| 1956 | if (_Ears.Size == 0) |
| 1957 | { |
| 1958 | |
| 1959 | IM_ASSERT(_TrianglesLeft > 0); |
| 1960 | _Ears.Data[0] = _Nodes; |
| 1961 | _Ears.Size = 1; |
| 1962 | } |
| 1963 | } |
| 1964 | |
| 1965 | ImTriangulatorNode* ear = _Ears.Data[--_Ears.Size]; |
| 1966 | out_triangle[0] = ear->Prev->Index; |
| 1967 | out_triangle[1] = ear->Index; |
| 1968 | out_triangle[2] = ear->Next->Index; |
| 1969 | |
| 1970 | ear->Unlink(); |
| 1971 | if (ear == _Nodes) |
| 1972 | _Nodes = ear->Next; |
| 1973 | |
| 1974 | ReclassifyNode(ear->Prev); |
| 1975 | ReclassifyNode(ear->Next); |
| 1976 | _TrianglesLeft--; |
| 1977 | } |
| 1978 | |
| 1979 | void ImTriangulator::FlipNodeList() |
| 1980 | { |
| 1981 | ImTriangulatorNode* prev = _Nodes; |
| 1982 | ImTriangulatorNode* temp = _Nodes; |
| 1983 | ImTriangulatorNode* current = _Nodes->Next; |
| 1984 | prev->Next = prev; |
| 1985 | prev->Prev = prev; |
| 1986 | while (current != _Nodes) |
| 1987 | { |
| 1988 | temp = current->Next; |
| 1989 | |
| 1990 | current->Next = prev; |
| 1991 | prev->Prev = current; |
| 1992 | _Nodes->Next = current; |
| 1993 | current->Prev = _Nodes; |
| 1994 | |
| 1995 | prev = current; |
| 1996 | current = temp; |
| 1997 | } |
| 1998 | _Nodes = prev; |
| 1999 | } |
| 2000 | |
| 2001 | |
| 2002 | bool ImTriangulator::IsEar(int i0, int i1, int i2, const ImVec2& v0, const ImVec2& v1, const ImVec2& v2) const |
| 2003 | { |
| 2004 | ImTriangulatorNode** p_end = _Reflexes.Data + _Reflexes.Size; |
| 2005 | for (ImTriangulatorNode** p = _Reflexes.Data; p < p_end; p++) |
| 2006 | { |
| 2007 | ImTriangulatorNode* reflex = *p; |
| 2008 | if (reflex->Index != i0 && reflex->Index != i1 && reflex->Index != i2) |
| 2009 | if (ImTriangleContainsPoint(v0, v1, v2, reflex->Pos)) |
| 2010 | return false; |
| 2011 | } |
| 2012 | return true; |
| 2013 | } |
| 2014 | |
| 2015 | void ImTriangulator::ReclassifyNode(ImTriangulatorNode* n1) |
| 2016 | { |
| 2017 | |
| 2018 | ImTriangulatorNodeType type; |
| 2019 | const ImTriangulatorNode* n0 = n1->Prev; |
| 2020 | const ImTriangulatorNode* n2 = n1->Next; |
| 2021 | if (!ImTriangleIsClockwise(n0->Pos, n1->Pos, n2->Pos)) |
| 2022 | type = ImTriangulatorNodeType_Reflex; |
| 2023 | else if (IsEar(n0->Index, n1->Index, n2->Index, n0->Pos, n1->Pos, n2->Pos)) |
| 2024 | type = ImTriangulatorNodeType_Ear; |
| 2025 | else |
| 2026 | type = ImTriangulatorNodeType_Convex; |
| 2027 | |
| 2028 | |
| 2029 | if (type == n1->Type) |
| 2030 | return; |
| 2031 | if (n1->Type == ImTriangulatorNodeType_Reflex) |
| 2032 | _Reflexes.find_erase_unsorted(n1->Index); |
| 2033 | else if (n1->Type == ImTriangulatorNodeType_Ear) |
| 2034 | _Ears.find_erase_unsorted(n1->Index); |
| 2035 | if (type == ImTriangulatorNodeType_Reflex) |
| 2036 | _Reflexes.push_back(n1); |
| 2037 | else if (type == ImTriangulatorNodeType_Ear) |
| 2038 | _Ears.push_back(n1); |
| 2039 | n1->Type = type; |
| 2040 | } |
| 2041 | |
| 2042 | |
| 2043 | |
| 2044 | |
| 2045 | |
| 2046 | |
| 2047 | void ImDrawList::AddConcavePolyFilled(const ImVec2* points, const int points_count, ImU32 col) |
| 2048 | { |
| 2049 | if (points_count < 3 || (col & IM_COL32_A_MASK) == 0) |
| 2050 | return; |
| 2051 | |
| 2052 | const ImVec2 uv = _Data->TexUvWhitePixel; |
| 2053 | ImTriangulator triangulator; |
| 2054 | unsigned int triangle[3]; |
| 2055 | if (Flags & ImDrawListFlags_AntiAliasedFill) |
| 2056 | { |
| 2057 | |
| 2058 | const float AA_SIZE = _FringeScale; |
| 2059 | const ImU32 col_trans = col & ~IM_COL32_A_MASK; |
| 2060 | const int idx_count = (points_count - 2) * 3 + points_count * 6; |
| 2061 | const int vtx_count = (points_count * 2); |
| 2062 | PrimReserve(idx_count, vtx_count); |
| 2063 | |
| 2064 | |
| 2065 | unsigned int vtx_inner_idx = _VtxCurrentIdx; |
| 2066 | unsigned int vtx_outer_idx = _VtxCurrentIdx + 1; |
| 2067 | |
| 2068 | _Data->TempBuffer.reserve_discard((ImTriangulator::EstimateScratchBufferSize(points_count) + sizeof(ImVec2)) / sizeof(ImVec2)); |
| 2069 | triangulator.Init(points, points_count, _Data->TempBuffer.Data); |
| 2070 | while (triangulator._TrianglesLeft > 0) |
| 2071 | { |
| 2072 | triangulator.GetNextTriangle(triangle); |
| 2073 | _IdxWritePtr[0] = (ImDrawIdx)(vtx_inner_idx + (triangle[0] << 1)); _IdxWritePtr[1] = (ImDrawIdx)(vtx_inner_idx + (triangle[1] << 1)); _IdxWritePtr[2] = (ImDrawIdx)(vtx_inner_idx + (triangle[2] << 1)); |
| 2074 | _IdxWritePtr += 3; |
| 2075 | } |
| 2076 | |
| 2077 | |
| 2078 | _Data->TempBuffer.reserve_discard(points_count); |
| 2079 | ImVec2* temp_normals = _Data->TempBuffer.Data; |
| 2080 | for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++) |
| 2081 | { |
| 2082 | const ImVec2& p0 = points[i0]; |
| 2083 | const ImVec2& p1 = points[i1]; |
| 2084 | float dx = p1.x - p0.x; |
| 2085 | float dy = p1.y - p0.y; |
| 2086 | IM_NORMALIZE2F_OVER_ZERO(dx, dy); |
| 2087 | temp_normals[i0].x = dy; |
| 2088 | temp_normals[i0].y = -dx; |
| 2089 | } |
| 2090 | |
| 2091 | for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++) |
| 2092 | { |
| 2093 | |
| 2094 | const ImVec2& n0 = temp_normals[i0]; |
| 2095 | const ImVec2& n1 = temp_normals[i1]; |
| 2096 | float dm_x = (n0.x + n1.x) * 0.5f; |
| 2097 | float dm_y = (n0.y + n1.y) * 0.5f; |
| 2098 | IM_FIXNORMAL2F(dm_x, dm_y); |
| 2099 | dm_x *= AA_SIZE * 0.5f; |
| 2100 | dm_y *= AA_SIZE * 0.5f; |
| 2101 | |
| 2102 | |
| 2103 | _VtxWritePtr[0].pos.x = (points[i1].x - dm_x); _VtxWritePtr[0].pos.y = (points[i1].y - dm_y); _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col; |
| 2104 | _VtxWritePtr[1].pos.x = (points[i1].x + dm_x); _VtxWritePtr[1].pos.y = (points[i1].y + dm_y); _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col_trans; |
| 2105 | _VtxWritePtr += 2; |
| 2106 | |
| 2107 | |
| 2108 | _IdxWritePtr[0] = (ImDrawIdx)(vtx_inner_idx + (i1 << 1)); _IdxWritePtr[1] = (ImDrawIdx)(vtx_inner_idx + (i0 << 1)); _IdxWritePtr[2] = (ImDrawIdx)(vtx_outer_idx + (i0 << 1)); |
| 2109 | _IdxWritePtr[3] = (ImDrawIdx)(vtx_outer_idx + (i0 << 1)); _IdxWritePtr[4] = (ImDrawIdx)(vtx_outer_idx + (i1 << 1)); _IdxWritePtr[5] = (ImDrawIdx)(vtx_inner_idx + (i1 << 1)); |
| 2110 | _IdxWritePtr += 6; |
| 2111 | } |
| 2112 | _VtxCurrentIdx += (ImDrawIdx)vtx_count; |
| 2113 | } |
| 2114 | else |
| 2115 | { |
| 2116 | |
| 2117 | const int idx_count = (points_count - 2) * 3; |
| 2118 | const int vtx_count = points_count; |
| 2119 | PrimReserve(idx_count, vtx_count); |
| 2120 | for (int i = 0; i < vtx_count; i++) |
| 2121 | { |
| 2122 | _VtxWritePtr[0].pos = points[i]; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col; |
| 2123 | _VtxWritePtr++; |
| 2124 | } |
| 2125 | _Data->TempBuffer.reserve_discard((ImTriangulator::EstimateScratchBufferSize(points_count) + sizeof(ImVec2)) / sizeof(ImVec2)); |
| 2126 | triangulator.Init(points, points_count, _Data->TempBuffer.Data); |
| 2127 | while (triangulator._TrianglesLeft > 0) |
| 2128 | { |
| 2129 | triangulator.GetNextTriangle(triangle); |
| 2130 | _IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx + triangle[0]); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx + triangle[1]); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx + triangle[2]); |
| 2131 | _IdxWritePtr += 3; |
| 2132 | } |
| 2133 | _VtxCurrentIdx += (ImDrawIdx)vtx_count; |
| 2134 | } |
| 2135 | } |
| 2136 | |
| 2137 | |
| 2138 | |
| 2139 | |
| 2140 | |
| 2141 | |
| 2142 | |
| 2143 | void ImDrawListSplitter::ClearFreeMemory() |
| 2144 | { |
| 2145 | for (int i = 0; i < _Channels.Size; i++) |
| 2146 | { |
| 2147 | if (i == _Current) |
| 2148 | memset(&_Channels[i], 0, sizeof(_Channels[i])); |
| 2149 | _Channels[i]._CmdBuffer.clear(); |
| 2150 | _Channels[i]._IdxBuffer.clear(); |
| 2151 | } |
| 2152 | _Current = 0; |
| 2153 | _Count = 1; |
| 2154 | _Channels.clear(); |
| 2155 | } |
| 2156 | |
| 2157 | void ImDrawListSplitter::Split(ImDrawList* draw_list, int channels_count) |
| 2158 | { |
| 2159 | IM_UNUSED(draw_list); |
| 2160 | IM_ASSERT(_Current == 0 && _Count <= 1 && "Nested channel splitting is not supported. Please use separate instances of ImDrawListSplitter."); |
| 2161 | int old_channels_count = _Channels.Size; |
| 2162 | if (old_channels_count < channels_count) |
| 2163 | { |
| 2164 | _Channels.reserve(channels_count); |
| 2165 | _Channels.resize(channels_count); |
| 2166 | } |
| 2167 | _Count = channels_count; |
| 2168 | |
| 2169 | |
| 2170 | |
| 2171 | |
| 2172 | memset(&_Channels[0], 0, sizeof(ImDrawChannel)); |
| 2173 | for (int i = 1; i < channels_count; i++) |
| 2174 | { |
| 2175 | if (i >= old_channels_count) |
| 2176 | { |
| 2177 | IM_PLACEMENT_NEW(&_Channels[i]) ImDrawChannel(); |
| 2178 | } |
| 2179 | else |
| 2180 | { |
| 2181 | _Channels[i]._CmdBuffer.resize(0); |
| 2182 | _Channels[i]._IdxBuffer.resize(0); |
| 2183 | } |
| 2184 | } |
| 2185 | } |
| 2186 | |
| 2187 | void ImDrawListSplitter::Merge(ImDrawList* draw_list) |
| 2188 | { |
| 2189 | |
| 2190 | if (_Count <= 1) |
| 2191 | return; |
| 2192 | |
| 2193 | SetCurrentChannel(draw_list, 0); |
| 2194 | draw_list->_PopUnusedDrawCmd(); |
| 2195 | |
| 2196 | |
| 2197 | int new_cmd_buffer_count = 0; |
| 2198 | int new_idx_buffer_count = 0; |
| 2199 | ImDrawCmd* last_cmd = (_Count > 0 && draw_list->CmdBuffer.Size > 0) ? &draw_list->CmdBuffer.back() : NULL; |
| 2200 | int idx_offset = last_cmd ? last_cmd->IdxOffset + last_cmd->ElemCount : 0; |
| 2201 | for (int i = 1; i < _Count; i++) |
| 2202 | { |
| 2203 | ImDrawChannel& ch = _Channels[i]; |
| 2204 | if (ch._CmdBuffer.Size > 0 && ch._CmdBuffer.back().ElemCount == 0 && ch._CmdBuffer.back().UserCallback == NULL) |
| 2205 | ch._CmdBuffer.pop_back(); |
| 2206 | |
| 2207 | if (ch._CmdBuffer.Size > 0 && last_cmd != NULL) |
| 2208 | { |
| 2209 | |
| 2210 | |
| 2211 | ImDrawCmd* next_cmd = &ch._CmdBuffer[0]; |
| 2212 | if (ImDrawCmd_HeaderCompare(last_cmd, next_cmd) == 0 && last_cmd->UserCallback == NULL && next_cmd->UserCallback == NULL) |
| 2213 | { |
| 2214 | |
| 2215 | last_cmd->ElemCount += next_cmd->ElemCount; |
| 2216 | idx_offset += next_cmd->ElemCount; |
| 2217 | ch._CmdBuffer.erase(ch._CmdBuffer.Data); |
| 2218 | } |
| 2219 | } |
| 2220 | if (ch._CmdBuffer.Size > 0) |
| 2221 | last_cmd = &ch._CmdBuffer.back(); |
| 2222 | new_cmd_buffer_count += ch._CmdBuffer.Size; |
| 2223 | new_idx_buffer_count += ch._IdxBuffer.Size; |
| 2224 | for (int cmd_n = 0; cmd_n < ch._CmdBuffer.Size; cmd_n++) |
| 2225 | { |
| 2226 | ch._CmdBuffer.Data[cmd_n].IdxOffset = idx_offset; |
| 2227 | idx_offset += ch._CmdBuffer.Data[cmd_n].ElemCount; |
| 2228 | } |
| 2229 | } |
| 2230 | draw_list->CmdBuffer.resize(draw_list->CmdBuffer.Size + new_cmd_buffer_count); |
| 2231 | draw_list->IdxBuffer.resize(draw_list->IdxBuffer.Size + new_idx_buffer_count); |
| 2232 | |
| 2233 | |
| 2234 | ImDrawCmd* cmd_write = draw_list->CmdBuffer.Data + draw_list->CmdBuffer.Size - new_cmd_buffer_count; |
| 2235 | ImDrawIdx* idx_write = draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size - new_idx_buffer_count; |
| 2236 | for (int i = 1; i < _Count; i++) |
| 2237 | { |
| 2238 | ImDrawChannel& ch = _Channels[i]; |
| 2239 | if (int sz = ch._CmdBuffer.Size) { memcpy(cmd_write, ch._CmdBuffer.Data, sz * sizeof(ImDrawCmd)); cmd_write += sz; } |
| 2240 | if (int sz = ch._IdxBuffer.Size) { memcpy(idx_write, ch._IdxBuffer.Data, sz * sizeof(ImDrawIdx)); idx_write += sz; } |
| 2241 | } |
| 2242 | draw_list->_IdxWritePtr = idx_write; |
| 2243 | |
| 2244 | |
| 2245 | if (draw_list->CmdBuffer.Size == 0 || draw_list->CmdBuffer.back().UserCallback != NULL) |
| 2246 | draw_list->AddDrawCmd(); |
| 2247 | |
| 2248 | |
| 2249 | ImDrawCmd* curr_cmd = &draw_list->CmdBuffer.Data[draw_list->CmdBuffer.Size - 1]; |
| 2250 | if (curr_cmd->ElemCount == 0) |
| 2251 | ImDrawCmd_HeaderCopy(curr_cmd, &draw_list->_CmdHeader); |
| 2252 | else if (ImDrawCmd_HeaderCompare(curr_cmd, &draw_list->_CmdHeader) != 0) |
| 2253 | draw_list->AddDrawCmd(); |
| 2254 | |
| 2255 | _Count = 1; |
| 2256 | } |
| 2257 | |
| 2258 | void ImDrawListSplitter::SetCurrentChannel(ImDrawList* draw_list, int idx) |
| 2259 | { |
| 2260 | IM_ASSERT(idx >= 0 && idx < _Count); |
| 2261 | if (_Current == idx) |
| 2262 | return; |
| 2263 | |
| 2264 | |
| 2265 | memcpy(&_Channels.Data[_Current]._CmdBuffer, &draw_list->CmdBuffer, sizeof(draw_list->CmdBuffer)); |
| 2266 | memcpy(&_Channels.Data[_Current]._IdxBuffer, &draw_list->IdxBuffer, sizeof(draw_list->IdxBuffer)); |
| 2267 | _Current = idx; |
| 2268 | memcpy(&draw_list->CmdBuffer, &_Channels.Data[idx]._CmdBuffer, sizeof(draw_list->CmdBuffer)); |
| 2269 | memcpy(&draw_list->IdxBuffer, &_Channels.Data[idx]._IdxBuffer, sizeof(draw_list->IdxBuffer)); |
| 2270 | draw_list->_IdxWritePtr = draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size; |
| 2271 | |
| 2272 | |
| 2273 | ImDrawCmd* curr_cmd = (draw_list->CmdBuffer.Size == 0) ? NULL : &draw_list->CmdBuffer.Data[draw_list->CmdBuffer.Size - 1]; |
| 2274 | if (curr_cmd == NULL) |
| 2275 | draw_list->AddDrawCmd(); |
| 2276 | else if (curr_cmd->ElemCount == 0) |
| 2277 | ImDrawCmd_HeaderCopy(curr_cmd, &draw_list->_CmdHeader); |
| 2278 | else if (ImDrawCmd_HeaderCompare(curr_cmd, &draw_list->_CmdHeader) != 0) |
| 2279 | draw_list->AddDrawCmd(); |
| 2280 | } |
| 2281 | |
| 2282 | |
| 2283 | |
| 2284 | |
| 2285 | |
| 2286 | void ImDrawData::Clear() |
| 2287 | { |
| 2288 | Valid = false; |
| 2289 | CmdListsCount = TotalIdxCount = TotalVtxCount = 0; |
| 2290 | CmdLists.resize(0); |
| 2291 | DisplayPos = DisplaySize = FramebufferScale = ImVec2(0.0f, 0.0f); |
| 2292 | OwnerViewport = NULL; |
| 2293 | Textures = NULL; |
| 2294 | } |
| 2295 | |
| 2296 | |
| 2297 | |
| 2298 | void ImGui::AddDrawListToDrawDataEx(ImDrawData* draw_data, ImVector<ImDrawList*>* out_list, ImDrawList* draw_list) |
| 2299 | { |
| 2300 | if (draw_list->CmdBuffer.Size == 0) |
| 2301 | return; |
| 2302 | if (draw_list->CmdBuffer.Size == 1 && draw_list->CmdBuffer[0].ElemCount == 0 && draw_list->CmdBuffer[0].UserCallback == NULL) |
| 2303 | return; |
| 2304 | |
| 2305 | |
| 2306 | |
| 2307 | IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size); |
| 2308 | IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size); |
| 2309 | if (!(draw_list->Flags & ImDrawListFlags_AllowVtxOffset)) |
| 2310 | IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); |
| 2311 | |
| 2312 | |
| 2313 | |
| 2314 | |
| 2315 | |
| 2316 | |
| 2317 | |
| 2318 | |
| 2319 | |
| 2320 | |
| 2321 | |
| 2322 | |
| 2323 | |
| 2324 | |
| 2325 | |
| 2326 | |
| 2327 | if (sizeof(ImDrawIdx) == 2) |
| 2328 | IM_ASSERT(draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices. Read comment above"); |
| 2329 | |
| 2330 | |
| 2331 | if (draw_list->_CallbacksDataBuf.Size > 0) |
| 2332 | for (ImDrawCmd& cmd : draw_list->CmdBuffer) |
| 2333 | if (cmd.UserCallback != NULL && cmd.UserCallbackDataOffset != -1 && cmd.UserCallbackDataSize > 0) |
| 2334 | cmd.UserCallbackData = draw_list->_CallbacksDataBuf.Data + cmd.UserCallbackDataOffset; |
| 2335 | |
| 2336 | |
| 2337 | out_list->push_back(draw_list); |
| 2338 | draw_data->CmdListsCount++; |
| 2339 | draw_data->TotalVtxCount += draw_list->VtxBuffer.Size; |
| 2340 | draw_data->TotalIdxCount += draw_list->IdxBuffer.Size; |
| 2341 | } |
| 2342 | |
| 2343 | void ImDrawData::AddDrawList(ImDrawList* draw_list) |
| 2344 | { |
| 2345 | IM_ASSERT(CmdLists.Size == CmdListsCount); |
| 2346 | draw_list->_PopUnusedDrawCmd(); |
| 2347 | ImGui::AddDrawListToDrawDataEx(this, &CmdLists, draw_list); |
| 2348 | } |
| 2349 | |
| 2350 | |
| 2351 | void ImDrawData::DeIndexAllBuffers() |
| 2352 | { |
| 2353 | ImVector<ImDrawVert> new_vtx_buffer; |
| 2354 | TotalVtxCount = TotalIdxCount = 0; |
| 2355 | for (ImDrawList* draw_list : CmdLists) |
| 2356 | { |
| 2357 | if (draw_list->IdxBuffer.empty()) |
| 2358 | continue; |
| 2359 | new_vtx_buffer.resize(draw_list->IdxBuffer.Size); |
| 2360 | for (int j = 0; j < draw_list->IdxBuffer.Size; j++) |
| 2361 | new_vtx_buffer[j] = draw_list->VtxBuffer[draw_list->IdxBuffer[j]]; |
| 2362 | draw_list->VtxBuffer.swap(new_vtx_buffer); |
| 2363 | draw_list->IdxBuffer.resize(0); |
| 2364 | TotalVtxCount += draw_list->VtxBuffer.Size; |
| 2365 | } |
| 2366 | } |
| 2367 | |
| 2368 | |
| 2369 | |
| 2370 | |
| 2371 | void ImDrawData::ScaleClipRects(const ImVec2& fb_scale) |
| 2372 | { |
| 2373 | for (ImDrawList* draw_list : CmdLists) |
| 2374 | for (ImDrawCmd& cmd : draw_list->CmdBuffer) |
| 2375 | cmd.ClipRect = ImVec4(cmd.ClipRect.x * fb_scale.x, cmd.ClipRect.y * fb_scale.y, cmd.ClipRect.z * fb_scale.x, cmd.ClipRect.w * fb_scale.y); |
| 2376 | } |
| 2377 | |
| 2378 | |
| 2379 | |
| 2380 | |
| 2381 | |
| 2382 | |
| 2383 | void ImGui::ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1) |
| 2384 | { |
| 2385 | ImVec2 gradient_extent = gradient_p1 - gradient_p0; |
| 2386 | float gradient_inv_length2 = 1.0f / ImLengthSqr(gradient_extent); |
| 2387 | ImDrawVert* vert_start = draw_list->VtxBuffer.Data + vert_start_idx; |
| 2388 | ImDrawVert* vert_end = draw_list->VtxBuffer.Data + vert_end_idx; |
| 2389 | const int col0_r = (int)(col0 >> IM_COL32_R_SHIFT) & 0xFF; |
| 2390 | const int col0_g = (int)(col0 >> IM_COL32_G_SHIFT) & 0xFF; |
| 2391 | const int col0_b = (int)(col0 >> IM_COL32_B_SHIFT) & 0xFF; |
| 2392 | const int col_delta_r = ((int)(col1 >> IM_COL32_R_SHIFT) & 0xFF) - col0_r; |
| 2393 | const int col_delta_g = ((int)(col1 >> IM_COL32_G_SHIFT) & 0xFF) - col0_g; |
| 2394 | const int col_delta_b = ((int)(col1 >> IM_COL32_B_SHIFT) & 0xFF) - col0_b; |
| 2395 | for (ImDrawVert* vert = vert_start; vert < vert_end; vert++) |
| 2396 | { |
| 2397 | float d = ImDot(vert->pos - gradient_p0, gradient_extent); |
| 2398 | float t = ImClamp(d * gradient_inv_length2, 0.0f, 1.0f); |
| 2399 | int r = (int)(col0_r + col_delta_r * t); |
| 2400 | int g = (int)(col0_g + col_delta_g * t); |
| 2401 | int b = (int)(col0_b + col_delta_b * t); |
| 2402 | vert->col = (r << IM_COL32_R_SHIFT) | (g << IM_COL32_G_SHIFT) | (b << IM_COL32_B_SHIFT) | (vert->col & IM_COL32_A_MASK); |
| 2403 | } |
| 2404 | } |
| 2405 | |
| 2406 | |
| 2407 | void ImGui::ShadeVertsLinearUV(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp) |
| 2408 | { |
| 2409 | const ImVec2 size = b - a; |
| 2410 | const ImVec2 uv_size = uv_b - uv_a; |
| 2411 | const ImVec2 scale = ImVec2( |
| 2412 | size.x != 0.0f ? (uv_size.x / size.x) : 0.0f, |
| 2413 | size.y != 0.0f ? (uv_size.y / size.y) : 0.0f); |
| 2414 | |
| 2415 | ImDrawVert* vert_start = draw_list->VtxBuffer.Data + vert_start_idx; |
| 2416 | ImDrawVert* vert_end = draw_list->VtxBuffer.Data + vert_end_idx; |
| 2417 | if (clamp) |
| 2418 | { |
| 2419 | const ImVec2 min = ImMin(uv_a, uv_b); |
| 2420 | const ImVec2 max = ImMax(uv_a, uv_b); |
| 2421 | for (ImDrawVert* vertex = vert_start; vertex < vert_end; ++vertex) |
| 2422 | vertex->uv = ImClamp(uv_a + ImMul(ImVec2(vertex->pos.x, vertex->pos.y) - a, scale), min, max); |
| 2423 | } |
| 2424 | else |
| 2425 | { |
| 2426 | for (ImDrawVert* vertex = vert_start; vertex < vert_end; ++vertex) |
| 2427 | vertex->uv = uv_a + ImMul(ImVec2(vertex->pos.x, vertex->pos.y) - a, scale); |
| 2428 | } |
| 2429 | } |
| 2430 | |
| 2431 | void ImGui::ShadeVertsTransformPos(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, const ImVec2& pivot_in, float cos_a, float sin_a, const ImVec2& pivot_out) |
| 2432 | { |
| 2433 | ImDrawVert* vert_start = draw_list->VtxBuffer.Data + vert_start_idx; |
| 2434 | ImDrawVert* vert_end = draw_list->VtxBuffer.Data + vert_end_idx; |
| 2435 | for (ImDrawVert* vertex = vert_start; vertex < vert_end; ++vertex) |
| 2436 | vertex->pos = ImRotate(vertex->pos- pivot_in, cos_a, sin_a) + pivot_out; |
| 2437 | } |
| 2438 | |
| 2439 | |
| 2440 | |
| 2441 | |
| 2442 | |
| 2443 | |
| 2444 | ImFontConfig::ImFontConfig() |
| 2445 | { |
| 2446 | memset((void*)this, 0, sizeof(*this)); |
| 2447 | FontDataOwnedByAtlas = true; |
| 2448 | OversampleH = 0; |
| 2449 | OversampleV = 0; |
| 2450 | ExtraSizeScale = 1.0f; |
| 2451 | GlyphMaxAdvanceX = FLT_MAX; |
| 2452 | RasterizerMultiply = 1.0f; |
| 2453 | RasterizerDensity = 1.0f; |
| 2454 | EllipsisChar = 0; |
| 2455 | } |
| 2456 | |
| 2457 | |
| 2458 | |
| 2459 | |
| 2460 | |
| 2461 | |
| 2462 | |
| 2463 | |
| 2464 | int ImTextureDataGetFormatBytesPerPixel(ImTextureFormat format) |
| 2465 | { |
| 2466 | switch (format) |
| 2467 | { |
| 2468 | case ImTextureFormat_Alpha8: return 1; |
| 2469 | case ImTextureFormat_RGBA32: return 4; |
| 2470 | } |
| 2471 | IM_ASSERT(0); |
| 2472 | return 0; |
| 2473 | } |
| 2474 | |
| 2475 | const char* ImTextureDataGetStatusName(ImTextureStatus status) |
| 2476 | { |
| 2477 | switch (status) |
| 2478 | { |
| 2479 | case ImTextureStatus_OK: return "OK"; |
| 2480 | case ImTextureStatus_Destroyed: return "Destroyed"; |
| 2481 | case ImTextureStatus_WantCreate: return "WantCreate"; |
| 2482 | case ImTextureStatus_WantUpdates: return "WantUpdates"; |
| 2483 | case ImTextureStatus_WantDestroy: return "WantDestroy"; |
| 2484 | } |
| 2485 | return "N/A"; |
| 2486 | } |
| 2487 | |
| 2488 | const char* ImTextureDataGetFormatName(ImTextureFormat format) |
| 2489 | { |
| 2490 | switch (format) |
| 2491 | { |
| 2492 | case ImTextureFormat_Alpha8: return "Alpha8"; |
| 2493 | case ImTextureFormat_RGBA32: return "RGBA32"; |
| 2494 | } |
| 2495 | return "N/A"; |
| 2496 | } |
| 2497 | |
| 2498 | void ImTextureData::Create(ImTextureFormat format, int w, int h) |
| 2499 | { |
| 2500 | IM_ASSERT(Status == ImTextureStatus_Destroyed); |
| 2501 | DestroyPixels(); |
| 2502 | Format = format; |
| 2503 | Status = ImTextureStatus_WantCreate; |
| 2504 | Width = w; |
| 2505 | Height = h; |
| 2506 | BytesPerPixel = ImTextureDataGetFormatBytesPerPixel(format); |
| 2507 | UseColors = false; |
| 2508 | Pixels = (unsigned char*)IM_ALLOC(Width * Height * BytesPerPixel); |
| 2509 | IM_ASSERT(Pixels != NULL); |
| 2510 | memset(Pixels, 0, Width * Height * BytesPerPixel); |
| 2511 | UsedRect.x = UsedRect.y = UsedRect.w = UsedRect.h = 0; |
| 2512 | UpdateRect.x = UpdateRect.y = (unsigned short)~0; |
| 2513 | UpdateRect.w = UpdateRect.h = 0; |
| 2514 | } |
| 2515 | |
| 2516 | void ImTextureData::DestroyPixels() |
| 2517 | { |
| 2518 | if (Pixels) |
| 2519 | IM_FREE(Pixels); |
| 2520 | Pixels = NULL; |
| 2521 | UseColors = false; |
| 2522 | } |
| 2523 | |
| 2524 | |
| 2525 | |
| 2526 | |
| 2527 | |
| 2528 | |
| 2529 | |
| 2530 | |
| 2531 | |
| 2532 | |
| 2533 | |
| 2534 | |
| 2535 | |
| 2536 | |
| 2537 | |
| 2538 | |
| 2539 | |
| 2540 | |
| 2541 | |
| 2542 | |
| 2543 | |
| 2544 | |
| 2545 | |
| 2546 | |
| 2547 | |
| 2548 | |
| 2549 | |
| 2550 | |
| 2551 | |
| 2552 | |
| 2553 | |
| 2554 | |
| 2555 | |
| 2556 | |
| 2557 | |
| 2558 | |
| 2559 | |
| 2560 | |
| 2561 | |
| 2562 | |
| 2563 | |
| 2564 | |
| 2565 | |
| 2566 | |
| 2567 | |
| 2568 | |
| 2569 | |
| 2570 | |
| 2571 | |
| 2572 | |
| 2573 | |
| 2574 | |
| 2575 | |
| 2576 | |
| 2577 | |
| 2578 | |
| 2579 | |
| 2580 | |
| 2581 | |
| 2582 | |
| 2583 | |
| 2584 | |
| 2585 | |
| 2586 | |
| 2587 | |
| 2588 | |
| 2589 | |
| 2590 | |
| 2591 | |
| 2592 | |
| 2593 | |
| 2594 | |
| 2595 | |
| 2596 | |
| 2597 | |
| 2598 | |
| 2599 | |
| 2600 | |
| 2601 | |
| 2602 | |
| 2603 | |
| 2604 | |
| 2605 | |
| 2606 | |
| 2607 | |
| 2608 | |
| 2609 | |
| 2610 | |
| 2611 | |
| 2612 | |
| 2613 | |
| 2614 | |
| 2615 | |
| 2616 | const int FONT_ATLAS_DEFAULT_TEX_DATA_W = 122; |
| 2617 | const int FONT_ATLAS_DEFAULT_TEX_DATA_H = 27; |
| 2618 | static const char FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[FONT_ATLAS_DEFAULT_TEX_DATA_W * FONT_ATLAS_DEFAULT_TEX_DATA_H + 1] = |
| 2619 | { |
| 2620 | "..- -XXXXXXX- X - X -XXXXXXX - XXXXXXX- XX - XX XX " |
| 2621 | "..- -X.....X- X.X - X.X -X.....X - X.....X- X..X -X..X X..X" |
| 2622 | "--- -XXX.XXX- X...X - X...X -X....X - X....X- X..X -X...X X...X" |
| 2623 | "X - X.X - X.....X - X.....X -X...X - X...X- X..X - X...X X...X " |
| 2624 | "XX - X.X -X.......X- X.......X -X..X.X - X.X..X- X..X - X...X...X " |
| 2625 | "X.X - X.X -XXXX.XXXX- XXXX.XXXX -X.X X.X - X.X X.X- X..XXX - X.....X " |
| 2626 | "X..X - X.X - X.X - X.X -XX X.X - X.X XX- X..X..XXX - X...X " |
| 2627 | "X...X - X.X - X.X - XX X.X XX - X.X - X.X - X..X..X..XX - X.X " |
| 2628 | "X....X - X.X - X.X - X.X X.X X.X - X.X - X.X - X..X..X..X.X - X...X " |
| 2629 | "X.....X - X.X - X.X - X..X X.X X..X - X.X - X.X -XXX X..X..X..X..X- X.....X " |
| 2630 | "X......X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X XX-XX X.X -X..XX........X..X- X...X...X " |
| 2631 | "X.......X - X.X - X.X -X.....................X- X.X X.X-X.X X.X -X...X...........X- X...X X...X " |
| 2632 | "X........X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X..X-X..X.X - X..............X-X...X X...X" |
| 2633 | "X.........X -XXX.XXX- X.X - X..X X.X X..X - X...X-X...X - X.............X-X..X X..X" |
| 2634 | "X..........X-X.....X- X.X - X.X X.X X.X - X....X-X....X - X.............X- XX XX " |
| 2635 | "X......XXXXX-XXXXXXX- X.X - XX X.X XX - X.....X-X.....X - X............X--------------" |
| 2636 | "X...X..X --------- X.X - X.X - XXXXXXX-XXXXXXX - X...........X - " |
| 2637 | "X..X X..X - -XXXX.XXXX- XXXX.XXXX ------------------------------------- X..........X - " |
| 2638 | "X.X X..X - -X.......X- X.......X - XX XX - - X..........X - " |
| 2639 | "XX X..X - - X.....X - X.....X - X.X X.X - - X........X - " |
| 2640 | " X..X - - X...X - X...X - X..X X..X - - X........X - " |
| 2641 | " XX - - X.X - X.X - X...XXXXXXXXXXXXX...X - - XXXXXXXXXX - " |
| 2642 | "------------- - X - X -X.....................X- ------------------- " |
| 2643 | " ----------------------------------- X...XXXXXXXXXXXXX...X - " |
| 2644 | " - X..X X..X - " |
| 2645 | " - X.X X.X - " |
| 2646 | " - XX XX - " |
| 2647 | }; |
| 2648 | |
| 2649 | static const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_COUNT][3] = |
| 2650 | { |
| 2651 | |
| 2652 | { ImVec2( 0,3), ImVec2(12,19), ImVec2( 0, 0) }, |
| 2653 | { ImVec2(13,0), ImVec2( 7,16), ImVec2( 1, 8) }, |
| 2654 | { ImVec2(31,0), ImVec2(23,23), ImVec2(11,11) }, |
| 2655 | { ImVec2(21,0), ImVec2( 9,23), ImVec2( 4,11) }, |
| 2656 | { ImVec2(55,18),ImVec2(23, 9), ImVec2(11, 4) }, |
| 2657 | { ImVec2(73,0), ImVec2(17,17), ImVec2( 8, 8) }, |
| 2658 | { ImVec2(55,0), ImVec2(17,17), ImVec2( 8, 8) }, |
| 2659 | { ImVec2(91,0), ImVec2(17,22), ImVec2( 5, 0) }, |
| 2660 | { ImVec2(0,3), ImVec2(12,19), ImVec2(0, 0) }, |
| 2661 | { ImVec2(0,3), ImVec2(12,19), ImVec2(0, 0) }, |
| 2662 | { ImVec2(109,0),ImVec2(13,15), ImVec2( 6, 7) }, |
| 2663 | }; |
| 2664 | |
| 2665 | #define IM_FONTGLYPH_INDEX_UNUSED ((ImU16)-1) |
| 2666 | #define IM_FONTGLYPH_INDEX_NOT_FOUND ((ImU16)-2) |
| 2667 | |
| 2668 | ImFontAtlas::ImFontAtlas() |
| 2669 | { |
| 2670 | memset((void*)this, 0, sizeof(*this)); |
| 2671 | TexDesiredFormat = ImTextureFormat_RGBA32; |
| 2672 | TexGlyphPadding = 1; |
| 2673 | TexMinWidth = 512; |
| 2674 | TexMinHeight = 128; |
| 2675 | TexMaxWidth = 8192; |
| 2676 | TexMaxHeight = 8192; |
| 2677 | TexRef._TexID = ImTextureID_Invalid; |
| 2678 | RendererHasTextures = false; |
| 2679 | TexNextUniqueID = 1; |
| 2680 | FontNextUniqueID = 1; |
| 2681 | Builder = NULL; |
| 2682 | } |
| 2683 | |
| 2684 | ImFontAtlas::~ImFontAtlas() |
| 2685 | { |
| 2686 | IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas!"); |
| 2687 | RendererHasTextures = false; |
| 2688 | ClearFonts(); |
| 2689 | ClearTexData(); |
| 2690 | TexList.clear_delete(); |
| 2691 | TexData = NULL; |
| 2692 | } |
| 2693 | |
| 2694 | |
| 2695 | |
| 2696 | |
| 2697 | void ImFontAtlas::Clear() |
| 2698 | { |
| 2699 | IMGUI_DEBUG_LOG_FONT("[font] ImFontAtlas::Clear()\n"); |
| 2700 | bool backup_renderer_has_textures = RendererHasTextures; |
| 2701 | RendererHasTextures = false; |
| 2702 | ClearFonts(); |
| 2703 | ClearTexData(); |
| 2704 | RendererHasTextures = backup_renderer_has_textures; |
| 2705 | } |
| 2706 | |
| 2707 | void ImFontAtlas::ClearFonts() |
| 2708 | { |
| 2709 | |
| 2710 | IMGUI_DEBUG_LOG_FONT("[font] ImFontAtlas::ClearFonts()\n"); |
| 2711 | IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas!"); |
| 2712 | for (ImFont* font : Fonts) |
| 2713 | ImFontAtlasBuildNotifySetFont(this, font, NULL); |
| 2714 | ImFontAtlasBuildDestroy(this); |
| 2715 | ClearInputData(); |
| 2716 | Fonts.clear_delete(); |
| 2717 | TexIsBuilt = false; |
| 2718 | for (ImDrawListSharedData* shared_data : DrawListSharedDatas) |
| 2719 | if (shared_data->FontAtlas == this) |
| 2720 | { |
| 2721 | shared_data->Font = NULL; |
| 2722 | shared_data->FontScale = shared_data->FontSize = 0.0f; |
| 2723 | } |
| 2724 | } |
| 2725 | |
| 2726 | void ImFontAtlas::ClearInputData() |
| 2727 | { |
| 2728 | IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas!"); |
| 2729 | for (ImFont* font : Fonts) |
| 2730 | ImFontAtlasFontDestroyOutput(this, font); |
| 2731 | for (ImFontConfig& font_cfg : Sources) |
| 2732 | ImFontAtlasFontDestroySourceData(this, &font_cfg); |
| 2733 | for (ImFont* font : Fonts) |
| 2734 | { |
| 2735 | |
| 2736 | font->Sources.clear(); |
| 2737 | font->Flags |= ImFontFlags_NoLoadGlyphs; |
| 2738 | } |
| 2739 | Sources.clear(); |
| 2740 | } |
| 2741 | |
| 2742 | |
| 2743 | void ImFontAtlas::ClearTexData() |
| 2744 | { |
| 2745 | IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas!"); |
| 2746 | IM_ASSERT(RendererHasTextures == false && "Not supported for dynamic atlases, but you may call Clear()."); |
| 2747 | for (ImTextureData* tex : TexList) |
| 2748 | tex->DestroyPixels(); |
| 2749 | |
| 2750 | } |
| 2751 | |
| 2752 | void ImFontAtlas::CompactCache() |
| 2753 | { |
| 2754 | ImFontAtlasTextureCompact(this); |
| 2755 | } |
| 2756 | |
| 2757 | void ImFontAtlas::SetFontLoader(const ImFontLoader* font_loader) |
| 2758 | { |
| 2759 | ImFontAtlasBuildSetupFontLoader(this, font_loader); |
| 2760 | } |
| 2761 | |
| 2762 | static void ImFontAtlasBuildUpdateRendererHasTexturesFromContext(ImFontAtlas* atlas) |
| 2763 | { |
| 2764 | |
| 2765 | |
| 2766 | |
| 2767 | |
| 2768 | |
| 2769 | for (ImDrawListSharedData* shared_data : atlas->DrawListSharedDatas) |
| 2770 | if (ImGuiContext* imgui_ctx = shared_data->Context) |
| 2771 | { |
| 2772 | atlas->RendererHasTextures = (imgui_ctx->IO.BackendFlags & ImGuiBackendFlags_RendererHasTextures) != 0; |
| 2773 | break; |
| 2774 | } |
| 2775 | } |
| 2776 | |
| 2777 | |
| 2778 | |
| 2779 | |
| 2780 | |
| 2781 | void ImFontAtlasUpdateNewFrame(ImFontAtlas* atlas, int frame_count, bool renderer_has_textures) |
| 2782 | { |
| 2783 | IM_ASSERT(atlas->Builder == NULL || atlas->Builder->FrameCount < frame_count); |
| 2784 | atlas->RendererHasTextures = renderer_has_textures; |
| 2785 | |
| 2786 | |
| 2787 | |
| 2788 | |
| 2789 | |
| 2790 | for (int tex_n = 0; tex_n < atlas->TexList.Size; tex_n++) |
| 2791 | { |
| 2792 | |
| 2793 | ImTextureData* tex = atlas->TexList[tex_n]; |
| 2794 | if (tex->Status == ImTextureStatus_WantCreate && atlas->RendererHasTextures) |
| 2795 | IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == NULL && "Backend set texture's TexID/BackendUserData but did not update Status to OK."); |
| 2796 | |
| 2797 | bool remove_from_list = ImTextureDataUpdateNewFrame(tex); |
| 2798 | if (remove_from_list) |
| 2799 | { |
| 2800 | IM_ASSERT(atlas->TexData != tex); |
| 2801 | tex->DestroyPixels(); |
| 2802 | IM_DELETE(tex); |
| 2803 | atlas->TexList.erase(atlas->TexList.begin() + tex_n); |
| 2804 | tex_n--; |
| 2805 | } |
| 2806 | } |
| 2807 | |
| 2808 | |
| 2809 | if (atlas->RendererHasTextures) |
| 2810 | { |
| 2811 | atlas->TexIsBuilt = true; |
| 2812 | if (atlas->Builder == NULL) |
| 2813 | ImFontAtlasBuildMain(atlas); |
| 2814 | } |
| 2815 | |
| 2816 | if (!atlas->RendererHasTextures) |
| 2817 | IM_ASSERT_USER_ERROR(atlas->TexIsBuilt, "Backend does not support ImGuiBackendFlags_RendererHasTextures, and font atlas is not built! Update backend OR make sure you called ImGui_ImplXXXX_NewFrame() function for renderer backend, which should call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()."); |
| 2818 | if (atlas->TexIsBuilt && atlas->Builder->PreloadedAllGlyphsRanges) |
| 2819 | IM_ASSERT_USER_ERROR(atlas->RendererHasTextures == false, "Called ImFontAtlas::Build() before ImGuiBackendFlags_RendererHasTextures got set! With new backends: you don't need to call Build()."); |
| 2820 | |
| 2821 | |
| 2822 | |
| 2823 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 2824 | builder->FrameCount = frame_count; |
| 2825 | for (ImFont* font : atlas->Fonts) |
| 2826 | font->LastBaked = NULL; |
| 2827 | |
| 2828 | |
| 2829 | if (builder->BakedDiscardedCount > 0) |
| 2830 | { |
| 2831 | int dst_n = 0, src_n = 0; |
| 2832 | for (; src_n < builder->BakedPool.Size; src_n++) |
| 2833 | { |
| 2834 | ImFontBaked* p_src = &builder->BakedPool[src_n]; |
| 2835 | if (p_src->WantDestroy) |
| 2836 | continue; |
| 2837 | ImFontBaked* p_dst = &builder->BakedPool[dst_n++]; |
| 2838 | if (p_dst == p_src) |
| 2839 | continue; |
| 2840 | memcpy(p_dst, p_src, sizeof(ImFontBaked)); |
| 2841 | builder->BakedMap.SetVoidPtr(p_dst->BakedId, p_dst); |
| 2842 | } |
| 2843 | IM_ASSERT(dst_n + builder->BakedDiscardedCount == src_n); |
| 2844 | builder->BakedPool.Size -= builder->BakedDiscardedCount; |
| 2845 | builder->BakedDiscardedCount = 0; |
| 2846 | } |
| 2847 | } |
| 2848 | |
| 2849 | bool ImTextureDataUpdateNewFrame(ImTextureData* tex) |
| 2850 | { |
| 2851 | bool remove_from_list = false; |
| 2852 | if (tex->Status == ImTextureStatus_OK) |
| 2853 | { |
| 2854 | tex->Updates.resize(0); |
| 2855 | tex->UpdateRect.x = tex->UpdateRect.y = (unsigned short)~0; |
| 2856 | tex->UpdateRect.w = tex->UpdateRect.h = 0; |
| 2857 | } |
| 2858 | |
| 2859 | |
| 2860 | |
| 2861 | |
| 2862 | if (tex->WantDestroyNextFrame && tex->Status != ImTextureStatus_Destroyed && tex->Status != ImTextureStatus_WantDestroy) |
| 2863 | { |
| 2864 | IM_ASSERT(tex->Status == ImTextureStatus_OK || tex->Status == ImTextureStatus_WantCreate || tex->Status == ImTextureStatus_WantUpdates); |
| 2865 | tex->Status = ImTextureStatus_WantDestroy; |
| 2866 | } |
| 2867 | |
| 2868 | |
| 2869 | |
| 2870 | |
| 2871 | if (tex->Status == ImTextureStatus_WantDestroy && tex->TexID == ImTextureID_Invalid && tex->BackendUserData == NULL) |
| 2872 | tex->Status = ImTextureStatus_Destroyed; |
| 2873 | |
| 2874 | |
| 2875 | if (tex->Status == ImTextureStatus_Destroyed) |
| 2876 | { |
| 2877 | IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == NULL && "Backend set texture Status to Destroyed but did not clear TexID/BackendUserData!"); |
| 2878 | if (tex->WantDestroyNextFrame) |
| 2879 | remove_from_list = true; |
| 2880 | else |
| 2881 | tex->Status = ImTextureStatus_WantCreate; |
| 2882 | } |
| 2883 | |
| 2884 | |
| 2885 | |
| 2886 | if (tex->Status == ImTextureStatus_WantDestroy) |
| 2887 | tex->UnusedFrames++; |
| 2888 | |
| 2889 | return remove_from_list; |
| 2890 | } |
| 2891 | |
| 2892 | void ImFontAtlasTextureBlockConvert(const unsigned char* src_pixels, ImTextureFormat src_fmt, int src_pitch, unsigned char* dst_pixels, ImTextureFormat dst_fmt, int dst_pitch, int w, int h) |
| 2893 | { |
| 2894 | IM_ASSERT(src_pixels != NULL && dst_pixels != NULL); |
| 2895 | if (src_fmt == dst_fmt) |
| 2896 | { |
| 2897 | int line_sz = w * ImTextureDataGetFormatBytesPerPixel(src_fmt); |
| 2898 | for (int ny = h; ny > 0; ny--, src_pixels += src_pitch, dst_pixels += dst_pitch) |
| 2899 | memcpy(dst_pixels, src_pixels, line_sz); |
| 2900 | } |
| 2901 | else if (src_fmt == ImTextureFormat_Alpha8 && dst_fmt == ImTextureFormat_RGBA32) |
| 2902 | { |
| 2903 | for (int ny = h; ny > 0; ny--, src_pixels += src_pitch, dst_pixels += dst_pitch) |
| 2904 | { |
| 2905 | const ImU8* src_p = (const ImU8*)src_pixels; |
| 2906 | ImU32* dst_p = (ImU32*)(void*)dst_pixels; |
| 2907 | for (int nx = w; nx > 0; nx--) |
| 2908 | *dst_p++ = IM_COL32(255, 255, 255, (unsigned int)(*src_p++)); |
| 2909 | } |
| 2910 | } |
| 2911 | else if (src_fmt == ImTextureFormat_RGBA32 && dst_fmt == ImTextureFormat_Alpha8) |
| 2912 | { |
| 2913 | for (int ny = h; ny > 0; ny--, src_pixels += src_pitch, dst_pixels += dst_pitch) |
| 2914 | { |
| 2915 | const ImU32* src_p = (const ImU32*)(void*)src_pixels; |
| 2916 | ImU8* dst_p = (ImU8*)dst_pixels; |
| 2917 | for (int nx = w; nx > 0; nx--) |
| 2918 | *dst_p++ = ((*src_p++) >> IM_COL32_A_SHIFT) & 0xFF; |
| 2919 | } |
| 2920 | } |
| 2921 | else |
| 2922 | { |
| 2923 | IM_ASSERT(0); |
| 2924 | } |
| 2925 | } |
| 2926 | |
| 2927 | |
| 2928 | |
| 2929 | void ImFontAtlasTextureBlockPostProcess(ImFontAtlasPostProcessData* data) |
| 2930 | { |
| 2931 | |
| 2932 | if (data->FontSrc->RasterizerMultiply != 1.0f) |
| 2933 | ImFontAtlasTextureBlockPostProcessMultiply(data, data->FontSrc->RasterizerMultiply); |
| 2934 | } |
| 2935 | |
| 2936 | void ImFontAtlasTextureBlockPostProcessMultiply(ImFontAtlasPostProcessData* data, float multiply_factor) |
| 2937 | { |
| 2938 | unsigned char* pixels = (unsigned char*)data->Pixels; |
| 2939 | int pitch = data->Pitch; |
| 2940 | if (data->Format == ImTextureFormat_Alpha8) |
| 2941 | { |
| 2942 | for (int ny = data->Height; ny > 0; ny--, pixels += pitch) |
| 2943 | { |
| 2944 | ImU8* p = (ImU8*)pixels; |
| 2945 | for (int nx = data->Width; nx > 0; nx--, p++) |
| 2946 | { |
| 2947 | unsigned int v = ImMin((unsigned int)(*p * multiply_factor), (unsigned int)255); |
| 2948 | *p = (unsigned char)v; |
| 2949 | } |
| 2950 | } |
| 2951 | } |
| 2952 | else if (data->Format == ImTextureFormat_RGBA32) |
| 2953 | { |
| 2954 | for (int ny = data->Height; ny > 0; ny--, pixels += pitch) |
| 2955 | { |
| 2956 | ImU32* p = (ImU32*)(void*)pixels; |
| 2957 | for (int nx = data->Width; nx > 0; nx--, p++) |
| 2958 | { |
| 2959 | unsigned int a = ImMin((unsigned int)(((*p >> IM_COL32_A_SHIFT) & 0xFF) * multiply_factor), (unsigned int)255); |
| 2960 | *p = IM_COL32((*p >> IM_COL32_R_SHIFT) & 0xFF, (*p >> IM_COL32_G_SHIFT) & 0xFF, (*p >> IM_COL32_B_SHIFT) & 0xFF, a); |
| 2961 | } |
| 2962 | } |
| 2963 | } |
| 2964 | else |
| 2965 | { |
| 2966 | IM_ASSERT(0); |
| 2967 | } |
| 2968 | } |
| 2969 | |
| 2970 | |
| 2971 | void ImFontAtlasTextureBlockFill(ImTextureData* dst_tex, int dst_x, int dst_y, int w, int h, ImU32 col) |
| 2972 | { |
| 2973 | if (dst_tex->Format == ImTextureFormat_Alpha8) |
| 2974 | { |
| 2975 | ImU8 col_a = (col >> IM_COL32_A_SHIFT) & 0xFF; |
| 2976 | for (int y = 0; y < h; y++) |
| 2977 | memset((ImU8*)dst_tex->GetPixelsAt(dst_x, dst_y + y), col_a, w); |
| 2978 | } |
| 2979 | else |
| 2980 | { |
| 2981 | for (int y = 0; y < h; y++) |
| 2982 | { |
| 2983 | ImU32* p = (ImU32*)(void*)dst_tex->GetPixelsAt(dst_x, dst_y + y); |
| 2984 | for (int x = w; x > 0; x--, p++) |
| 2985 | *p = col; |
| 2986 | } |
| 2987 | } |
| 2988 | } |
| 2989 | |
| 2990 | |
| 2991 | void ImFontAtlasTextureBlockCopy(ImTextureData* src_tex, int src_x, int src_y, ImTextureData* dst_tex, int dst_x, int dst_y, int w, int h) |
| 2992 | { |
| 2993 | IM_ASSERT(src_tex->Pixels != NULL && dst_tex->Pixels != NULL); |
| 2994 | IM_ASSERT(src_tex->Format == dst_tex->Format); |
| 2995 | IM_ASSERT(src_x >= 0 && src_x + w <= src_tex->Width); |
| 2996 | IM_ASSERT(src_y >= 0 && src_y + h <= src_tex->Height); |
| 2997 | IM_ASSERT(dst_x >= 0 && dst_x + w <= dst_tex->Width); |
| 2998 | IM_ASSERT(dst_y >= 0 && dst_y + h <= dst_tex->Height); |
| 2999 | for (int y = 0; y < h; y++) |
| 3000 | memcpy(dst_tex->GetPixelsAt(dst_x, dst_y + y), src_tex->GetPixelsAt(src_x, src_y + y), w * dst_tex->BytesPerPixel); |
| 3001 | } |
| 3002 | |
| 3003 | void ImFontAtlasTextureBlockQueueUpload(ImFontAtlas* atlas, ImTextureData* tex, int x, int y, int w, int h) |
| 3004 | { |
| 3005 | ImTextureDataQueueUpload(tex, x, y, w, h); |
| 3006 | atlas->TexIsBuilt = false; |
| 3007 | } |
| 3008 | |
| 3009 | |
| 3010 | void ImTextureDataQueueUpload(ImTextureData* tex, int x, int y, int w, int h) |
| 3011 | { |
| 3012 | IM_ASSERT(tex->Status != ImTextureStatus_WantDestroy && tex->Status != ImTextureStatus_Destroyed); |
| 3013 | IM_ASSERT(x >= 0 && x <= 0xFFFF && y >= 0 && y <= 0xFFFF && w >= 0 && x + w <= 0x10000 && h >= 0 && y + h <= 0x10000); |
| 3014 | |
| 3015 | ImTextureRect req = { (unsigned short)x, (unsigned short)y, (unsigned short)w, (unsigned short)h }; |
| 3016 | int new_x1 = ImMax(tex->UpdateRect.w == 0 ? 0 : tex->UpdateRect.x + tex->UpdateRect.w, req.x + req.w); |
| 3017 | int new_y1 = ImMax(tex->UpdateRect.h == 0 ? 0 : tex->UpdateRect.y + tex->UpdateRect.h, req.y + req.h); |
| 3018 | tex->UpdateRect.x = ImMin(tex->UpdateRect.x, req.x); |
| 3019 | tex->UpdateRect.y = ImMin(tex->UpdateRect.y, req.y); |
| 3020 | tex->UpdateRect.w = (unsigned short)(new_x1 - tex->UpdateRect.x); |
| 3021 | tex->UpdateRect.h = (unsigned short)(new_y1 - tex->UpdateRect.y); |
| 3022 | tex->UsedRect.x = ImMin(tex->UsedRect.x, req.x); |
| 3023 | tex->UsedRect.y = ImMin(tex->UsedRect.y, req.y); |
| 3024 | tex->UsedRect.w = (unsigned short)(ImMax(tex->UsedRect.x + tex->UsedRect.w, req.x + req.w) - tex->UsedRect.x); |
| 3025 | tex->UsedRect.h = (unsigned short)(ImMax(tex->UsedRect.y + tex->UsedRect.h, req.y + req.h) - tex->UsedRect.y); |
| 3026 | |
| 3027 | |
| 3028 | if (tex->Status == ImTextureStatus_OK || tex->Status == ImTextureStatus_WantUpdates) |
| 3029 | { |
| 3030 | tex->Status = ImTextureStatus_WantUpdates; |
| 3031 | tex->Updates.push_back(req); |
| 3032 | } |
| 3033 | } |
| 3034 | |
| 3035 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS |
| 3036 | static void GetTexDataAsFormat(ImFontAtlas* atlas, ImTextureFormat format, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel) |
| 3037 | { |
| 3038 | ImTextureData* tex = atlas->TexData; |
| 3039 | if (!atlas->TexIsBuilt || tex == NULL || tex->Pixels == NULL || atlas->TexDesiredFormat != format) |
| 3040 | { |
| 3041 | atlas->TexDesiredFormat = format; |
| 3042 | atlas->Build(); |
| 3043 | tex = atlas->TexData; |
| 3044 | } |
| 3045 | if (out_pixels) { *out_pixels = (unsigned char*)tex->Pixels; }; |
| 3046 | if (out_width) { *out_width = tex->Width; }; |
| 3047 | if (out_height) { *out_height = tex->Height; }; |
| 3048 | if (out_bytes_per_pixel) { *out_bytes_per_pixel = tex->BytesPerPixel; } |
| 3049 | } |
| 3050 | |
| 3051 | void ImFontAtlas::GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel) |
| 3052 | { |
| 3053 | GetTexDataAsFormat(this, ImTextureFormat_Alpha8, out_pixels, out_width, out_height, out_bytes_per_pixel); |
| 3054 | } |
| 3055 | |
| 3056 | void ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel) |
| 3057 | { |
| 3058 | GetTexDataAsFormat(this, ImTextureFormat_RGBA32, out_pixels, out_width, out_height, out_bytes_per_pixel); |
| 3059 | } |
| 3060 | |
| 3061 | bool ImFontAtlas::Build() |
| 3062 | { |
| 3063 | ImFontAtlasBuildMain(this); |
| 3064 | return true; |
| 3065 | } |
| 3066 | #endif |
| 3067 | |
| 3068 | ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg_in) |
| 3069 | { |
| 3070 | |
| 3071 | IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas!"); |
| 3072 | IM_ASSERT((font_cfg_in->FontData != NULL && font_cfg_in->FontDataSize > 0) || (font_cfg_in->FontLoader != NULL)); |
| 3073 | |
| 3074 | IM_ASSERT(font_cfg_in->RasterizerDensity > 0.0f && "Is ImFontConfig struct correctly initialized?"); |
| 3075 | if (font_cfg_in->GlyphOffset.x != 0.0f || font_cfg_in->GlyphOffset.y != 0.0f || font_cfg_in->GlyphMinAdvanceX != 0.0f || font_cfg_in->GlyphMaxAdvanceX != FLT_MAX) |
| 3076 | IM_ASSERT(font_cfg_in->SizePixels != 0.0f && "Specifying glyph offset/advances requires a reference size to base it on."); |
| 3077 | |
| 3078 | |
| 3079 | if (Builder == NULL) |
| 3080 | ImFontAtlasBuildInit(this); |
| 3081 | |
| 3082 | |
| 3083 | const bool is_first_font = (Fonts.Size == 0); |
| 3084 | ImFont* font; |
| 3085 | if (!font_cfg_in->MergeMode) |
| 3086 | { |
| 3087 | font = IM_NEW(ImFont)(); |
| 3088 | font->FontId = FontNextUniqueID++; |
| 3089 | font->Flags = font_cfg_in->Flags; |
| 3090 | font->LegacySize = font_cfg_in->SizePixels; |
| 3091 | font->CurrentRasterizerDensity = font_cfg_in->RasterizerDensity; |
| 3092 | Fonts.push_back(font); |
| 3093 | } |
| 3094 | else |
| 3095 | { |
| 3096 | IM_ASSERT(Fonts.Size > 0 && "Cannot use MergeMode for the first font!"); |
| 3097 | font = font_cfg_in->DstFont ? font_cfg_in->DstFont : Fonts.back(); |
| 3098 | ImFontAtlasFontDiscardBakes(this, font, 0); |
| 3099 | } |
| 3100 | |
| 3101 | |
| 3102 | Sources.push_back(*font_cfg_in); |
| 3103 | ImFontConfig* font_cfg = &Sources.back(); |
| 3104 | if (font_cfg->DstFont == NULL) |
| 3105 | font_cfg->DstFont = font; |
| 3106 | font->Sources.push_back(font_cfg); |
| 3107 | ImFontAtlasBuildUpdatePointers(this); |
| 3108 | |
| 3109 | |
| 3110 | |
| 3111 | if (font_cfg->GlyphExcludeRanges != NULL) |
| 3112 | { |
| 3113 | int size = 0; |
| 3114 | for (const ImWchar* p = font_cfg->GlyphExcludeRanges; p[0] != 0; p++, size++) {} |
| 3115 | IM_ASSERT((size & 1) == 0 && "GlyphExcludeRanges[] size must be multiple of two!"); |
| 3116 | IM_ASSERT((size <= 64) && "GlyphExcludeRanges[] size must be small!"); |
| 3117 | font_cfg->GlyphExcludeRanges = (ImWchar*)ImMemdup(font_cfg->GlyphExcludeRanges, sizeof(font_cfg->GlyphExcludeRanges[0]) * (size + 1)); |
| 3118 | } |
| 3119 | if (font_cfg->FontLoader != NULL) |
| 3120 | { |
| 3121 | IM_ASSERT(font_cfg->FontLoader->FontBakedLoadGlyph != NULL); |
| 3122 | IM_ASSERT(font_cfg->FontLoader->LoaderInit == NULL && font_cfg->FontLoader->LoaderShutdown == NULL); |
| 3123 | } |
| 3124 | |
| 3125 | |
| 3126 | |
| 3127 | if (font_cfg_in->MergeMode && font_cfg_in->SizePixels > 0) |
| 3128 | IM_ASSERT((font->Flags & ImFontFlags_ImplicitRefSize) == 0 && "Cannot use MergeMode with an explicit reference size when the destination font used an implicit reference size!"); |
| 3129 | IM_ASSERT(font_cfg->FontLoaderData == NULL); |
| 3130 | |
| 3131 | if (!ImFontAtlasFontSourceInit(this, font_cfg)) |
| 3132 | { |
| 3133 | |
| 3134 | ImFontAtlasFontDestroySourceData(this, font_cfg); |
| 3135 | Sources.pop_back(); |
| 3136 | font->Sources.pop_back(); |
| 3137 | if (!font_cfg->MergeMode) |
| 3138 | { |
| 3139 | IM_DELETE(font); |
| 3140 | Fonts.pop_back(); |
| 3141 | } |
| 3142 | return NULL; |
| 3143 | } |
| 3144 | ImFontAtlasFontSourceAddToFont(this, font, font_cfg); |
| 3145 | |
| 3146 | if (is_first_font) |
| 3147 | ImFontAtlasBuildNotifySetFont(this, NULL, font); |
| 3148 | return font; |
| 3149 | } |
| 3150 | |
| 3151 | |
| 3152 | static unsigned int stb_decompress_length(const unsigned char* input); |
| 3153 | static unsigned int stb_decompress(unsigned char* output, const unsigned char* input, unsigned int length); |
| 3154 | static unsigned int Decode85Byte(char c) { return c >= '\\' ? c-36 : c-35; } |
| 3155 | static void Decode85(const unsigned char* src, unsigned char* dst) |
| 3156 | { |
| 3157 | while (*src) |
| 3158 | { |
| 3159 | unsigned int tmp = Decode85Byte(src[0]) + 85 * (Decode85Byte(src[1]) + 85 * (Decode85Byte(src[2]) + 85 * (Decode85Byte(src[3]) + 85 * Decode85Byte(src[4])))); |
| 3160 | dst[0] = ((tmp >> 0) & 0xFF); dst[1] = ((tmp >> 8) & 0xFF); dst[2] = ((tmp >> 16) & 0xFF); dst[3] = ((tmp >> 24) & 0xFF); |
| 3161 | src += 5; |
| 3162 | dst += 4; |
| 3163 | } |
| 3164 | } |
| 3165 | #if !defined(IMGUI_DISABLE_DEFAULT_FONT) && !defined(IMGUI_DISABLE_DEFAULT_FONT_BITMAP) |
| 3166 | static const char* GetDefaultCompressedFontDataProggyClean(int* out_size); |
| 3167 | #endif |
| 3168 | #if !defined(IMGUI_DISABLE_DEFAULT_FONT) && !defined(IMGUI_DISABLE_DEFAULT_FONT_VECTOR) |
| 3169 | static const char* GetDefaultCompressedFontDataProggyForever(int* out_size); |
| 3170 | #endif |
| 3171 | |
| 3172 | |
| 3173 | static float GetExpectedContextFontSize(ImGuiContext* ctx) |
| 3174 | { |
| 3175 | return ((ctx->Style.FontSizeBase > 0.0f) ? ctx->Style.FontSizeBase : 13.0f) * ctx->Style.FontScaleMain * ctx->Style.FontScaleDpi; |
| 3176 | } |
| 3177 | |
| 3178 | |
| 3179 | |
| 3180 | |
| 3181 | ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg) |
| 3182 | { |
| 3183 | if (OwnerContext == NULL || GetExpectedContextFontSize(OwnerContext) >= 15.0f) |
| 3184 | return AddFontDefaultVector(font_cfg); |
| 3185 | else |
| 3186 | return AddFontDefaultBitmap(font_cfg); |
| 3187 | } |
| 3188 | |
| 3189 | |
| 3190 | |
| 3191 | ImFont* ImFontAtlas::AddFontDefaultBitmap(const ImFontConfig* font_cfg_template) |
| 3192 | { |
| 3193 | #if !defined(IMGUI_DISABLE_DEFAULT_FONT) && !defined(IMGUI_DISABLE_DEFAULT_FONT_BITMAP) |
| 3194 | ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig(); |
| 3195 | if (!font_cfg_template) |
| 3196 | font_cfg.PixelSnapH = true; |
| 3197 | if (font_cfg.SizePixels <= 0.0f) |
| 3198 | { |
| 3199 | font_cfg.SizePixels = 13.0f; |
| 3200 | font_cfg.Flags |= ImFontFlags_ImplicitRefSize; |
| 3201 | } |
| 3202 | if (font_cfg.Name[0] == '\0') |
| 3203 | ImFormatString(font_cfg.Name, IM_COUNTOF(font_cfg.Name), "ProggyClean.ttf"); |
| 3204 | font_cfg.EllipsisChar = (ImWchar)0x0085; |
| 3205 | font_cfg.GlyphOffset.y += 1.0f * (font_cfg.SizePixels / 13.0f); |
| 3206 | |
| 3207 | int ttf_compressed_size = 0; |
| 3208 | const char* ttf_compressed = GetDefaultCompressedFontDataProggyClean(&ttf_compressed_size); |
| 3209 | return AddFontFromMemoryCompressedTTF(ttf_compressed, ttf_compressed_size, font_cfg.SizePixels, &font_cfg); |
| 3210 | #else |
| 3211 | IM_ASSERT(0 && "Function is disabled in this build."); |
| 3212 | IM_UNUSED(font_cfg_template); |
| 3213 | return NULL; |
| 3214 | #endif |
| 3215 | } |
| 3216 | |
| 3217 | |
| 3218 | |
| 3219 | ImFont* ImFontAtlas::AddFontDefaultVector(const ImFontConfig* font_cfg_template) |
| 3220 | { |
| 3221 | #if !defined(IMGUI_DISABLE_DEFAULT_FONT) && !defined(IMGUI_DISABLE_DEFAULT_FONT_VECTOR) |
| 3222 | ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig(); |
| 3223 | if (!font_cfg_template) |
| 3224 | font_cfg.PixelSnapH = true; |
| 3225 | if (font_cfg.SizePixels <= 0.0f) |
| 3226 | { |
| 3227 | font_cfg.SizePixels = 13.0f; |
| 3228 | font_cfg.Flags |= ImFontFlags_ImplicitRefSize; |
| 3229 | } |
| 3230 | if (font_cfg.Name[0] == '\0') |
| 3231 | ImFormatString(font_cfg.Name, IM_COUNTOF(font_cfg.Name), "ProggyForever.ttf"); |
| 3232 | font_cfg.ExtraSizeScale *= 1.015f; |
| 3233 | font_cfg.GlyphOffset.y += 0.5f * (font_cfg.SizePixels / 16.0f); |
| 3234 | |
| 3235 | int ttf_compressed_size = 0; |
| 3236 | const char* ttf_compressed = GetDefaultCompressedFontDataProggyForever(&ttf_compressed_size); |
| 3237 | return AddFontFromMemoryCompressedTTF(ttf_compressed, ttf_compressed_size, font_cfg.SizePixels, &font_cfg); |
| 3238 | #else |
| 3239 | IM_ASSERT(0 && "Function is disabled in this build."); |
| 3240 | IM_UNUSED(font_cfg_template); |
| 3241 | return NULL; |
| 3242 | #endif |
| 3243 | } |
| 3244 | |
| 3245 | ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges) |
| 3246 | { |
| 3247 | IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas!"); |
| 3248 | size_t data_size = 0; |
| 3249 | void* data = ImFileLoadToMemory(filename, "rb", &data_size, 0); |
| 3250 | if (!data) |
| 3251 | { |
| 3252 | if (font_cfg_template == NULL || (font_cfg_template->Flags & ImFontFlags_NoLoadError) == 0) |
| 3253 | { |
| 3254 | IMGUI_DEBUG_LOG("While loading '%s'\n", filename); |
| 3255 | IM_ASSERT_USER_ERROR(0, "Could not load font file!"); |
| 3256 | } |
| 3257 | return NULL; |
| 3258 | } |
| 3259 | ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig(); |
| 3260 | if (font_cfg.Name[0] == '\0') |
| 3261 | { |
| 3262 | |
| 3263 | const char* p; |
| 3264 | for (p = filename + ImStrlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\'; p--) {} |
| 3265 | ImFormatString(font_cfg.Name, IM_COUNTOF(font_cfg.Name), "%s", p); |
| 3266 | } |
| 3267 | return AddFontFromMemoryTTF(data, (int)data_size, size_pixels, &font_cfg, glyph_ranges); |
| 3268 | } |
| 3269 | |
| 3270 | |
| 3271 | ImFont* ImFontAtlas::AddFontFromMemoryTTF(void* font_data, int font_data_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges) |
| 3272 | { |
| 3273 | IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas!"); |
| 3274 | ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig(); |
| 3275 | IM_ASSERT(font_cfg.FontData == NULL); |
| 3276 | IM_ASSERT(font_data_size > 100 && "Incorrect value for font_data_size!"); |
| 3277 | font_cfg.FontData = font_data; |
| 3278 | font_cfg.FontDataSize = font_data_size; |
| 3279 | font_cfg.SizePixels = size_pixels > 0.0f ? size_pixels : font_cfg.SizePixels; |
| 3280 | if (glyph_ranges) |
| 3281 | font_cfg.GlyphRanges = glyph_ranges; |
| 3282 | return AddFont(&font_cfg); |
| 3283 | } |
| 3284 | |
| 3285 | ImFont* ImFontAtlas::AddFontFromMemoryCompressedTTF(const void* compressed_ttf_data, int compressed_ttf_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges) |
| 3286 | { |
| 3287 | const unsigned int buf_decompressed_size = stb_decompress_length((const unsigned char*)compressed_ttf_data); |
| 3288 | unsigned char* buf_decompressed_data = (unsigned char*)IM_ALLOC(buf_decompressed_size); |
| 3289 | stb_decompress(buf_decompressed_data, (const unsigned char*)compressed_ttf_data, (unsigned int)compressed_ttf_size); |
| 3290 | |
| 3291 | ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig(); |
| 3292 | IM_ASSERT(font_cfg.FontData == NULL); |
| 3293 | font_cfg.FontDataOwnedByAtlas = true; |
| 3294 | return AddFontFromMemoryTTF(buf_decompressed_data, (int)buf_decompressed_size, size_pixels, &font_cfg, glyph_ranges); |
| 3295 | } |
| 3296 | |
| 3297 | ImFont* ImFontAtlas::AddFontFromMemoryCompressedBase85TTF(const char* compressed_ttf_data_base85, float size_pixels, const ImFontConfig* font_cfg, const ImWchar* glyph_ranges) |
| 3298 | { |
| 3299 | int compressed_ttf_size = (((int)ImStrlen(compressed_ttf_data_base85) + 4) / 5) * 4; |
| 3300 | void* compressed_ttf = IM_ALLOC((size_t)compressed_ttf_size); |
| 3301 | Decode85((const unsigned char*)compressed_ttf_data_base85, (unsigned char*)compressed_ttf); |
| 3302 | ImFont* font = AddFontFromMemoryCompressedTTF(compressed_ttf, compressed_ttf_size, size_pixels, font_cfg, glyph_ranges); |
| 3303 | IM_FREE(compressed_ttf); |
| 3304 | return font; |
| 3305 | } |
| 3306 | |
| 3307 | |
| 3308 | |
| 3309 | void ImFontAtlasBuildNotifySetFont(ImFontAtlas* atlas, ImFont* old_font, ImFont* new_font) |
| 3310 | { |
| 3311 | for (ImDrawListSharedData* shared_data : atlas->DrawListSharedDatas) |
| 3312 | { |
| 3313 | if (shared_data->Font == old_font) |
| 3314 | shared_data->Font = new_font; |
| 3315 | if (ImGuiContext* ctx = shared_data->Context) |
| 3316 | { |
| 3317 | |
| 3318 | |
| 3319 | if (old_font == NULL && ctx->Font == NULL && ctx->FontSizeBase == 0.0f) |
| 3320 | continue; |
| 3321 | |
| 3322 | if (ctx->IO.FontDefault == old_font) |
| 3323 | ctx->IO.FontDefault = new_font; |
| 3324 | if (ctx->Font == old_font) |
| 3325 | { |
| 3326 | ImGuiContext* curr_ctx = ImGui::GetCurrentContext(); |
| 3327 | bool need_bind_ctx = ctx != curr_ctx; |
| 3328 | if (need_bind_ctx) |
| 3329 | ImGui::SetCurrentContext(ctx); |
| 3330 | ImGui::SetCurrentFont(new_font, ctx->FontSizeBase, ctx->FontSize); |
| 3331 | if (need_bind_ctx) |
| 3332 | ImGui::SetCurrentContext(curr_ctx); |
| 3333 | } |
| 3334 | for (ImFontStackData& font_stack_data : ctx->FontStack) |
| 3335 | if (font_stack_data.Font == old_font) |
| 3336 | font_stack_data.Font = new_font; |
| 3337 | } |
| 3338 | } |
| 3339 | } |
| 3340 | |
| 3341 | void ImFontAtlas::RemoveFont(ImFont* font) |
| 3342 | { |
| 3343 | IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas!"); |
| 3344 | |
| 3345 | ImFontAtlasFontDestroyOutput(this, font); |
| 3346 | for (ImFontConfig* src : font->Sources) |
| 3347 | ImFontAtlasFontDestroySourceData(this, src); |
| 3348 | for (int src_n = 0; src_n < Sources.Size; src_n++) |
| 3349 | if (Sources[src_n].DstFont == font) |
| 3350 | Sources.erase(&Sources[src_n--]); |
| 3351 | |
| 3352 | bool removed = Fonts.find_erase(font); |
| 3353 | IM_ASSERT(removed); |
| 3354 | IM_UNUSED(removed); |
| 3355 | |
| 3356 | ImFontAtlasBuildUpdatePointers(this); |
| 3357 | |
| 3358 | font->OwnerAtlas = NULL; |
| 3359 | IM_DELETE(font); |
| 3360 | |
| 3361 | |
| 3362 | ImFont* new_current_font = Fonts.empty() ? NULL : Fonts[0]; |
| 3363 | ImFontAtlasBuildNotifySetFont(this, font, new_current_font); |
| 3364 | } |
| 3365 | |
| 3366 | |
| 3367 | ImFontAtlasRectId ImFontAtlas::AddCustomRect(int width, int height, ImFontAtlasRect* out_r) |
| 3368 | { |
| 3369 | IM_ASSERT(width > 0 && width <= 0xFFFF); |
| 3370 | IM_ASSERT(height > 0 && height <= 0xFFFF); |
| 3371 | |
| 3372 | if (Builder == NULL) |
| 3373 | ImFontAtlasBuildInit(this); |
| 3374 | |
| 3375 | ImFontAtlasRectId r_id = ImFontAtlasPackAddRect(this, width, height); |
| 3376 | if (r_id == ImFontAtlasRectId_Invalid) |
| 3377 | return ImFontAtlasRectId_Invalid; |
| 3378 | if (out_r != NULL) |
| 3379 | GetCustomRect(r_id, out_r); |
| 3380 | |
| 3381 | if (RendererHasTextures) |
| 3382 | { |
| 3383 | ImTextureRect* r = ImFontAtlasPackGetRect(this, r_id); |
| 3384 | ImFontAtlasTextureBlockQueueUpload(this, TexData, r->x, r->y, r->w, r->h); |
| 3385 | } |
| 3386 | return r_id; |
| 3387 | } |
| 3388 | |
| 3389 | void ImFontAtlas::RemoveCustomRect(ImFontAtlasRectId id) |
| 3390 | { |
| 3391 | if (ImFontAtlasPackGetRectSafe(this, id) == NULL) |
| 3392 | return; |
| 3393 | ImFontAtlasPackDiscardRect(this, id); |
| 3394 | } |
| 3395 | |
| 3396 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS |
| 3397 | |
| 3398 | |
| 3399 | |
| 3400 | |
| 3401 | |
| 3402 | |
| 3403 | ImFontAtlasRectId ImFontAtlas::AddCustomRectFontGlyph(ImFont* font, ImWchar codepoint, int width, int height, float advance_x, const ImVec2& offset) |
| 3404 | { |
| 3405 | float font_size = font->LegacySize; |
| 3406 | return AddCustomRectFontGlyphForSize(font, font_size, codepoint, width, height, advance_x, offset); |
| 3407 | } |
| 3408 | |
| 3409 | |
| 3410 | ImFontAtlasRectId ImFontAtlas::AddCustomRectFontGlyphForSize(ImFont* font, float font_size, ImWchar codepoint, int width, int height, float advance_x, const ImVec2& offset) |
| 3411 | { |
| 3412 | #ifdef IMGUI_USE_WCHAR32 |
| 3413 | IM_ASSERT(codepoint <= IM_UNICODE_CODEPOINT_MAX); |
| 3414 | #endif |
| 3415 | IM_ASSERT(font != NULL); |
| 3416 | IM_ASSERT(width > 0 && width <= 0xFFFF); |
| 3417 | IM_ASSERT(height > 0 && height <= 0xFFFF); |
| 3418 | |
| 3419 | ImFontBaked* baked = font->GetFontBaked(font_size); |
| 3420 | |
| 3421 | ImFontAtlasRectId r_id = ImFontAtlasPackAddRect(this, width, height); |
| 3422 | if (r_id == ImFontAtlasRectId_Invalid) |
| 3423 | return ImFontAtlasRectId_Invalid; |
| 3424 | ImTextureRect* r = ImFontAtlasPackGetRect(this, r_id); |
| 3425 | if (RendererHasTextures) |
| 3426 | ImFontAtlasTextureBlockQueueUpload(this, TexData, r->x, r->y, r->w, r->h); |
| 3427 | |
| 3428 | if (baked->IsGlyphLoaded(codepoint)) |
| 3429 | ImFontAtlasBakedDiscardFontGlyph(this, font, baked, baked->FindGlyph(codepoint)); |
| 3430 | |
| 3431 | ImFontGlyph glyph; |
| 3432 | glyph.Codepoint = codepoint; |
| 3433 | glyph.AdvanceX = advance_x; |
| 3434 | glyph.X0 = offset.x; |
| 3435 | glyph.Y0 = offset.y; |
| 3436 | glyph.X1 = offset.x + r->w; |
| 3437 | glyph.Y1 = offset.y + r->h; |
| 3438 | glyph.Visible = true; |
| 3439 | glyph.Colored = true; |
| 3440 | glyph.PackId = r_id; |
| 3441 | ImFontAtlasBakedAddFontGlyph(this, baked, font->Sources[0], &glyph); |
| 3442 | return r_id; |
| 3443 | } |
| 3444 | #endif |
| 3445 | |
| 3446 | bool ImFontAtlas::GetCustomRect(ImFontAtlasRectId id, ImFontAtlasRect* out_r) const |
| 3447 | { |
| 3448 | ImTextureRect* r = ImFontAtlasPackGetRectSafe((ImFontAtlas*)this, id); |
| 3449 | if (r == NULL) |
| 3450 | return false; |
| 3451 | IM_ASSERT(TexData->Width > 0 && TexData->Height > 0); |
| 3452 | if (out_r == NULL) |
| 3453 | return true; |
| 3454 | out_r->x = r->x; |
| 3455 | out_r->y = r->y; |
| 3456 | out_r->w = r->w; |
| 3457 | out_r->h = r->h; |
| 3458 | out_r->uv0 = ImVec2((float)(r->x), (float)(r->y)) * TexUvScale; |
| 3459 | out_r->uv1 = ImVec2((float)(r->x + r->w), (float)(r->y + r->h)) * TexUvScale; |
| 3460 | return true; |
| 3461 | } |
| 3462 | |
| 3463 | bool ImFontAtlasGetMouseCursorTexData(ImFontAtlas* atlas, ImGuiMouseCursor cursor_type, ImVec2* out_offset, ImVec2* out_size, ImVec2 out_uv_border[2], ImVec2 out_uv_fill[2]) |
| 3464 | { |
| 3465 | if (cursor_type <= ImGuiMouseCursor_None || cursor_type >= ImGuiMouseCursor_COUNT) |
| 3466 | return false; |
| 3467 | if (atlas->Flags & ImFontAtlasFlags_NoMouseCursors) |
| 3468 | return false; |
| 3469 | |
| 3470 | ImTextureRect* r = ImFontAtlasPackGetRect(atlas, atlas->Builder->PackIdMouseCursors); |
| 3471 | ImVec2 pos = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][0] + ImVec2((float)r->x, (float)r->y); |
| 3472 | ImVec2 size = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][1]; |
| 3473 | *out_size = size; |
| 3474 | *out_offset = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][2]; |
| 3475 | out_uv_border[0] = (pos) * atlas->TexUvScale; |
| 3476 | out_uv_border[1] = (pos + size) * atlas->TexUvScale; |
| 3477 | pos.x += FONT_ATLAS_DEFAULT_TEX_DATA_W + 1; |
| 3478 | out_uv_fill[0] = (pos) * atlas->TexUvScale; |
| 3479 | out_uv_fill[1] = (pos + size) * atlas->TexUvScale; |
| 3480 | return true; |
| 3481 | } |
| 3482 | |
| 3483 | |
| 3484 | void ImFontAtlasBuildMain(ImFontAtlas* atlas) |
| 3485 | { |
| 3486 | IM_ASSERT(!atlas->Locked && "Cannot modify a locked ImFontAtlas!"); |
| 3487 | if (atlas->TexData && atlas->TexData->Format != atlas->TexDesiredFormat) |
| 3488 | ImFontAtlasBuildClear(atlas); |
| 3489 | |
| 3490 | if (atlas->Builder == NULL) |
| 3491 | ImFontAtlasBuildInit(atlas); |
| 3492 | |
| 3493 | |
| 3494 | if (atlas->Sources.Size == 0) |
| 3495 | atlas->AddFontDefault(); |
| 3496 | |
| 3497 | |
| 3498 | ImFontAtlasBuildUpdateRendererHasTexturesFromContext(atlas); |
| 3499 | if (atlas->RendererHasTextures == false) |
| 3500 | ImFontAtlasBuildLegacyPreloadAllGlyphRanges(atlas); |
| 3501 | atlas->TexIsBuilt = true; |
| 3502 | } |
| 3503 | |
| 3504 | void ImFontAtlasBuildGetOversampleFactors(ImFontConfig* src, ImFontBaked* baked, int* out_oversample_h, int* out_oversample_v) |
| 3505 | { |
| 3506 | |
| 3507 | |
| 3508 | const float raster_size = baked->Size * baked->RasterizerDensity * src->RasterizerDensity; |
| 3509 | *out_oversample_h = (src->OversampleH != 0) ? src->OversampleH : (raster_size > 36.0f || src->PixelSnapH) ? 1 : 2; |
| 3510 | *out_oversample_v = (src->OversampleV != 0) ? src->OversampleV : 1; |
| 3511 | } |
| 3512 | |
| 3513 | |
| 3514 | |
| 3515 | void ImFontAtlasBuildSetupFontLoader(ImFontAtlas* atlas, const ImFontLoader* font_loader) |
| 3516 | { |
| 3517 | if (atlas->FontLoader == font_loader) |
| 3518 | return; |
| 3519 | IM_ASSERT(!atlas->Locked && "Cannot modify a locked ImFontAtlas!"); |
| 3520 | |
| 3521 | for (ImFont* font : atlas->Fonts) |
| 3522 | ImFontAtlasFontDestroyOutput(atlas, font); |
| 3523 | if (atlas->Builder && atlas->FontLoader && atlas->FontLoader->LoaderShutdown) |
| 3524 | atlas->FontLoader->LoaderShutdown(atlas); |
| 3525 | |
| 3526 | atlas->FontLoader = font_loader; |
| 3527 | atlas->FontLoaderName = font_loader ? font_loader->Name : "NULL"; |
| 3528 | IM_ASSERT(atlas->FontLoaderData == NULL); |
| 3529 | |
| 3530 | if (atlas->Builder && atlas->FontLoader && atlas->FontLoader->LoaderInit) |
| 3531 | atlas->FontLoader->LoaderInit(atlas); |
| 3532 | for (ImFont* font : atlas->Fonts) |
| 3533 | ImFontAtlasFontInitOutput(atlas, font); |
| 3534 | for (ImFont* font : atlas->Fonts) |
| 3535 | for (ImFontConfig* src : font->Sources) |
| 3536 | ImFontAtlasFontSourceAddToFont(atlas, font, src); |
| 3537 | } |
| 3538 | |
| 3539 | |
| 3540 | |
| 3541 | void ImFontAtlasBuildLegacyPreloadAllGlyphRanges(ImFontAtlas* atlas) |
| 3542 | { |
| 3543 | atlas->Builder->PreloadedAllGlyphsRanges = true; |
| 3544 | for (ImFont* font : atlas->Fonts) |
| 3545 | { |
| 3546 | ImFontBaked* baked = font->GetFontBaked(font->LegacySize); |
| 3547 | if (font->FallbackChar != 0) |
| 3548 | baked->FindGlyph(font->FallbackChar); |
| 3549 | if (font->EllipsisChar != 0) |
| 3550 | baked->FindGlyph(font->EllipsisChar); |
| 3551 | for (ImFontConfig* src : font->Sources) |
| 3552 | { |
| 3553 | const ImWchar* ranges = src->GlyphRanges ? src->GlyphRanges : atlas->GetGlyphRangesDefault(); |
| 3554 | for (; ranges[0]; ranges += 2) |
| 3555 | for (unsigned int c = ranges[0]; c <= ranges[1] && c <= IM_UNICODE_CODEPOINT_MAX; c++) |
| 3556 | baked->FindGlyph((ImWchar)c); |
| 3557 | } |
| 3558 | } |
| 3559 | } |
| 3560 | |
| 3561 | |
| 3562 | void ImFontAtlasBuildUpdatePointers(ImFontAtlas* atlas) |
| 3563 | { |
| 3564 | for (ImFont* font : atlas->Fonts) |
| 3565 | font->Sources.resize(0); |
| 3566 | for (ImFontConfig& src : atlas->Sources) |
| 3567 | src.DstFont->Sources.push_back(&src); |
| 3568 | } |
| 3569 | |
| 3570 | |
| 3571 | void ImFontAtlasBuildRenderBitmapFromString(ImFontAtlas* atlas, int x, int y, int w, int h, const char* in_str, char in_marker_char) |
| 3572 | { |
| 3573 | ImTextureData* tex = atlas->TexData; |
| 3574 | IM_ASSERT(x >= 0 && x + w <= tex->Width); |
| 3575 | IM_ASSERT(y >= 0 && y + h <= tex->Height); |
| 3576 | |
| 3577 | switch (tex->Format) |
| 3578 | { |
| 3579 | case ImTextureFormat_Alpha8: |
| 3580 | { |
| 3581 | ImU8* out_p = (ImU8*)tex->GetPixelsAt(x, y); |
| 3582 | for (int off_y = 0; off_y < h; off_y++, out_p += tex->Width, in_str += w) |
| 3583 | for (int off_x = 0; off_x < w; off_x++) |
| 3584 | out_p[off_x] = (in_str[off_x] == in_marker_char) ? 0xFF : 0x00; |
| 3585 | break; |
| 3586 | } |
| 3587 | case ImTextureFormat_RGBA32: |
| 3588 | { |
| 3589 | ImU32* out_p = (ImU32*)tex->GetPixelsAt(x, y); |
| 3590 | for (int off_y = 0; off_y < h; off_y++, out_p += tex->Width, in_str += w) |
| 3591 | for (int off_x = 0; off_x < w; off_x++) |
| 3592 | out_p[off_x] = (in_str[off_x] == in_marker_char) ? IM_COL32_WHITE : IM_COL32_BLACK_TRANS; |
| 3593 | break; |
| 3594 | } |
| 3595 | } |
| 3596 | } |
| 3597 | |
| 3598 | static void ImFontAtlasBuildUpdateTexDataBasic(ImFontAtlas* atlas) |
| 3599 | { |
| 3600 | |
| 3601 | |
| 3602 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 3603 | ImVec2i pack_size = (atlas->Flags & ImFontAtlasFlags_NoMouseCursors) ? ImVec2i(2, 2) : ImVec2i(FONT_ATLAS_DEFAULT_TEX_DATA_W * 2 + 1, FONT_ATLAS_DEFAULT_TEX_DATA_H); |
| 3604 | |
| 3605 | ImFontAtlasRect r; |
| 3606 | bool add_and_draw = (atlas->GetCustomRect(builder->PackIdMouseCursors, &r) == false); |
| 3607 | if (add_and_draw) |
| 3608 | { |
| 3609 | builder->PackIdMouseCursors = atlas->AddCustomRect(pack_size.x, pack_size.y, &r); |
| 3610 | IM_ASSERT(builder->PackIdMouseCursors != ImFontAtlasRectId_Invalid); |
| 3611 | |
| 3612 | |
| 3613 | if (atlas->Flags & ImFontAtlasFlags_NoMouseCursors) |
| 3614 | { |
| 3615 | |
| 3616 | ImFontAtlasBuildRenderBitmapFromString(atlas, r.x, r.y, 2, 2, "XX" "XX", 'X'); |
| 3617 | } |
| 3618 | else |
| 3619 | { |
| 3620 | |
| 3621 | const int x_for_white = r.x; |
| 3622 | const int x_for_black = r.x + FONT_ATLAS_DEFAULT_TEX_DATA_W + 1; |
| 3623 | ImFontAtlasBuildRenderBitmapFromString(atlas, x_for_white, r.y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, '.'); |
| 3624 | ImFontAtlasBuildRenderBitmapFromString(atlas, x_for_black, r.y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, 'X'); |
| 3625 | } |
| 3626 | } |
| 3627 | |
| 3628 | |
| 3629 | atlas->TexUvWhitePixel = ImVec2((r.x + 0.5f) * atlas->TexUvScale.x, (r.y + 0.5f) * atlas->TexUvScale.y); |
| 3630 | } |
| 3631 | |
| 3632 | static void ImFontAtlasBuildUpdateTexDataLines(ImFontAtlas* atlas) |
| 3633 | { |
| 3634 | if (atlas->Flags & ImFontAtlasFlags_NoBakedLines) |
| 3635 | return; |
| 3636 | |
| 3637 | |
| 3638 | ImTextureData* tex = atlas->TexData; |
| 3639 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 3640 | |
| 3641 | ImFontAtlasRect r; |
| 3642 | bool add_and_draw = atlas->GetCustomRect(builder->PackIdLinesTexData, &r) == false; |
| 3643 | if (add_and_draw) |
| 3644 | { |
| 3645 | ImVec2i pack_size = ImVec2i(IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 2, IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1); |
| 3646 | builder->PackIdLinesTexData = atlas->AddCustomRect(pack_size.x, pack_size.y, &r); |
| 3647 | IM_ASSERT(builder->PackIdLinesTexData != ImFontAtlasRectId_Invalid); |
| 3648 | } |
| 3649 | |
| 3650 | |
| 3651 | |
| 3652 | |
| 3653 | for (int n = 0; n < IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1; n++) |
| 3654 | { |
| 3655 | |
| 3656 | const int y = n; |
| 3657 | const int line_width = n; |
| 3658 | const int pad_left = (r.w - line_width) / 2; |
| 3659 | const int pad_right = r.w - (pad_left + line_width); |
| 3660 | IM_ASSERT(pad_left + line_width + pad_right == r.w && y < r.h); |
| 3661 | |
| 3662 | |
| 3663 | if (add_and_draw && tex->Format == ImTextureFormat_Alpha8) |
| 3664 | { |
| 3665 | ImU8* write_ptr = (ImU8*)tex->GetPixelsAt(r.x, r.y + y); |
| 3666 | for (int i = 0; i < pad_left; i++) |
| 3667 | *(write_ptr + i) = 0x00; |
| 3668 | |
| 3669 | for (int i = 0; i < line_width; i++) |
| 3670 | *(write_ptr + pad_left + i) = 0xFF; |
| 3671 | |
| 3672 | for (int i = 0; i < pad_right; i++) |
| 3673 | *(write_ptr + pad_left + line_width + i) = 0x00; |
| 3674 | } |
| 3675 | else if (add_and_draw && tex->Format == ImTextureFormat_RGBA32) |
| 3676 | { |
| 3677 | ImU32* write_ptr = (ImU32*)(void*)tex->GetPixelsAt(r.x, r.y + y); |
| 3678 | for (int i = 0; i < pad_left; i++) |
| 3679 | *(write_ptr + i) = IM_COL32(255, 255, 255, 0); |
| 3680 | |
| 3681 | for (int i = 0; i < line_width; i++) |
| 3682 | *(write_ptr + pad_left + i) = IM_COL32_WHITE; |
| 3683 | |
| 3684 | for (int i = 0; i < pad_right; i++) |
| 3685 | *(write_ptr + pad_left + line_width + i) = IM_COL32(255, 255, 255, 0); |
| 3686 | } |
| 3687 | |
| 3688 | |
| 3689 | ImVec2 uv0 = ImVec2((float)(r.x + pad_left - 1), (float)(r.y + y)) * atlas->TexUvScale; |
| 3690 | ImVec2 uv1 = ImVec2((float)(r.x + pad_left + line_width + 1), (float)(r.y + y + 1)) * atlas->TexUvScale; |
| 3691 | float half_v = (uv0.y + uv1.y) * 0.5f; |
| 3692 | atlas->TexUvLines[n] = ImVec4(uv0.x, half_v, uv1.x, half_v); |
| 3693 | } |
| 3694 | } |
| 3695 | |
| 3696 | |
| 3697 | |
| 3698 | |
| 3699 | bool ImFontAtlasFontInitOutput(ImFontAtlas* atlas, ImFont* font) |
| 3700 | { |
| 3701 | bool ret = true; |
| 3702 | for (ImFontConfig* src : font->Sources) |
| 3703 | if (!ImFontAtlasFontSourceInit(atlas, src)) |
| 3704 | ret = false; |
| 3705 | IM_ASSERT(ret); |
| 3706 | return ret; |
| 3707 | } |
| 3708 | |
| 3709 | |
| 3710 | void ImFontAtlasFontDestroyOutput(ImFontAtlas* atlas, ImFont* font) |
| 3711 | { |
| 3712 | font->ClearOutputData(); |
| 3713 | for (ImFontConfig* src : font->Sources) |
| 3714 | { |
| 3715 | const ImFontLoader* loader = src->FontLoader ? src->FontLoader : atlas->FontLoader; |
| 3716 | if (loader && loader->FontSrcDestroy != NULL) |
| 3717 | loader->FontSrcDestroy(atlas, src); |
| 3718 | } |
| 3719 | } |
| 3720 | |
| 3721 | void ImFontAtlasFontRebuildOutput(ImFontAtlas* atlas, ImFont* font) |
| 3722 | { |
| 3723 | ImFontAtlasFontDestroyOutput(atlas, font); |
| 3724 | ImFontAtlasFontInitOutput(atlas, font); |
| 3725 | } |
| 3726 | |
| 3727 | |
| 3728 | |
| 3729 | bool ImFontAtlasFontSourceInit(ImFontAtlas* atlas, ImFontConfig* src) |
| 3730 | { |
| 3731 | const ImFontLoader* loader = src->FontLoader ? src->FontLoader : atlas->FontLoader; |
| 3732 | if (loader->FontSrcInit != NULL && !loader->FontSrcInit(atlas, src)) |
| 3733 | return false; |
| 3734 | return true; |
| 3735 | } |
| 3736 | |
| 3737 | void ImFontAtlasFontSourceAddToFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* src) |
| 3738 | { |
| 3739 | if (src->MergeMode == false) |
| 3740 | { |
| 3741 | font->ClearOutputData(); |
| 3742 | |
| 3743 | font->OwnerAtlas = atlas; |
| 3744 | IM_ASSERT(font->Sources[0] == src); |
| 3745 | } |
| 3746 | atlas->TexIsBuilt = false; |
| 3747 | ImFontAtlasBuildSetupFontSpecialGlyphs(atlas, font, src); |
| 3748 | } |
| 3749 | |
| 3750 | void ImFontAtlasFontDestroySourceData(ImFontAtlas* atlas, ImFontConfig* src) |
| 3751 | { |
| 3752 | IM_UNUSED(atlas); |
| 3753 | |
| 3754 | |
| 3755 | |
| 3756 | |
| 3757 | |
| 3758 | if (src->FontDataOwnedByAtlas) |
| 3759 | IM_FREE(src->FontData); |
| 3760 | src->FontData = NULL; |
| 3761 | if (src->GlyphExcludeRanges) |
| 3762 | IM_FREE((void*)src->GlyphExcludeRanges); |
| 3763 | src->GlyphExcludeRanges = NULL; |
| 3764 | } |
| 3765 | |
| 3766 | |
| 3767 | |
| 3768 | |
| 3769 | static ImFontGlyph* ImFontAtlasBuildSetupFontBakedEllipsis(ImFontAtlas* atlas, ImFontBaked* baked) |
| 3770 | { |
| 3771 | ImFont* font = baked->OwnerFont; |
| 3772 | IM_ASSERT(font->EllipsisChar != 0); |
| 3773 | |
| 3774 | const ImFontGlyph* dot_glyph = baked->FindGlyphNoFallback((ImWchar)'.'); |
| 3775 | if (dot_glyph == NULL) |
| 3776 | dot_glyph = baked->FindGlyphNoFallback((ImWchar)0xFF0E); |
| 3777 | if (dot_glyph == NULL) |
| 3778 | return NULL; |
| 3779 | ImFontAtlasRectId dot_r_id = dot_glyph->PackId; |
| 3780 | ImTextureRect* dot_r = ImFontAtlasPackGetRect(atlas, dot_r_id); |
| 3781 | const int dot_spacing = 1; |
| 3782 | const float dot_step = (dot_glyph->X1 - dot_glyph->X0) + dot_spacing; |
| 3783 | |
| 3784 | ImFontAtlasRectId pack_id = ImFontAtlasPackAddRect(atlas, (dot_r->w * 3 + dot_spacing * 2), dot_r->h); |
| 3785 | ImTextureRect* r = ImFontAtlasPackGetRect(atlas, pack_id); |
| 3786 | |
| 3787 | ImFontGlyph glyph_in = {}; |
| 3788 | ImFontGlyph* glyph = &glyph_in; |
| 3789 | glyph->Codepoint = font->EllipsisChar; |
| 3790 | glyph->AdvanceX = ImMax(dot_glyph->AdvanceX, dot_glyph->X0 + dot_step * 3.0f - dot_spacing); |
| 3791 | glyph->X0 = dot_glyph->X0; |
| 3792 | glyph->Y0 = dot_glyph->Y0; |
| 3793 | glyph->X1 = dot_glyph->X0 + dot_step * 3 - dot_spacing; |
| 3794 | glyph->Y1 = dot_glyph->Y1; |
| 3795 | glyph->Visible = true; |
| 3796 | glyph->PackId = pack_id; |
| 3797 | glyph = ImFontAtlasBakedAddFontGlyph(atlas, baked, NULL, glyph); |
| 3798 | dot_glyph = NULL; |
| 3799 | |
| 3800 | |
| 3801 | |
| 3802 | dot_r = ImFontAtlasPackGetRect(atlas, dot_r_id); |
| 3803 | ImTextureData* tex = atlas->TexData; |
| 3804 | for (int n = 0; n < 3; n++) |
| 3805 | ImFontAtlasTextureBlockCopy(tex, dot_r->x, dot_r->y, tex, r->x + (dot_r->w + dot_spacing) * n, r->y, dot_r->w, dot_r->h); |
| 3806 | ImFontAtlasTextureBlockQueueUpload(atlas, tex, r->x, r->y, r->w, r->h); |
| 3807 | |
| 3808 | return glyph; |
| 3809 | } |
| 3810 | |
| 3811 | |
| 3812 | |
| 3813 | static void ImFontAtlasBuildSetupFontBakedFallback(ImFontBaked* baked) |
| 3814 | { |
| 3815 | IM_ASSERT(baked->FallbackGlyphIndex == -1); |
| 3816 | IM_ASSERT(baked->FallbackAdvanceX == 0.0f); |
| 3817 | ImFont* font = baked->OwnerFont; |
| 3818 | ImFontGlyph* fallback_glyph = NULL; |
| 3819 | if (font->FallbackChar != 0) |
| 3820 | fallback_glyph = baked->FindGlyphNoFallback(font->FallbackChar); |
| 3821 | if (fallback_glyph == NULL) |
| 3822 | { |
| 3823 | ImFontGlyph* space_glyph = baked->FindGlyphNoFallback((ImWchar)' '); |
| 3824 | ImFontGlyph glyph; |
| 3825 | glyph.Codepoint = 0; |
| 3826 | glyph.AdvanceX = space_glyph ? space_glyph->AdvanceX : IM_ROUND(baked->Size * 0.40f); |
| 3827 | fallback_glyph = ImFontAtlasBakedAddFontGlyph(font->OwnerAtlas, baked, NULL, &glyph); |
| 3828 | } |
| 3829 | baked->FallbackGlyphIndex = baked->Glyphs.index_from_ptr(fallback_glyph); |
| 3830 | baked->FallbackAdvanceX = fallback_glyph->AdvanceX; |
| 3831 | } |
| 3832 | |
| 3833 | static void ImFontAtlasBuildSetupFontBakedBlanks(ImFontAtlas* atlas, ImFontBaked* baked) |
| 3834 | { |
| 3835 | |
| 3836 | ImFontGlyph* space_glyph = baked->FindGlyphNoFallback((ImWchar)' '); |
| 3837 | if (space_glyph != NULL) |
| 3838 | space_glyph->Visible = false; |
| 3839 | |
| 3840 | |
| 3841 | |
| 3842 | if (baked->FindGlyphNoFallback('\t') == NULL && space_glyph != NULL) |
| 3843 | { |
| 3844 | ImFontGlyph tab_glyph; |
| 3845 | tab_glyph.Codepoint = '\t'; |
| 3846 | tab_glyph.AdvanceX = space_glyph->AdvanceX * IM_TABSIZE; |
| 3847 | ImFontAtlasBakedAddFontGlyph(atlas, baked, NULL, &tab_glyph); |
| 3848 | } |
| 3849 | } |
| 3850 | |
| 3851 | |
| 3852 | |
| 3853 | void ImFontAtlasBuildSetupFontSpecialGlyphs(ImFontAtlas* atlas, ImFont* font, ImFontConfig* src) |
| 3854 | { |
| 3855 | IM_UNUSED(atlas); |
| 3856 | IM_ASSERT(font->Sources.contains(src)); |
| 3857 | |
| 3858 | |
| 3859 | const ImWchar fallback_chars[] = { font->FallbackChar, (ImWchar)IM_UNICODE_CODEPOINT_INVALID, (ImWchar)'?', (ImWchar)' ' }; |
| 3860 | if (font->FallbackChar == 0) |
| 3861 | for (ImWchar candidate_char : fallback_chars) |
| 3862 | if (candidate_char != 0 && font->IsGlyphInFont(candidate_char)) |
| 3863 | { |
| 3864 | font->FallbackChar = (ImWchar)candidate_char; |
| 3865 | break; |
| 3866 | } |
| 3867 | |
| 3868 | |
| 3869 | |
| 3870 | |
| 3871 | const ImWchar ellipsis_chars[] = { src->EllipsisChar, (ImWchar)0x2026, (ImWchar)0x0085 }; |
| 3872 | if (font->EllipsisChar == 0) |
| 3873 | for (ImWchar candidate_char : ellipsis_chars) |
| 3874 | if (candidate_char != 0 && font->IsGlyphInFont(candidate_char)) |
| 3875 | { |
| 3876 | font->EllipsisChar = candidate_char; |
| 3877 | break; |
| 3878 | } |
| 3879 | if (font->EllipsisChar == 0) |
| 3880 | { |
| 3881 | font->EllipsisChar = 0x0085; |
| 3882 | font->EllipsisAutoBake = true; |
| 3883 | } |
| 3884 | } |
| 3885 | |
| 3886 | void ImFontAtlasBakedDiscardFontGlyph(ImFontAtlas* atlas, ImFont* font, ImFontBaked* baked, ImFontGlyph* glyph) |
| 3887 | { |
| 3888 | if (glyph->PackId != ImFontAtlasRectId_Invalid) |
| 3889 | { |
| 3890 | ImFontAtlasPackDiscardRect(atlas, glyph->PackId); |
| 3891 | glyph->PackId = ImFontAtlasRectId_Invalid; |
| 3892 | } |
| 3893 | ImWchar c = (ImWchar)glyph->Codepoint; |
| 3894 | IM_ASSERT(font->FallbackChar != c && font->EllipsisChar != c); |
| 3895 | IM_ASSERT(glyph >= baked->Glyphs.Data && glyph < baked->Glyphs.Data + baked->Glyphs.Size); |
| 3896 | IM_UNUSED(font); |
| 3897 | baked->IndexLookup[c] = IM_FONTGLYPH_INDEX_UNUSED; |
| 3898 | baked->IndexAdvanceX[c] = baked->FallbackAdvanceX; |
| 3899 | } |
| 3900 | |
| 3901 | ImFontBaked* ImFontAtlasBakedAdd(ImFontAtlas* atlas, ImFont* font, float font_size, float font_rasterizer_density, ImGuiID baked_id) |
| 3902 | { |
| 3903 | IMGUI_DEBUG_LOG_FONT("[font] Created baked %.2fpx\n", font_size); |
| 3904 | ImFontBaked* baked = atlas->Builder->BakedPool.push_back(ImFontBaked()); |
| 3905 | baked->Size = font_size; |
| 3906 | baked->RasterizerDensity = font_rasterizer_density; |
| 3907 | baked->BakedId = baked_id; |
| 3908 | baked->OwnerFont = font; |
| 3909 | baked->LastUsedFrame = atlas->Builder->FrameCount; |
| 3910 | |
| 3911 | |
| 3912 | size_t loader_data_size = 0; |
| 3913 | for (ImFontConfig* src : font->Sources) |
| 3914 | { |
| 3915 | const ImFontLoader* loader = src->FontLoader ? src->FontLoader : atlas->FontLoader; |
| 3916 | loader_data_size += loader->FontBakedSrcLoaderDataSize; |
| 3917 | } |
| 3918 | baked->FontLoaderDatas = (loader_data_size > 0) ? IM_ALLOC(loader_data_size) : NULL; |
| 3919 | char* loader_data_p = (char*)baked->FontLoaderDatas; |
| 3920 | for (ImFontConfig* src : font->Sources) |
| 3921 | { |
| 3922 | const ImFontLoader* loader = src->FontLoader ? src->FontLoader : atlas->FontLoader; |
| 3923 | if (loader->FontBakedInit) |
| 3924 | loader->FontBakedInit(atlas, src, baked, loader_data_p); |
| 3925 | loader_data_p += loader->FontBakedSrcLoaderDataSize; |
| 3926 | } |
| 3927 | |
| 3928 | ImFontAtlasBuildSetupFontBakedBlanks(atlas, baked); |
| 3929 | return baked; |
| 3930 | } |
| 3931 | |
| 3932 | |
| 3933 | ImFontBaked* ImFontAtlasBakedGetClosestMatch(ImFontAtlas* atlas, ImFont* font, float font_size, float font_rasterizer_density) |
| 3934 | { |
| 3935 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 3936 | for (int step_n = 0; step_n < 2; step_n++) |
| 3937 | { |
| 3938 | ImFontBaked* closest_larger_match = NULL; |
| 3939 | ImFontBaked* closest_smaller_match = NULL; |
| 3940 | for (int baked_n = 0; baked_n < builder->BakedPool.Size; baked_n++) |
| 3941 | { |
| 3942 | ImFontBaked* baked = &builder->BakedPool[baked_n]; |
| 3943 | if (baked->OwnerFont != font || baked->WantDestroy) |
| 3944 | continue; |
| 3945 | if (step_n == 0 && baked->RasterizerDensity != font_rasterizer_density) |
| 3946 | continue; |
| 3947 | if (baked->Size > font_size && (closest_larger_match == NULL || baked->Size < closest_larger_match->Size)) |
| 3948 | closest_larger_match = baked; |
| 3949 | if (baked->Size < font_size && (closest_smaller_match == NULL || baked->Size > closest_smaller_match->Size)) |
| 3950 | closest_smaller_match = baked; |
| 3951 | } |
| 3952 | if (closest_larger_match) |
| 3953 | if (closest_smaller_match == NULL || (closest_larger_match->Size >= font_size * 2.0f && closest_smaller_match->Size > font_size * 0.5f)) |
| 3954 | return closest_larger_match; |
| 3955 | if (closest_smaller_match) |
| 3956 | return closest_smaller_match; |
| 3957 | } |
| 3958 | return NULL; |
| 3959 | } |
| 3960 | |
| 3961 | void ImFontAtlasBakedDiscard(ImFontAtlas* atlas, ImFont* font, ImFontBaked* baked) |
| 3962 | { |
| 3963 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 3964 | IMGUI_DEBUG_LOG_FONT("[font] Discard baked %.2f for \"%s\"\n", baked->Size, font->GetDebugName()); |
| 3965 | |
| 3966 | for (ImFontGlyph& glyph : baked->Glyphs) |
| 3967 | if (glyph.PackId != ImFontAtlasRectId_Invalid) |
| 3968 | ImFontAtlasPackDiscardRect(atlas, glyph.PackId); |
| 3969 | |
| 3970 | char* loader_data_p = (char*)baked->FontLoaderDatas; |
| 3971 | for (ImFontConfig* src : font->Sources) |
| 3972 | { |
| 3973 | const ImFontLoader* loader = src->FontLoader ? src->FontLoader : atlas->FontLoader; |
| 3974 | if (loader->FontBakedDestroy) |
| 3975 | loader->FontBakedDestroy(atlas, src, baked, loader_data_p); |
| 3976 | loader_data_p += loader->FontBakedSrcLoaderDataSize; |
| 3977 | } |
| 3978 | if (baked->FontLoaderDatas) |
| 3979 | { |
| 3980 | IM_FREE(baked->FontLoaderDatas); |
| 3981 | baked->FontLoaderDatas = NULL; |
| 3982 | } |
| 3983 | builder->BakedMap.SetVoidPtr(baked->BakedId, NULL); |
| 3984 | builder->BakedDiscardedCount++; |
| 3985 | baked->ClearOutputData(); |
| 3986 | baked->WantDestroy = true; |
| 3987 | font->LastBaked = NULL; |
| 3988 | } |
| 3989 | |
| 3990 | |
| 3991 | void ImFontAtlasFontDiscardBakes(ImFontAtlas* atlas, ImFont* font, int unused_frames) |
| 3992 | { |
| 3993 | if (ImFontAtlasBuilder* builder = atlas->Builder) |
| 3994 | for (int baked_n = 0; baked_n < builder->BakedPool.Size; baked_n++) |
| 3995 | { |
| 3996 | ImFontBaked* baked = &builder->BakedPool[baked_n]; |
| 3997 | if (baked->LastUsedFrame + unused_frames > atlas->Builder->FrameCount) |
| 3998 | continue; |
| 3999 | if (baked->OwnerFont != font || baked->WantDestroy) |
| 4000 | continue; |
| 4001 | ImFontAtlasBakedDiscard(atlas, font, baked); |
| 4002 | } |
| 4003 | } |
| 4004 | |
| 4005 | |
| 4006 | void ImFontAtlasBuildDiscardBakes(ImFontAtlas* atlas, int unused_frames) |
| 4007 | { |
| 4008 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 4009 | for (int baked_n = 0; baked_n < builder->BakedPool.Size; baked_n++) |
| 4010 | { |
| 4011 | ImFontBaked* baked = &builder->BakedPool[baked_n]; |
| 4012 | if (baked->LastUsedFrame + unused_frames > atlas->Builder->FrameCount) |
| 4013 | continue; |
| 4014 | if (baked->WantDestroy || (baked->OwnerFont->Flags & ImFontFlags_LockBakedSizes)) |
| 4015 | continue; |
| 4016 | ImFontAtlasBakedDiscard(atlas, baked->OwnerFont, baked); |
| 4017 | } |
| 4018 | } |
| 4019 | |
| 4020 | |
| 4021 | void ImFontAtlasAddDrawListSharedData(ImFontAtlas* atlas, ImDrawListSharedData* data) |
| 4022 | { |
| 4023 | IM_ASSERT(!atlas->DrawListSharedDatas.contains(data)); |
| 4024 | atlas->DrawListSharedDatas.push_back(data); |
| 4025 | } |
| 4026 | |
| 4027 | void ImFontAtlasRemoveDrawListSharedData(ImFontAtlas* atlas, ImDrawListSharedData* data) |
| 4028 | { |
| 4029 | IM_ASSERT(atlas->DrawListSharedDatas.contains(data)); |
| 4030 | atlas->DrawListSharedDatas.find_erase(data); |
| 4031 | } |
| 4032 | |
| 4033 | |
| 4034 | void ImFontAtlasUpdateDrawListsTextures(ImFontAtlas* atlas, ImTextureRef old_tex, ImTextureRef new_tex) |
| 4035 | { |
| 4036 | for (ImDrawListSharedData* shared_data : atlas->DrawListSharedDatas) |
| 4037 | { |
| 4038 | |
| 4039 | if (shared_data->Context && !shared_data->Context->WithinFrameScope) |
| 4040 | continue; |
| 4041 | |
| 4042 | for (ImDrawList* draw_list : shared_data->DrawLists) |
| 4043 | { |
| 4044 | |
| 4045 | |
| 4046 | |
| 4047 | if (draw_list->CmdBuffer.Size > 0 && draw_list->_CmdHeader.TexRef == old_tex) |
| 4048 | draw_list->_SetTexture(new_tex); |
| 4049 | |
| 4050 | |
| 4051 | for (ImTextureRef& stacked_tex : draw_list->_TextureStack) |
| 4052 | if (stacked_tex == old_tex) |
| 4053 | stacked_tex = new_tex; |
| 4054 | } |
| 4055 | } |
| 4056 | } |
| 4057 | |
| 4058 | |
| 4059 | |
| 4060 | void ImFontAtlasUpdateDrawListsSharedData(ImFontAtlas* atlas) |
| 4061 | { |
| 4062 | for (ImDrawListSharedData* shared_data : atlas->DrawListSharedDatas) |
| 4063 | if (shared_data->FontAtlas == atlas) |
| 4064 | { |
| 4065 | shared_data->TexUvWhitePixel = atlas->TexUvWhitePixel; |
| 4066 | shared_data->TexUvLines = atlas->TexUvLines; |
| 4067 | } |
| 4068 | } |
| 4069 | |
| 4070 | |
| 4071 | static void ImFontAtlasBuildSetTexture(ImFontAtlas* atlas, ImTextureData* tex) |
| 4072 | { |
| 4073 | ImTextureRef old_tex_ref = atlas->TexRef; |
| 4074 | atlas->TexData = tex; |
| 4075 | atlas->TexUvScale = ImVec2(1.0f / tex->Width, 1.0f / tex->Height); |
| 4076 | atlas->TexRef._TexData = tex; |
| 4077 | |
| 4078 | ImFontAtlasUpdateDrawListsTextures(atlas, old_tex_ref, atlas->TexRef); |
| 4079 | } |
| 4080 | |
| 4081 | static void ImFontAtlasBuildUpdateTexData(ImFontAtlas* atlas) |
| 4082 | { |
| 4083 | ImFontAtlasBuildUpdateTexDataBasic(atlas); |
| 4084 | ImFontAtlasBuildUpdateTexDataLines(atlas); |
| 4085 | } |
| 4086 | |
| 4087 | |
| 4088 | ImTextureData* ImFontAtlasTextureAdd(ImFontAtlas* atlas, int w, int h) |
| 4089 | { |
| 4090 | ImTextureData* old_tex = atlas->TexData; |
| 4091 | ImTextureData* new_tex; |
| 4092 | |
| 4093 | |
| 4094 | |
| 4095 | |
| 4096 | |
| 4097 | |
| 4098 | |
| 4099 | |
| 4100 | |
| 4101 | |
| 4102 | |
| 4103 | |
| 4104 | { |
| 4105 | |
| 4106 | new_tex = IM_NEW(ImTextureData)(); |
| 4107 | new_tex->UniqueID = atlas->TexNextUniqueID++; |
| 4108 | atlas->TexList.push_back(new_tex); |
| 4109 | } |
| 4110 | if (old_tex != NULL) |
| 4111 | { |
| 4112 | |
| 4113 | old_tex->WantDestroyNextFrame = true; |
| 4114 | IM_ASSERT(old_tex->Status == ImTextureStatus_OK || old_tex->Status == ImTextureStatus_WantCreate || old_tex->Status == ImTextureStatus_WantUpdates); |
| 4115 | } |
| 4116 | |
| 4117 | new_tex->Create(atlas->TexDesiredFormat, w, h); |
| 4118 | atlas->TexIsBuilt = false; |
| 4119 | |
| 4120 | ImFontAtlasBuildSetTexture(atlas, new_tex); |
| 4121 | |
| 4122 | return new_tex; |
| 4123 | } |
| 4124 | |
| 4125 | #if 0 |
| 4126 | #define STB_IMAGE_WRITE_IMPLEMENTATION |
| 4127 | #include "../stb/stb_image_write.h" |
| 4128 | static void ImFontAtlasDebugWriteTexToDisk(ImTextureData* tex, const char* description) |
| 4129 | { |
| 4130 | ImGuiContext& g = *GImGui; |
| 4131 | char buf[128]; |
| 4132 | ImFormatString(buf, IM_COUNTOF(buf), "[%05d] Texture #%03d - %s.png", g.FrameCount, tex->UniqueID, description); |
| 4133 | stbi_write_png(buf, tex->Width, tex->Height, tex->BytesPerPixel, tex->Pixels, tex->GetPitch()); |
| 4134 | } |
| 4135 | #endif |
| 4136 | |
| 4137 | void ImFontAtlasTextureRepack(ImFontAtlas* atlas, int w, int h) |
| 4138 | { |
| 4139 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 4140 | builder->LockDisableResize = true; |
| 4141 | |
| 4142 | ImTextureData* old_tex = atlas->TexData; |
| 4143 | ImTextureData* new_tex = ImFontAtlasTextureAdd(atlas, w, h); |
| 4144 | new_tex->UseColors = old_tex->UseColors; |
| 4145 | IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: resize+repack %dx%d => Texture #%03d: %dx%d\n", old_tex->UniqueID, old_tex->Width, old_tex->Height, new_tex->UniqueID, new_tex->Width, new_tex->Height); |
| 4146 | |
| 4147 | |
| 4148 | |
| 4149 | |
| 4150 | |
| 4151 | |
| 4152 | |
| 4153 | |
| 4154 | |
| 4155 | ImFontAtlasPackInit(atlas); |
| 4156 | ImVector<ImTextureRect> old_rects; |
| 4157 | ImVector<ImFontAtlasRectEntry> old_index = builder->RectsIndex; |
| 4158 | old_rects.swap(builder->Rects); |
| 4159 | |
| 4160 | for (ImFontAtlasRectEntry& index_entry : builder->RectsIndex) |
| 4161 | { |
| 4162 | if (index_entry.IsUsed == false) |
| 4163 | continue; |
| 4164 | ImTextureRect& old_r = old_rects[index_entry.TargetIndex]; |
| 4165 | if (old_r.w == 0 && old_r.h == 0) |
| 4166 | continue; |
| 4167 | ImFontAtlasRectId new_r_id = ImFontAtlasPackAddRect(atlas, old_r.w, old_r.h, &index_entry); |
| 4168 | if (new_r_id == ImFontAtlasRectId_Invalid) |
| 4169 | { |
| 4170 | |
| 4171 | |
| 4172 | IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: resize failed. Will grow.\n", new_tex->UniqueID); |
| 4173 | new_tex->WantDestroyNextFrame = true; |
| 4174 | builder->Rects.swap(old_rects); |
| 4175 | builder->RectsIndex = old_index; |
| 4176 | ImFontAtlasBuildSetTexture(atlas, old_tex); |
| 4177 | ImFontAtlasTextureGrow(atlas, w, h); |
| 4178 | return; |
| 4179 | } |
| 4180 | IM_ASSERT(ImFontAtlasRectId_GetIndex(new_r_id) == builder->RectsIndex.index_from_ptr(&index_entry)); |
| 4181 | ImTextureRect* new_r = ImFontAtlasPackGetRect(atlas, new_r_id); |
| 4182 | ImFontAtlasTextureBlockCopy(old_tex, old_r.x, old_r.y, new_tex, new_r->x, new_r->y, new_r->w, new_r->h); |
| 4183 | } |
| 4184 | IM_ASSERT(old_rects.Size == builder->Rects.Size + builder->RectsDiscardedCount); |
| 4185 | builder->RectsDiscardedCount = 0; |
| 4186 | builder->RectsDiscardedSurface = 0; |
| 4187 | |
| 4188 | |
| 4189 | for (int baked_n = 0; baked_n < builder->BakedPool.Size; baked_n++) |
| 4190 | for (ImFontGlyph& glyph : builder->BakedPool[baked_n].Glyphs) |
| 4191 | if (glyph.PackId != ImFontAtlasRectId_Invalid) |
| 4192 | { |
| 4193 | ImTextureRect* r = ImFontAtlasPackGetRect(atlas, glyph.PackId); |
| 4194 | glyph.U0 = (r->x) * atlas->TexUvScale.x; |
| 4195 | glyph.V0 = (r->y) * atlas->TexUvScale.y; |
| 4196 | glyph.U1 = (r->x + r->w) * atlas->TexUvScale.x; |
| 4197 | glyph.V1 = (r->y + r->h) * atlas->TexUvScale.y; |
| 4198 | } |
| 4199 | |
| 4200 | |
| 4201 | ImFontAtlasBuildUpdateTexData(atlas); |
| 4202 | |
| 4203 | builder->LockDisableResize = false; |
| 4204 | ImFontAtlasUpdateDrawListsSharedData(atlas); |
| 4205 | |
| 4206 | } |
| 4207 | |
| 4208 | void ImFontAtlasTextureGrow(ImFontAtlas* atlas, int old_tex_w, int old_tex_h) |
| 4209 | { |
| 4210 | |
| 4211 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 4212 | if (old_tex_w == -1) |
| 4213 | old_tex_w = atlas->TexData->Width; |
| 4214 | if (old_tex_h == -1) |
| 4215 | old_tex_h = atlas->TexData->Height; |
| 4216 | |
| 4217 | |
| 4218 | |
| 4219 | IM_ASSERT(ImIsPowerOfTwo(old_tex_w) && ImIsPowerOfTwo(old_tex_h)); |
| 4220 | IM_ASSERT(ImIsPowerOfTwo(atlas->TexMinWidth) && ImIsPowerOfTwo(atlas->TexMaxWidth) && ImIsPowerOfTwo(atlas->TexMinHeight) && ImIsPowerOfTwo(atlas->TexMaxHeight)); |
| 4221 | |
| 4222 | |
| 4223 | |
| 4224 | |
| 4225 | int new_tex_w = (old_tex_h <= old_tex_w) ? old_tex_w : old_tex_w * 2; |
| 4226 | int new_tex_h = (old_tex_h <= old_tex_w) ? old_tex_h * 2 : old_tex_h; |
| 4227 | |
| 4228 | |
| 4229 | const int pack_padding = atlas->TexGlyphPadding; |
| 4230 | new_tex_w = ImMax(new_tex_w, ImUpperPowerOfTwo(builder->MaxRectSize.x + pack_padding)); |
| 4231 | new_tex_h = ImMax(new_tex_h, ImUpperPowerOfTwo(builder->MaxRectSize.y + pack_padding)); |
| 4232 | new_tex_w = ImClamp(new_tex_w, atlas->TexMinWidth, atlas->TexMaxWidth); |
| 4233 | new_tex_h = ImClamp(new_tex_h, atlas->TexMinHeight, atlas->TexMaxHeight); |
| 4234 | if (new_tex_w == old_tex_w && new_tex_h == old_tex_h) |
| 4235 | return; |
| 4236 | |
| 4237 | ImFontAtlasTextureRepack(atlas, new_tex_w, new_tex_h); |
| 4238 | } |
| 4239 | |
| 4240 | void ImFontAtlasTextureMakeSpace(ImFontAtlas* atlas) |
| 4241 | { |
| 4242 | |
| 4243 | |
| 4244 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 4245 | ImFontAtlasBuildDiscardBakes(atlas, 2); |
| 4246 | |
| 4247 | |
| 4248 | if (builder->RectsDiscardedSurface < builder->RectsPackedSurface * 0.20f) |
| 4249 | ImFontAtlasTextureGrow(atlas); |
| 4250 | else |
| 4251 | ImFontAtlasTextureRepack(atlas, atlas->TexData->Width, atlas->TexData->Height); |
| 4252 | } |
| 4253 | |
| 4254 | ImVec2i ImFontAtlasTextureGetSizeEstimate(ImFontAtlas* atlas) |
| 4255 | { |
| 4256 | int min_w = ImUpperPowerOfTwo(atlas->TexMinWidth); |
| 4257 | int min_h = ImUpperPowerOfTwo(atlas->TexMinHeight); |
| 4258 | if (atlas->Builder == NULL || atlas->TexData == NULL || atlas->TexData->Status == ImTextureStatus_WantDestroy) |
| 4259 | return ImVec2i(min_w, min_h); |
| 4260 | |
| 4261 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 4262 | min_w = ImMax(ImUpperPowerOfTwo(builder->MaxRectSize.x), min_w); |
| 4263 | min_h = ImMax(ImUpperPowerOfTwo(builder->MaxRectSize.y), min_h); |
| 4264 | const int surface_approx = builder->RectsPackedSurface - builder->RectsDiscardedSurface; |
| 4265 | const int surface_sqrt = (int)sqrtf((float)surface_approx); |
| 4266 | |
| 4267 | int new_tex_w; |
| 4268 | int new_tex_h; |
| 4269 | if (min_w >= min_h) |
| 4270 | { |
| 4271 | new_tex_w = ImMax(min_w, ImUpperPowerOfTwo(surface_sqrt)); |
| 4272 | new_tex_h = ImMax(min_h, (int)((surface_approx + new_tex_w - 1) / new_tex_w)); |
| 4273 | if ((atlas->Flags & ImFontAtlasFlags_NoPowerOfTwoHeight) == 0) |
| 4274 | new_tex_h = ImUpperPowerOfTwo(new_tex_h); |
| 4275 | } |
| 4276 | else |
| 4277 | { |
| 4278 | new_tex_h = ImMax(min_h, ImUpperPowerOfTwo(surface_sqrt)); |
| 4279 | if ((atlas->Flags & ImFontAtlasFlags_NoPowerOfTwoHeight) == 0) |
| 4280 | new_tex_h = ImUpperPowerOfTwo(new_tex_h); |
| 4281 | new_tex_w = ImMax(min_w, (int)((surface_approx + new_tex_h - 1) / new_tex_h)); |
| 4282 | } |
| 4283 | |
| 4284 | IM_ASSERT(ImIsPowerOfTwo(new_tex_w) && ImIsPowerOfTwo(new_tex_h)); |
| 4285 | return ImVec2i(new_tex_w, new_tex_h); |
| 4286 | } |
| 4287 | |
| 4288 | |
| 4289 | void ImFontAtlasBuildClear(ImFontAtlas* atlas) |
| 4290 | { |
| 4291 | ImVec2i new_tex_size = ImFontAtlasTextureGetSizeEstimate(atlas); |
| 4292 | ImFontAtlasBuildDestroy(atlas); |
| 4293 | ImFontAtlasTextureAdd(atlas, new_tex_size.x, new_tex_size.y); |
| 4294 | ImFontAtlasBuildInit(atlas); |
| 4295 | for (ImFontConfig& src : atlas->Sources) |
| 4296 | ImFontAtlasFontSourceInit(atlas, &src); |
| 4297 | for (ImFont* font : atlas->Fonts) |
| 4298 | for (ImFontConfig* src : font->Sources) |
| 4299 | ImFontAtlasFontSourceAddToFont(atlas, font, src); |
| 4300 | } |
| 4301 | |
| 4302 | |
| 4303 | |
| 4304 | void ImFontAtlasTextureCompact(ImFontAtlas* atlas) |
| 4305 | { |
| 4306 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 4307 | ImFontAtlasBuildDiscardBakes(atlas, 1); |
| 4308 | |
| 4309 | ImTextureData* old_tex = atlas->TexData; |
| 4310 | ImVec2i old_tex_size = ImVec2i(old_tex->Width, old_tex->Height); |
| 4311 | ImVec2i new_tex_size = ImFontAtlasTextureGetSizeEstimate(atlas); |
| 4312 | if (builder->RectsDiscardedCount == 0 && new_tex_size.x == old_tex_size.x && new_tex_size.y == old_tex_size.y) |
| 4313 | return; |
| 4314 | |
| 4315 | ImFontAtlasTextureRepack(atlas, new_tex_size.x, new_tex_size.y); |
| 4316 | } |
| 4317 | |
| 4318 | |
| 4319 | void ImFontAtlasBuildInit(ImFontAtlas* atlas) |
| 4320 | { |
| 4321 | |
| 4322 | |
| 4323 | |
| 4324 | |
| 4325 | |
| 4326 | if (atlas->FontLoader == NULL) |
| 4327 | { |
| 4328 | #ifdef IMGUI_ENABLE_FREETYPE |
| 4329 | atlas->SetFontLoader(ImGuiFreeType::GetFontLoader()); |
| 4330 | #elif defined(IMGUI_ENABLE_STB_TRUETYPE) |
| 4331 | atlas->SetFontLoader(ImFontAtlasGetFontLoaderForStbTruetype()); |
| 4332 | #else |
| 4333 | IM_ASSERT(0); |
| 4334 | #endif |
| 4335 | } |
| 4336 | |
| 4337 | |
| 4338 | if (atlas->TexData == NULL || atlas->TexData->Pixels == NULL) |
| 4339 | ImFontAtlasTextureAdd(atlas, ImUpperPowerOfTwo(atlas->TexMinWidth), ImUpperPowerOfTwo(atlas->TexMinHeight)); |
| 4340 | |
| 4341 | atlas->Builder = IM_NEW(ImFontAtlasBuilder)(); |
| 4342 | if (atlas->FontLoader->LoaderInit) |
| 4343 | atlas->FontLoader->LoaderInit(atlas); |
| 4344 | |
| 4345 | ImFontAtlasBuildUpdateRendererHasTexturesFromContext(atlas); |
| 4346 | |
| 4347 | ImFontAtlasPackInit(atlas); |
| 4348 | |
| 4349 | |
| 4350 | ImFontAtlasBuildUpdateTexData(atlas); |
| 4351 | |
| 4352 | |
| 4353 | ImFontAtlasBuildUpdatePointers(atlas); |
| 4354 | |
| 4355 | |
| 4356 | ImFontAtlasUpdateDrawListsSharedData(atlas); |
| 4357 | |
| 4358 | |
| 4359 | |
| 4360 | |
| 4361 | |
| 4362 | ImTextInitClassifiers(); |
| 4363 | } |
| 4364 | |
| 4365 | |
| 4366 | void ImFontAtlasBuildDestroy(ImFontAtlas* atlas) |
| 4367 | { |
| 4368 | for (ImFont* font : atlas->Fonts) |
| 4369 | ImFontAtlasFontDestroyOutput(atlas, font); |
| 4370 | if (atlas->Builder && atlas->FontLoader && atlas->FontLoader->LoaderShutdown) |
| 4371 | { |
| 4372 | atlas->FontLoader->LoaderShutdown(atlas); |
| 4373 | IM_ASSERT(atlas->FontLoaderData == NULL); |
| 4374 | } |
| 4375 | IM_DELETE(atlas->Builder); |
| 4376 | atlas->Builder = NULL; |
| 4377 | } |
| 4378 | |
| 4379 | |
| 4380 | |
| 4381 | void ImFontAtlasPackInit(ImFontAtlas * atlas) |
| 4382 | { |
| 4383 | ImTextureData* tex = atlas->TexData; |
| 4384 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 4385 | |
| 4386 | |
| 4387 | const int pack_node_count = tex->Width / 2; |
| 4388 | builder->PackNodes.resize(pack_node_count); |
| 4389 | IM_STATIC_ASSERT(sizeof(stbrp_context) <= sizeof(stbrp_context_opaque)); |
| 4390 | stbrp_init_target((stbrp_context*)(void*)&builder->PackContext, tex->Width, tex->Height, builder->PackNodes.Data, builder->PackNodes.Size); |
| 4391 | builder->RectsPackedSurface = builder->RectsPackedCount = 0; |
| 4392 | builder->MaxRectSize = ImVec2i(0, 0); |
| 4393 | builder->MaxRectBounds = ImVec2i(0, 0); |
| 4394 | } |
| 4395 | |
| 4396 | |
| 4397 | static ImFontAtlasRectId ImFontAtlasPackAllocRectEntry(ImFontAtlas* atlas, int rect_idx) |
| 4398 | { |
| 4399 | ImFontAtlasBuilder* builder = (ImFontAtlasBuilder*)atlas->Builder; |
| 4400 | int index_idx; |
| 4401 | ImFontAtlasRectEntry* index_entry; |
| 4402 | if (builder->RectsIndexFreeListStart < 0) |
| 4403 | { |
| 4404 | builder->RectsIndex.resize(builder->RectsIndex.Size + 1); |
| 4405 | index_idx = builder->RectsIndex.Size - 1; |
| 4406 | index_entry = &builder->RectsIndex[index_idx]; |
| 4407 | memset(index_entry, 0, sizeof(*index_entry)); |
| 4408 | } |
| 4409 | else |
| 4410 | { |
| 4411 | index_idx = builder->RectsIndexFreeListStart; |
| 4412 | index_entry = &builder->RectsIndex[index_idx]; |
| 4413 | IM_ASSERT(index_entry->IsUsed == false && index_entry->Generation > 0); |
| 4414 | builder->RectsIndexFreeListStart = index_entry->TargetIndex; |
| 4415 | } |
| 4416 | index_entry->TargetIndex = rect_idx; |
| 4417 | index_entry->IsUsed = 1; |
| 4418 | return ImFontAtlasRectId_Make(index_idx, index_entry->Generation); |
| 4419 | } |
| 4420 | |
| 4421 | |
| 4422 | static ImFontAtlasRectId ImFontAtlasPackReuseRectEntry(ImFontAtlas* atlas, ImFontAtlasRectEntry* index_entry) |
| 4423 | { |
| 4424 | IM_ASSERT(index_entry->IsUsed); |
| 4425 | index_entry->TargetIndex = atlas->Builder->Rects.Size - 1; |
| 4426 | int index_idx = atlas->Builder->RectsIndex.index_from_ptr(index_entry); |
| 4427 | return ImFontAtlasRectId_Make(index_idx, index_entry->Generation); |
| 4428 | } |
| 4429 | |
| 4430 | |
| 4431 | void ImFontAtlasPackDiscardRect(ImFontAtlas* atlas, ImFontAtlasRectId id) |
| 4432 | { |
| 4433 | IM_ASSERT(id != ImFontAtlasRectId_Invalid); |
| 4434 | |
| 4435 | ImTextureRect* rect = ImFontAtlasPackGetRect(atlas, id); |
| 4436 | if (rect == NULL) |
| 4437 | return; |
| 4438 | |
| 4439 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 4440 | int index_idx = ImFontAtlasRectId_GetIndex(id); |
| 4441 | ImFontAtlasRectEntry* index_entry = &builder->RectsIndex[index_idx]; |
| 4442 | IM_ASSERT(index_entry->IsUsed && index_entry->TargetIndex >= 0); |
| 4443 | index_entry->IsUsed = false; |
| 4444 | index_entry->TargetIndex = builder->RectsIndexFreeListStart; |
| 4445 | index_entry->Generation++; |
| 4446 | if (index_entry->Generation == 0) |
| 4447 | index_entry->Generation++; |
| 4448 | |
| 4449 | const int pack_padding = atlas->TexGlyphPadding; |
| 4450 | builder->RectsIndexFreeListStart = index_idx; |
| 4451 | builder->RectsDiscardedCount++; |
| 4452 | builder->RectsDiscardedSurface += (rect->w + pack_padding) * (rect->h + pack_padding); |
| 4453 | rect->w = rect->h = 0; |
| 4454 | } |
| 4455 | |
| 4456 | |
| 4457 | |
| 4458 | ImFontAtlasRectId ImFontAtlasPackAddRect(ImFontAtlas* atlas, int w, int h, ImFontAtlasRectEntry* overwrite_entry) |
| 4459 | { |
| 4460 | IM_ASSERT(w > 0 && w <= 0xFFFF); |
| 4461 | IM_ASSERT(h > 0 && h <= 0xFFFF); |
| 4462 | |
| 4463 | ImFontAtlasBuilder* builder = (ImFontAtlasBuilder*)atlas->Builder; |
| 4464 | const int pack_padding = atlas->TexGlyphPadding; |
| 4465 | builder->MaxRectSize.x = ImMax(builder->MaxRectSize.x, w); |
| 4466 | builder->MaxRectSize.y = ImMax(builder->MaxRectSize.y, h); |
| 4467 | |
| 4468 | |
| 4469 | ImTextureRect r = { 0, 0, (unsigned short)w, (unsigned short)h }; |
| 4470 | for (int attempts_remaining = 3; attempts_remaining >= 0; attempts_remaining--) |
| 4471 | { |
| 4472 | |
| 4473 | stbrp_rect pack_r = {}; |
| 4474 | pack_r.w = w + pack_padding; |
| 4475 | pack_r.h = h + pack_padding; |
| 4476 | stbrp_pack_rects((stbrp_context*)(void*)&builder->PackContext, &pack_r, 1); |
| 4477 | r.x = (unsigned short)pack_r.x; |
| 4478 | r.y = (unsigned short)pack_r.y; |
| 4479 | if (pack_r.was_packed) |
| 4480 | break; |
| 4481 | |
| 4482 | |
| 4483 | if (attempts_remaining == 0 || builder->LockDisableResize) |
| 4484 | { |
| 4485 | IMGUI_DEBUG_LOG_FONT("[font] Failed packing %dx%d rectangle. Returning fallback.\n", w, h); |
| 4486 | return ImFontAtlasRectId_Invalid; |
| 4487 | } |
| 4488 | |
| 4489 | |
| 4490 | ImFontAtlasTextureMakeSpace(atlas); |
| 4491 | } |
| 4492 | |
| 4493 | builder->MaxRectBounds.x = ImMax(builder->MaxRectBounds.x, r.x + r.w + pack_padding); |
| 4494 | builder->MaxRectBounds.y = ImMax(builder->MaxRectBounds.y, r.y + r.h + pack_padding); |
| 4495 | builder->RectsPackedCount++; |
| 4496 | builder->RectsPackedSurface += (w + pack_padding) * (h + pack_padding); |
| 4497 | |
| 4498 | builder->Rects.push_back(r); |
| 4499 | if (overwrite_entry != NULL) |
| 4500 | return ImFontAtlasPackReuseRectEntry(atlas, overwrite_entry); |
| 4501 | else |
| 4502 | return ImFontAtlasPackAllocRectEntry(atlas, builder->Rects.Size - 1); |
| 4503 | } |
| 4504 | |
| 4505 | |
| 4506 | ImTextureRect* ImFontAtlasPackGetRect(ImFontAtlas* atlas, ImFontAtlasRectId id) |
| 4507 | { |
| 4508 | IM_ASSERT(id != ImFontAtlasRectId_Invalid); |
| 4509 | int index_idx = ImFontAtlasRectId_GetIndex(id); |
| 4510 | ImFontAtlasBuilder* builder = (ImFontAtlasBuilder*)atlas->Builder; |
| 4511 | ImFontAtlasRectEntry* index_entry = &builder->RectsIndex[index_idx]; |
| 4512 | IM_ASSERT(index_entry->Generation == ImFontAtlasRectId_GetGeneration(id)); |
| 4513 | IM_ASSERT(index_entry->IsUsed); |
| 4514 | return &builder->Rects[index_entry->TargetIndex]; |
| 4515 | } |
| 4516 | |
| 4517 | |
| 4518 | |
| 4519 | ImTextureRect* ImFontAtlasPackGetRectSafe(ImFontAtlas* atlas, ImFontAtlasRectId id) |
| 4520 | { |
| 4521 | if (id == ImFontAtlasRectId_Invalid) |
| 4522 | return NULL; |
| 4523 | int index_idx = ImFontAtlasRectId_GetIndex(id); |
| 4524 | if (atlas->Builder == NULL) |
| 4525 | ImFontAtlasBuildInit(atlas); |
| 4526 | ImFontAtlasBuilder* builder = (ImFontAtlasBuilder*)atlas->Builder; |
| 4527 | IM_MSVC_WARNING_SUPPRESS(28182); |
| 4528 | if (index_idx >= builder->RectsIndex.Size) |
| 4529 | return NULL; |
| 4530 | ImFontAtlasRectEntry* index_entry = &builder->RectsIndex[index_idx]; |
| 4531 | if (index_entry->Generation != ImFontAtlasRectId_GetGeneration(id) || !index_entry->IsUsed) |
| 4532 | return NULL; |
| 4533 | return &builder->Rects[index_entry->TargetIndex]; |
| 4534 | } |
| 4535 | |
| 4536 | |
| 4537 | |
| 4538 | static bool ImFontAtlasBuildAcceptCodepointForSource(ImFontConfig* src, ImWchar codepoint) |
| 4539 | { |
| 4540 | if (const ImWchar* exclude_list = src->GlyphExcludeRanges) |
| 4541 | for (; exclude_list[0] != 0; exclude_list += 2) |
| 4542 | if (codepoint >= exclude_list[0] && codepoint <= exclude_list[1]) |
| 4543 | return false; |
| 4544 | return true; |
| 4545 | } |
| 4546 | |
| 4547 | static void ImFontBaked_BuildGrowIndex(ImFontBaked* baked, int new_size) |
| 4548 | { |
| 4549 | IM_ASSERT(baked->IndexAdvanceX.Size == baked->IndexLookup.Size); |
| 4550 | if (new_size <= baked->IndexLookup.Size) |
| 4551 | return; |
| 4552 | baked->IndexAdvanceX.resize(new_size, -1.0f); |
| 4553 | baked->IndexLookup.resize(new_size, IM_FONTGLYPH_INDEX_UNUSED); |
| 4554 | } |
| 4555 | |
| 4556 | static void ImFontAtlas_FontHookRemapCodepoint(ImFontAtlas* atlas, ImFont* font, ImWchar* c) |
| 4557 | { |
| 4558 | IM_UNUSED(atlas); |
| 4559 | if (font->RemapPairs.Data.Size != 0) |
| 4560 | *c = (ImWchar)font->RemapPairs.GetInt((ImGuiID)*c, (int)*c); |
| 4561 | } |
| 4562 | |
| 4563 | static ImFontGlyph* ImFontBaked_BuildLoadGlyph(ImFontBaked* baked, ImWchar codepoint, float* only_load_advance_x) |
| 4564 | { |
| 4565 | ImFont* font = baked->OwnerFont; |
| 4566 | ImFontAtlas* atlas = font->OwnerAtlas; |
| 4567 | if (atlas->Locked || (font->Flags & ImFontFlags_NoLoadGlyphs)) |
| 4568 | { |
| 4569 | |
| 4570 | if (baked->FallbackGlyphIndex == -1 && baked->LoadNoFallback == 0) |
| 4571 | ImFontAtlasBuildSetupFontBakedFallback(baked); |
| 4572 | return NULL; |
| 4573 | } |
| 4574 | |
| 4575 | |
| 4576 | ImWchar src_codepoint = codepoint; |
| 4577 | ImFontAtlas_FontHookRemapCodepoint(atlas, font, &codepoint); |
| 4578 | |
| 4579 | |
| 4580 | |
| 4581 | |
| 4582 | |
| 4583 | |
| 4584 | if (codepoint == font->EllipsisChar && font->EllipsisAutoBake) |
| 4585 | if (ImFontGlyph* glyph = ImFontAtlasBuildSetupFontBakedEllipsis(atlas, baked)) |
| 4586 | return glyph; |
| 4587 | |
| 4588 | |
| 4589 | char* loader_user_data_p = (char*)baked->FontLoaderDatas; |
| 4590 | int src_n = 0; |
| 4591 | for (ImFontConfig* src : font->Sources) |
| 4592 | { |
| 4593 | const ImFontLoader* loader = src->FontLoader ? src->FontLoader : atlas->FontLoader; |
| 4594 | if (!src->GlyphExcludeRanges || ImFontAtlasBuildAcceptCodepointForSource(src, codepoint)) |
| 4595 | { |
| 4596 | if (only_load_advance_x == NULL) |
| 4597 | { |
| 4598 | ImFontGlyph glyph_buf; |
| 4599 | if (loader->FontBakedLoadGlyph(atlas, src, baked, loader_user_data_p, codepoint, &glyph_buf, NULL)) |
| 4600 | { |
| 4601 | |
| 4602 | glyph_buf.Codepoint = src_codepoint; |
| 4603 | glyph_buf.SourceIdx = src_n; |
| 4604 | return ImFontAtlasBakedAddFontGlyph(atlas, baked, src, &glyph_buf); |
| 4605 | } |
| 4606 | } |
| 4607 | else |
| 4608 | { |
| 4609 | |
| 4610 | if (loader->FontBakedLoadGlyph(atlas, src, baked, loader_user_data_p, codepoint, NULL, only_load_advance_x)) |
| 4611 | { |
| 4612 | ImFontAtlasBakedAddFontGlyphAdvancedX(atlas, baked, src, codepoint, *only_load_advance_x); |
| 4613 | return NULL; |
| 4614 | } |
| 4615 | } |
| 4616 | } |
| 4617 | loader_user_data_p += loader->FontBakedSrcLoaderDataSize; |
| 4618 | src_n++; |
| 4619 | } |
| 4620 | |
| 4621 | |
| 4622 | if (baked->LoadNoFallback) |
| 4623 | return NULL; |
| 4624 | if (baked->FallbackGlyphIndex == -1) |
| 4625 | ImFontAtlasBuildSetupFontBakedFallback(baked); |
| 4626 | |
| 4627 | |
| 4628 | ImFontBaked_BuildGrowIndex(baked, codepoint + 1); |
| 4629 | baked->IndexAdvanceX[codepoint] = baked->FallbackAdvanceX; |
| 4630 | baked->IndexLookup[codepoint] = IM_FONTGLYPH_INDEX_NOT_FOUND; |
| 4631 | return NULL; |
| 4632 | } |
| 4633 | |
| 4634 | static float ImFontBaked_BuildLoadGlyphAdvanceX(ImFontBaked* baked, ImWchar codepoint) |
| 4635 | { |
| 4636 | if (baked->Size >= IMGUI_FONT_SIZE_THRESHOLD_FOR_LOADADVANCEXONLYMODE || baked->LoadNoRenderOnLayout) |
| 4637 | { |
| 4638 | |
| 4639 | float only_advance_x = 0.0f; |
| 4640 | ImFontGlyph* glyph = ImFontBaked_BuildLoadGlyph(baked, (ImWchar)codepoint, &only_advance_x); |
| 4641 | return glyph ? glyph->AdvanceX : only_advance_x; |
| 4642 | } |
| 4643 | else |
| 4644 | { |
| 4645 | ImFontGlyph* glyph = ImFontBaked_BuildLoadGlyph(baked, (ImWchar)codepoint, NULL); |
| 4646 | return glyph ? glyph->AdvanceX : baked->FallbackAdvanceX; |
| 4647 | } |
| 4648 | } |
| 4649 | |
| 4650 | |
| 4651 | IM_MSVC_RUNTIME_CHECKS_OFF |
| 4652 | static float BuildLoadGlyphGetAdvanceOrFallback(ImFontBaked* baked, unsigned int codepoint) |
| 4653 | { |
| 4654 | return ImFontBaked_BuildLoadGlyphAdvanceX(baked, (ImWchar)codepoint); |
| 4655 | } |
| 4656 | IM_MSVC_RUNTIME_CHECKS_RESTORE |
| 4657 | |
| 4658 | #ifndef IMGUI_DISABLE_DEBUG_TOOLS |
| 4659 | void ImFontAtlasDebugLogTextureRequests(ImFontAtlas* atlas) |
| 4660 | { |
| 4661 | |
| 4662 | ImGuiContext& g = *GImGui; |
| 4663 | IM_UNUSED(g); |
| 4664 | for (ImTextureData* tex : atlas->TexList) |
| 4665 | { |
| 4666 | if ((g.IO.BackendFlags & ImGuiBackendFlags_RendererHasTextures) == 0) |
| 4667 | IM_ASSERT(tex->Updates.Size == 0); |
| 4668 | if (tex->Status == ImTextureStatus_WantCreate) |
| 4669 | IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: create %dx%d\n", tex->UniqueID, tex->Width, tex->Height); |
| 4670 | else if (tex->Status == ImTextureStatus_WantDestroy) |
| 4671 | IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: destroy %dx%d, texid=0x%" IM_PRIX64 ", backend_data=%p\n", tex->UniqueID, tex->Width, tex->Height, ImGui::DebugTextureIDToU64(tex->TexID), tex->BackendUserData); |
| 4672 | else if (tex->Status == ImTextureStatus_WantUpdates) |
| 4673 | { |
| 4674 | IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: update %d regions, texid=0x%" IM_PRIX64 ", backend_data=0x%" IM_PRIX64 "\n", tex->UniqueID, tex->Updates.Size, ImGui::DebugTextureIDToU64(tex->TexID), (ImU64)(intptr_t)tex->BackendUserData); |
| 4675 | for (const ImTextureRect& r : tex->Updates) |
| 4676 | { |
| 4677 | IM_UNUSED(r); |
| 4678 | IM_ASSERT(r.x >= 0 && r.y >= 0); |
| 4679 | IM_ASSERT(r.x + r.w <= tex->Width && r.y + r.h <= tex->Height); |
| 4680 | |
| 4681 | } |
| 4682 | } |
| 4683 | } |
| 4684 | } |
| 4685 | #endif |
| 4686 | |
| 4687 | |
| 4688 | |
| 4689 | |
| 4690 | |
| 4691 | |
| 4692 | |
| 4693 | #ifdef IMGUI_ENABLE_STB_TRUETYPE |
| 4694 | |
| 4695 | |
| 4696 | struct ImGui_ImplStbTrueType_FontSrcData |
| 4697 | { |
| 4698 | stbtt_fontinfo FontInfo; |
| 4699 | float ScaleFactor; |
| 4700 | }; |
| 4701 | |
| 4702 | static bool ImGui_ImplStbTrueType_FontSrcInit(ImFontAtlas* atlas, ImFontConfig* src) |
| 4703 | { |
| 4704 | IM_UNUSED(atlas); |
| 4705 | |
| 4706 | ImGui_ImplStbTrueType_FontSrcData* bd_font_data = IM_NEW(ImGui_ImplStbTrueType_FontSrcData); |
| 4707 | IM_ASSERT(src->FontLoaderData == NULL); |
| 4708 | |
| 4709 | |
| 4710 | const int font_offset = stbtt_GetFontOffsetForIndex((const unsigned char*)src->FontData, src->FontNo); |
| 4711 | if (font_offset < 0) |
| 4712 | { |
| 4713 | IM_DELETE(bd_font_data); |
| 4714 | IM_ASSERT_USER_ERROR(0, "stbtt_GetFontOffsetForIndex(): FontData is incorrect, or FontNo cannot be found."); |
| 4715 | return false; |
| 4716 | } |
| 4717 | if (!stbtt_InitFont(&bd_font_data->FontInfo, (const unsigned char*)src->FontData, font_offset)) |
| 4718 | { |
| 4719 | IM_DELETE(bd_font_data); |
| 4720 | IM_ASSERT_USER_ERROR(0, "stbtt_InitFont(): failed to parse FontData. It is correct and complete? Check FontDataSize."); |
| 4721 | return false; |
| 4722 | } |
| 4723 | src->FontLoaderData = bd_font_data; |
| 4724 | |
| 4725 | const float ref_size = src->DstFont->Sources[0]->SizePixels; |
| 4726 | if (src->MergeMode && src->SizePixels == 0.0f) |
| 4727 | src->SizePixels = ref_size; |
| 4728 | |
| 4729 | bd_font_data->ScaleFactor = stbtt_ScaleForPixelHeight(&bd_font_data->FontInfo, 1.0f); |
| 4730 | if (src->MergeMode && src->SizePixels != 0.0f && ref_size != 0.0f) |
| 4731 | bd_font_data->ScaleFactor *= src->SizePixels / ref_size; |
| 4732 | bd_font_data->ScaleFactor *= src->ExtraSizeScale; |
| 4733 | |
| 4734 | return true; |
| 4735 | } |
| 4736 | |
| 4737 | static void ImGui_ImplStbTrueType_FontSrcDestroy(ImFontAtlas* atlas, ImFontConfig* src) |
| 4738 | { |
| 4739 | IM_UNUSED(atlas); |
| 4740 | ImGui_ImplStbTrueType_FontSrcData* bd_font_data = (ImGui_ImplStbTrueType_FontSrcData*)src->FontLoaderData; |
| 4741 | IM_DELETE(bd_font_data); |
| 4742 | src->FontLoaderData = NULL; |
| 4743 | } |
| 4744 | |
| 4745 | static bool ImGui_ImplStbTrueType_FontSrcContainsGlyph(ImFontAtlas* atlas, ImFontConfig* src, ImWchar codepoint) |
| 4746 | { |
| 4747 | IM_UNUSED(atlas); |
| 4748 | |
| 4749 | ImGui_ImplStbTrueType_FontSrcData* bd_font_data = (ImGui_ImplStbTrueType_FontSrcData*)src->FontLoaderData; |
| 4750 | IM_ASSERT(bd_font_data != NULL); |
| 4751 | |
| 4752 | int glyph_index = stbtt_FindGlyphIndex(&bd_font_data->FontInfo, (int)codepoint); |
| 4753 | return glyph_index != 0; |
| 4754 | } |
| 4755 | |
| 4756 | static bool ImGui_ImplStbTrueType_FontBakedInit(ImFontAtlas* atlas, ImFontConfig* src, ImFontBaked* baked, void*) |
| 4757 | { |
| 4758 | IM_UNUSED(atlas); |
| 4759 | |
| 4760 | ImGui_ImplStbTrueType_FontSrcData* bd_font_data = (ImGui_ImplStbTrueType_FontSrcData*)src->FontLoaderData; |
| 4761 | if (src->MergeMode == false) |
| 4762 | { |
| 4763 | |
| 4764 | |
| 4765 | const float scale_for_layout = bd_font_data->ScaleFactor * baked->Size / src->ExtraSizeScale; |
| 4766 | int unscaled_ascent, unscaled_descent, unscaled_line_gap; |
| 4767 | stbtt_GetFontVMetrics(&bd_font_data->FontInfo, &unscaled_ascent, &unscaled_descent, &unscaled_line_gap); |
| 4768 | baked->Ascent = ImCeil(unscaled_ascent * scale_for_layout); |
| 4769 | baked->Descent = ImFloor(unscaled_descent * scale_for_layout); |
| 4770 | } |
| 4771 | return true; |
| 4772 | } |
| 4773 | |
| 4774 | static bool ImGui_ImplStbTrueType_FontBakedLoadGlyph(ImFontAtlas* atlas, ImFontConfig* src, ImFontBaked* baked, void*, ImWchar codepoint, ImFontGlyph* out_glyph, float* out_advance_x) |
| 4775 | { |
| 4776 | |
| 4777 | ImGui_ImplStbTrueType_FontSrcData* bd_font_data = (ImGui_ImplStbTrueType_FontSrcData*)src->FontLoaderData; |
| 4778 | IM_ASSERT(bd_font_data); |
| 4779 | int glyph_index = stbtt_FindGlyphIndex(&bd_font_data->FontInfo, (int)codepoint); |
| 4780 | if (glyph_index == 0) |
| 4781 | return false; |
| 4782 | |
| 4783 | |
| 4784 | int oversample_h, oversample_v; |
| 4785 | ImFontAtlasBuildGetOversampleFactors(src, baked, &oversample_h, &oversample_v); |
| 4786 | const float scale_for_layout = bd_font_data->ScaleFactor * baked->Size; |
| 4787 | const float rasterizer_density = src->RasterizerDensity * baked->RasterizerDensity; |
| 4788 | const float scale_for_raster_x = bd_font_data->ScaleFactor * baked->Size * rasterizer_density * oversample_h; |
| 4789 | const float scale_for_raster_y = bd_font_data->ScaleFactor * baked->Size * rasterizer_density * oversample_v; |
| 4790 | |
| 4791 | |
| 4792 | int x0, y0, x1, y1; |
| 4793 | int advance, lsb; |
| 4794 | stbtt_GetGlyphBitmapBoxSubpixel(&bd_font_data->FontInfo, glyph_index, scale_for_raster_x, scale_for_raster_y, 0, 0, &x0, &y0, &x1, &y1); |
| 4795 | stbtt_GetGlyphHMetrics(&bd_font_data->FontInfo, glyph_index, &advance, &lsb); |
| 4796 | |
| 4797 | |
| 4798 | if (out_advance_x != NULL) |
| 4799 | { |
| 4800 | IM_ASSERT(out_glyph == NULL); |
| 4801 | *out_advance_x = advance * scale_for_layout; |
| 4802 | return true; |
| 4803 | } |
| 4804 | |
| 4805 | |
| 4806 | out_glyph->Codepoint = codepoint; |
| 4807 | out_glyph->AdvanceX = advance * scale_for_layout; |
| 4808 | |
| 4809 | |
| 4810 | |
| 4811 | const bool is_visible = (x0 != x1 && y0 != y1); |
| 4812 | if (is_visible) |
| 4813 | { |
| 4814 | const int w = (x1 - x0 + oversample_h - 1); |
| 4815 | const int h = (y1 - y0 + oversample_v - 1); |
| 4816 | ImFontAtlasRectId pack_id = ImFontAtlasPackAddRect(atlas, w, h); |
| 4817 | if (pack_id == ImFontAtlasRectId_Invalid) |
| 4818 | { |
| 4819 | |
| 4820 | IM_ASSERT(pack_id != ImFontAtlasRectId_Invalid && "Out of texture memory."); |
| 4821 | return false; |
| 4822 | } |
| 4823 | ImTextureRect* r = ImFontAtlasPackGetRect(atlas, pack_id); |
| 4824 | |
| 4825 | |
| 4826 | stbtt_GetGlyphBitmapBox(&bd_font_data->FontInfo, glyph_index, scale_for_raster_x, scale_for_raster_y, &x0, &y0, &x1, &y1); |
| 4827 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 4828 | builder->TempBuffer.resize(w * h * 1); |
| 4829 | unsigned char* bitmap_pixels = builder->TempBuffer.Data; |
| 4830 | memset(bitmap_pixels, 0, w * h * 1); |
| 4831 | |
| 4832 | |
| 4833 | |
| 4834 | float sub_x, sub_y; |
| 4835 | stbtt_MakeGlyphBitmapSubpixelPrefilter(&bd_font_data->FontInfo, bitmap_pixels, w, h, w, |
| 4836 | scale_for_raster_x, scale_for_raster_y, 0, 0, oversample_h, oversample_v, &sub_x, &sub_y, glyph_index); |
| 4837 | |
| 4838 | const float ref_size = baked->OwnerFont->Sources[0]->SizePixels; |
| 4839 | const float offsets_scale = (ref_size != 0.0f) ? (baked->Size / ref_size) : 1.0f; |
| 4840 | float font_off_x = ImFloor(src->GlyphOffset.x * offsets_scale + 0.5f); |
| 4841 | float font_off_y = ImFloor(src->GlyphOffset.y * offsets_scale + 0.5f); |
| 4842 | font_off_x += sub_x; |
| 4843 | font_off_y += sub_y + IM_ROUND(baked->Ascent); |
| 4844 | float recip_h = 1.0f / (oversample_h * rasterizer_density); |
| 4845 | float recip_v = 1.0f / (oversample_v * rasterizer_density); |
| 4846 | |
| 4847 | |
| 4848 | |
| 4849 | |
| 4850 | out_glyph->X0 = x0 * recip_h + font_off_x; |
| 4851 | out_glyph->Y0 = y0 * recip_v + font_off_y; |
| 4852 | out_glyph->X1 = (x0 + (int)r->w) * recip_h + font_off_x; |
| 4853 | out_glyph->Y1 = (y0 + (int)r->h) * recip_v + font_off_y; |
| 4854 | out_glyph->Visible = true; |
| 4855 | out_glyph->PackId = pack_id; |
| 4856 | ImFontAtlasBakedSetFontGlyphBitmap(atlas, baked, src, out_glyph, r, bitmap_pixels, ImTextureFormat_Alpha8, w); |
| 4857 | } |
| 4858 | |
| 4859 | return true; |
| 4860 | } |
| 4861 | |
| 4862 | const ImFontLoader* ImFontAtlasGetFontLoaderForStbTruetype() |
| 4863 | { |
| 4864 | static ImFontLoader loader; |
| 4865 | loader.Name = "stb_truetype"; |
| 4866 | loader.FontSrcInit = ImGui_ImplStbTrueType_FontSrcInit; |
| 4867 | loader.FontSrcDestroy = ImGui_ImplStbTrueType_FontSrcDestroy; |
| 4868 | loader.FontSrcContainsGlyph = ImGui_ImplStbTrueType_FontSrcContainsGlyph; |
| 4869 | loader.FontBakedInit = ImGui_ImplStbTrueType_FontBakedInit; |
| 4870 | loader.FontBakedDestroy = NULL; |
| 4871 | loader.FontBakedLoadGlyph = ImGui_ImplStbTrueType_FontBakedLoadGlyph; |
| 4872 | return &loader; |
| 4873 | } |
| 4874 | |
| 4875 | #endif |
| 4876 | |
| 4877 | |
| 4878 | |
| 4879 | |
| 4880 | |
| 4881 | |
| 4882 | |
| 4883 | |
| 4884 | |
| 4885 | |
| 4886 | |
| 4887 | |
| 4888 | |
| 4889 | |
| 4890 | |
| 4891 | |
| 4892 | |
| 4893 | const ImWchar* ImFontAtlas::GetGlyphRangesDefault() |
| 4894 | { |
| 4895 | static const ImWchar ranges[] = |
| 4896 | { |
| 4897 | 0x0020, 0x00FF, |
| 4898 | 0, |
| 4899 | }; |
| 4900 | return &ranges[0]; |
| 4901 | } |
| 4902 | |
| 4903 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS |
| 4904 | const ImWchar* ImFontAtlas::GetGlyphRangesGreek() |
| 4905 | { |
| 4906 | static const ImWchar ranges[] = |
| 4907 | { |
| 4908 | 0x0020, 0x00FF, |
| 4909 | 0x0370, 0x03FF, |
| 4910 | 0, |
| 4911 | }; |
| 4912 | return &ranges[0]; |
| 4913 | } |
| 4914 | |
| 4915 | const ImWchar* ImFontAtlas::GetGlyphRangesKorean() |
| 4916 | { |
| 4917 | static const ImWchar ranges[] = |
| 4918 | { |
| 4919 | 0x0020, 0x00FF, |
| 4920 | 0x3131, 0x3163, |
| 4921 | 0xAC00, 0xD7A3, |
| 4922 | 0xFFFD, 0xFFFD, |
| 4923 | 0, |
| 4924 | }; |
| 4925 | return &ranges[0]; |
| 4926 | } |
| 4927 | |
| 4928 | const ImWchar* ImFontAtlas::GetGlyphRangesChineseFull() |
| 4929 | { |
| 4930 | static const ImWchar ranges[] = |
| 4931 | { |
| 4932 | 0x0020, 0x00FF, |
| 4933 | 0x2000, 0x206F, |
| 4934 | 0x3000, 0x30FF, |
| 4935 | 0x31F0, 0x31FF, |
| 4936 | 0xFF00, 0xFFEF, |
| 4937 | 0xFFFD, 0xFFFD, |
| 4938 | 0x4e00, 0x9FAF, |
| 4939 | 0, |
| 4940 | }; |
| 4941 | return &ranges[0]; |
| 4942 | } |
| 4943 | |
| 4944 | static void UnpackAccumulativeOffsetsIntoRanges(int base_codepoint, const short* accumulative_offsets, int accumulative_offsets_count, ImWchar* out_ranges) |
| 4945 | { |
| 4946 | for (int n = 0; n < accumulative_offsets_count; n++, out_ranges += 2) |
| 4947 | { |
| 4948 | out_ranges[0] = out_ranges[1] = (ImWchar)(base_codepoint + accumulative_offsets[n]); |
| 4949 | base_codepoint += accumulative_offsets[n]; |
| 4950 | } |
| 4951 | out_ranges[0] = 0; |
| 4952 | } |
| 4953 | |
| 4954 | const ImWchar* ImFontAtlas::GetGlyphRangesChineseSimplifiedCommon() |
| 4955 | { |
| 4956 | |
| 4957 | |
| 4958 | |
| 4959 | |
| 4960 | |
| 4961 | static const short accumulative_offsets_from_0x4E00[] = |
| 4962 | { |
| 4963 | 0,1,2,4,1,1,1,1,2,1,3,2,1,2,2,1,1,1,1,1,5,2,1,2,3,3,3,2,2,4,1,1,1,2,1,5,2,3,1,2,1,2,1,1,2,1,1,2,2,1,4,1,1,1,1,5,10,1,2,19,2,1,2,1,2,1,2,1,2, |
| 4964 | 1,5,1,6,3,2,1,2,2,1,1,1,4,8,5,1,1,4,1,1,3,1,2,1,5,1,2,1,1,1,10,1,1,5,2,4,6,1,4,2,2,2,12,2,1,1,6,1,1,1,4,1,1,4,6,5,1,4,2,2,4,10,7,1,1,4,2,4, |
| 4965 | 2,1,4,3,6,10,12,5,7,2,14,2,9,1,1,6,7,10,4,7,13,1,5,4,8,4,1,1,2,28,5,6,1,1,5,2,5,20,2,2,9,8,11,2,9,17,1,8,6,8,27,4,6,9,20,11,27,6,68,2,2,1,1, |
| 4966 | 1,2,1,2,2,7,6,11,3,3,1,1,3,1,2,1,1,1,1,1,3,1,1,8,3,4,1,5,7,2,1,4,4,8,4,2,1,2,1,1,4,5,6,3,6,2,12,3,1,3,9,2,4,3,4,1,5,3,3,1,3,7,1,5,1,1,1,1,2, |
| 4967 | 3,4,5,2,3,2,6,1,1,2,1,7,1,7,3,4,5,15,2,2,1,5,3,22,19,2,1,1,1,1,2,5,1,1,1,6,1,1,12,8,2,9,18,22,4,1,1,5,1,16,1,2,7,10,15,1,1,6,2,4,1,2,4,1,6, |
| 4968 | 1,1,3,2,4,1,6,4,5,1,2,1,1,2,1,10,3,1,3,2,1,9,3,2,5,7,2,19,4,3,6,1,1,1,1,1,4,3,2,1,1,1,2,5,3,1,1,1,2,2,1,1,2,1,1,2,1,3,1,1,1,3,7,1,4,1,1,2,1, |
| 4969 | 1,2,1,2,4,4,3,8,1,1,1,2,1,3,5,1,3,1,3,4,6,2,2,14,4,6,6,11,9,1,15,3,1,28,5,2,5,5,3,1,3,4,5,4,6,14,3,2,3,5,21,2,7,20,10,1,2,19,2,4,28,28,2,3, |
| 4970 | 2,1,14,4,1,26,28,42,12,40,3,52,79,5,14,17,3,2,2,11,3,4,6,3,1,8,2,23,4,5,8,10,4,2,7,3,5,1,1,6,3,1,2,2,2,5,28,1,1,7,7,20,5,3,29,3,17,26,1,8,4, |
| 4971 | 27,3,6,11,23,5,3,4,6,13,24,16,6,5,10,25,35,7,3,2,3,3,14,3,6,2,6,1,4,2,3,8,2,1,1,3,3,3,4,1,1,13,2,2,4,5,2,1,14,14,1,2,2,1,4,5,2,3,1,14,3,12, |
| 4972 | 3,17,2,16,5,1,2,1,8,9,3,19,4,2,2,4,17,25,21,20,28,75,1,10,29,103,4,1,2,1,1,4,2,4,1,2,3,24,2,2,2,1,1,2,1,3,8,1,1,1,2,1,1,3,1,1,1,6,1,5,3,1,1, |
| 4973 | 1,3,4,1,1,5,2,1,5,6,13,9,16,1,1,1,1,3,2,3,2,4,5,2,5,2,2,3,7,13,7,2,2,1,1,1,1,2,3,3,2,1,6,4,9,2,1,14,2,14,2,1,18,3,4,14,4,11,41,15,23,15,23, |
| 4974 | 176,1,3,4,1,1,1,1,5,3,1,2,3,7,3,1,1,2,1,2,4,4,6,2,4,1,9,7,1,10,5,8,16,29,1,1,2,2,3,1,3,5,2,4,5,4,1,1,2,2,3,3,7,1,6,10,1,17,1,44,4,6,2,1,1,6, |
| 4975 | 5,4,2,10,1,6,9,2,8,1,24,1,2,13,7,8,8,2,1,4,1,3,1,3,3,5,2,5,10,9,4,9,12,2,1,6,1,10,1,1,7,7,4,10,8,3,1,13,4,3,1,6,1,3,5,2,1,2,17,16,5,2,16,6, |
| 4976 | 1,4,2,1,3,3,6,8,5,11,11,1,3,3,2,4,6,10,9,5,7,4,7,4,7,1,1,4,2,1,3,6,8,7,1,6,11,5,5,3,24,9,4,2,7,13,5,1,8,82,16,61,1,1,1,4,2,2,16,10,3,8,1,1, |
| 4977 | 6,4,2,1,3,1,1,1,4,3,8,4,2,2,1,1,1,1,1,6,3,5,1,1,4,6,9,2,1,1,1,2,1,7,2,1,6,1,5,4,4,3,1,8,1,3,3,1,3,2,2,2,2,3,1,6,1,2,1,2,1,3,7,1,8,2,1,2,1,5, |
| 4978 | 2,5,3,5,10,1,2,1,1,3,2,5,11,3,9,3,5,1,1,5,9,1,2,1,5,7,9,9,8,1,3,3,3,6,8,2,3,2,1,1,32,6,1,2,15,9,3,7,13,1,3,10,13,2,14,1,13,10,2,1,3,10,4,15, |
| 4979 | 2,15,15,10,1,3,9,6,9,32,25,26,47,7,3,2,3,1,6,3,4,3,2,8,5,4,1,9,4,2,2,19,10,6,2,3,8,1,2,2,4,2,1,9,4,4,4,6,4,8,9,2,3,1,1,1,1,3,5,5,1,3,8,4,6, |
| 4980 | 2,1,4,12,1,5,3,7,13,2,5,8,1,6,1,2,5,14,6,1,5,2,4,8,15,5,1,23,6,62,2,10,1,1,8,1,2,2,10,4,2,2,9,2,1,1,3,2,3,1,5,3,3,2,1,3,8,1,1,1,11,3,1,1,4, |
| 4981 | 3,7,1,14,1,2,3,12,5,2,5,1,6,7,5,7,14,11,1,3,1,8,9,12,2,1,11,8,4,4,2,6,10,9,13,1,1,3,1,5,1,3,2,4,4,1,18,2,3,14,11,4,29,4,2,7,1,3,13,9,2,2,5, |
| 4982 | 3,5,20,7,16,8,5,72,34,6,4,22,12,12,28,45,36,9,7,39,9,191,1,1,1,4,11,8,4,9,2,3,22,1,1,1,1,4,17,1,7,7,1,11,31,10,2,4,8,2,3,2,1,4,2,16,4,32,2, |
| 4983 | 3,19,13,4,9,1,5,2,14,8,1,1,3,6,19,6,5,1,16,6,2,10,8,5,1,2,3,1,5,5,1,11,6,6,1,3,3,2,6,3,8,1,1,4,10,7,5,7,7,5,8,9,2,1,3,4,1,1,3,1,3,3,2,6,16, |
| 4984 | 1,4,6,3,1,10,6,1,3,15,2,9,2,10,25,13,9,16,6,2,2,10,11,4,3,9,1,2,6,6,5,4,30,40,1,10,7,12,14,33,6,3,6,7,3,1,3,1,11,14,4,9,5,12,11,49,18,51,31, |
| 4985 | 140,31,2,2,1,5,1,8,1,10,1,4,4,3,24,1,10,1,3,6,6,16,3,4,5,2,1,4,2,57,10,6,22,2,22,3,7,22,6,10,11,36,18,16,33,36,2,5,5,1,1,1,4,10,1,4,13,2,7, |
| 4986 | 5,2,9,3,4,1,7,43,3,7,3,9,14,7,9,1,11,1,1,3,7,4,18,13,1,14,1,3,6,10,73,2,2,30,6,1,11,18,19,13,22,3,46,42,37,89,7,3,16,34,2,2,3,9,1,7,1,1,1,2, |
| 4987 | 2,4,10,7,3,10,3,9,5,28,9,2,6,13,7,3,1,3,10,2,7,2,11,3,6,21,54,85,2,1,4,2,2,1,39,3,21,2,2,5,1,1,1,4,1,1,3,4,15,1,3,2,4,4,2,3,8,2,20,1,8,7,13, |
| 4988 | 4,1,26,6,2,9,34,4,21,52,10,4,4,1,5,12,2,11,1,7,2,30,12,44,2,30,1,1,3,6,16,9,17,39,82,2,2,24,7,1,7,3,16,9,14,44,2,1,2,1,2,3,5,2,4,1,6,7,5,3, |
| 4989 | 2,6,1,11,5,11,2,1,18,19,8,1,3,24,29,2,1,3,5,2,2,1,13,6,5,1,46,11,3,5,1,1,5,8,2,10,6,12,6,3,7,11,2,4,16,13,2,5,1,1,2,2,5,2,28,5,2,23,10,8,4, |
| 4990 | 4,22,39,95,38,8,14,9,5,1,13,5,4,3,13,12,11,1,9,1,27,37,2,5,4,4,63,211,95,2,2,2,1,3,5,2,1,1,2,2,1,1,1,3,2,4,1,2,1,1,5,2,2,1,1,2,3,1,3,1,1,1, |
| 4991 | 3,1,4,2,1,3,6,1,1,3,7,15,5,3,2,5,3,9,11,4,2,22,1,6,3,8,7,1,4,28,4,16,3,3,25,4,4,27,27,1,4,1,2,2,7,1,3,5,2,28,8,2,14,1,8,6,16,25,3,3,3,14,3, |
| 4992 | 3,1,1,2,1,4,6,3,8,4,1,1,1,2,3,6,10,6,2,3,18,3,2,5,5,4,3,1,5,2,5,4,23,7,6,12,6,4,17,11,9,5,1,1,10,5,12,1,1,11,26,33,7,3,6,1,17,7,1,5,12,1,11, |
| 4993 | 2,4,1,8,14,17,23,1,2,1,7,8,16,11,9,6,5,2,6,4,16,2,8,14,1,11,8,9,1,1,1,9,25,4,11,19,7,2,15,2,12,8,52,7,5,19,2,16,4,36,8,1,16,8,24,26,4,6,2,9, |
| 4994 | 5,4,36,3,28,12,25,15,37,27,17,12,59,38,5,32,127,1,2,9,17,14,4,1,2,1,1,8,11,50,4,14,2,19,16,4,17,5,4,5,26,12,45,2,23,45,104,30,12,8,3,10,2,2, |
| 4995 | 3,3,1,4,20,7,2,9,6,15,2,20,1,3,16,4,11,15,6,134,2,5,59,1,2,2,2,1,9,17,3,26,137,10,211,59,1,2,4,1,4,1,1,1,2,6,2,3,1,1,2,3,2,3,1,3,4,4,2,3,3, |
| 4996 | 1,4,3,1,7,2,2,3,1,2,1,3,3,3,2,2,3,2,1,3,14,6,1,3,2,9,6,15,27,9,34,145,1,1,2,1,1,1,1,2,1,1,1,1,2,2,2,3,1,2,1,1,1,2,3,5,8,3,5,2,4,1,3,2,2,2,12, |
| 4997 | 4,1,1,1,10,4,5,1,20,4,16,1,15,9,5,12,2,9,2,5,4,2,26,19,7,1,26,4,30,12,15,42,1,6,8,172,1,1,4,2,1,1,11,2,2,4,2,1,2,1,10,8,1,2,1,4,5,1,2,5,1,8, |
| 4998 | 4,1,3,4,2,1,6,2,1,3,4,1,2,1,1,1,1,12,5,7,2,4,3,1,1,1,3,3,6,1,2,2,3,3,3,2,1,2,12,14,11,6,6,4,12,2,8,1,7,10,1,35,7,4,13,15,4,3,23,21,28,52,5, |
| 4999 | 26,5,6,1,7,10,2,7,53,3,2,1,1,1,2,163,532,1,10,11,1,3,3,4,8,2,8,6,2,2,23,22,4,2,2,4,2,1,3,1,3,3,5,9,8,2,1,2,8,1,10,2,12,21,20,15,105,2,3,1,1, |
| 5000 | 3,2,3,1,1,2,5,1,4,15,11,19,1,1,1,1,5,4,5,1,1,2,5,3,5,12,1,2,5,1,11,1,1,15,9,1,4,5,3,26,8,2,1,3,1,1,15,19,2,12,1,2,5,2,7,2,19,2,20,6,26,7,5, |
| 5001 | 2,2,7,34,21,13,70,2,128,1,1,2,1,1,2,1,1,3,2,2,2,15,1,4,1,3,4,42,10,6,1,49,85,8,1,2,1,1,4,4,2,3,6,1,5,7,4,3,211,4,1,2,1,2,5,1,2,4,2,2,6,5,6, |
| 5002 | 10,3,4,48,100,6,2,16,296,5,27,387,2,2,3,7,16,8,5,38,15,39,21,9,10,3,7,59,13,27,21,47,5,21,6 |
| 5003 | }; |
| 5004 | static ImWchar base_ranges[] = |
| 5005 | { |
| 5006 | 0x0020, 0x00FF, |
| 5007 | 0x2000, 0x206F, |
| 5008 | 0x3000, 0x30FF, |
| 5009 | 0x31F0, 0x31FF, |
| 5010 | 0xFF00, 0xFFEF, |
| 5011 | 0xFFFD, 0xFFFD |
| 5012 | }; |
| 5013 | static ImWchar full_ranges[IM_COUNTOF(base_ranges) + IM_COUNTOF(accumulative_offsets_from_0x4E00) * 2 + 1] = { 0 }; |
| 5014 | if (!full_ranges[0]) |
| 5015 | { |
| 5016 | memcpy(full_ranges, base_ranges, sizeof(base_ranges)); |
| 5017 | UnpackAccumulativeOffsetsIntoRanges(0x4E00, accumulative_offsets_from_0x4E00, IM_COUNTOF(accumulative_offsets_from_0x4E00), full_ranges + IM_COUNTOF(base_ranges)); |
| 5018 | } |
| 5019 | return &full_ranges[0]; |
| 5020 | } |
| 5021 | |
| 5022 | const ImWchar* ImFontAtlas::GetGlyphRangesJapanese() |
| 5023 | { |
| 5024 | |
| 5025 | |
| 5026 | |
| 5027 | |
| 5028 | |
| 5029 | |
| 5030 | |
| 5031 | |
| 5032 | |
| 5033 | |
| 5034 | |
| 5035 | |
| 5036 | |
| 5037 | |
| 5038 | |
| 5039 | |
| 5040 | |
| 5041 | |
| 5042 | |
| 5043 | |
| 5044 | static const short accumulative_offsets_from_0x4E00[] = |
| 5045 | { |
| 5046 | 0,1,2,4,1,1,1,1,2,1,3,3,2,2,1,5,3,5,7,5,6,1,2,1,7,2,6,3,1,8,1,1,4,1,1,18,2,11,2,6,2,1,2,1,5,1,2,1,3,1,2,1,2,3,3,1,1,2,3,1,1,1,12,7,9,1,4,5,1, |
| 5047 | 1,2,1,10,1,1,9,2,2,4,5,6,9,3,1,1,1,1,9,3,18,5,2,2,2,2,1,6,3,7,1,1,1,1,2,2,4,2,1,23,2,10,4,3,5,2,4,10,2,4,13,1,6,1,9,3,1,1,6,6,7,6,3,1,2,11,3, |
| 5048 | 2,2,3,2,15,2,2,5,4,3,6,4,1,2,5,2,12,16,6,13,9,13,2,1,1,7,16,4,7,1,19,1,5,1,2,2,7,7,8,2,6,5,4,9,18,7,4,5,9,13,11,8,15,2,1,1,1,2,1,2,2,1,2,2,8, |
| 5049 | 2,9,3,3,1,1,4,4,1,1,1,4,9,1,4,3,5,5,2,7,5,3,4,8,2,1,13,2,3,3,1,14,1,1,4,5,1,3,6,1,5,2,1,1,3,3,3,3,1,1,2,7,6,6,7,1,4,7,6,1,1,1,1,1,12,3,3,9,5, |
| 5050 | 2,6,1,5,6,1,2,3,18,2,4,14,4,1,3,6,1,1,6,3,5,5,3,2,2,2,2,12,3,1,4,2,3,2,3,11,1,7,4,1,2,1,3,17,1,9,1,24,1,1,4,2,2,4,1,2,7,1,1,1,3,1,2,2,4,15,1, |
| 5051 | 1,2,1,1,2,1,5,2,5,20,2,5,9,1,10,8,7,6,1,1,1,1,1,1,6,2,1,2,8,1,1,1,1,5,1,1,3,1,1,1,1,3,1,1,12,4,1,3,1,1,1,1,1,10,3,1,7,5,13,1,2,3,4,6,1,1,30, |
| 5052 | 2,9,9,1,15,38,11,3,1,8,24,7,1,9,8,10,2,1,9,31,2,13,6,2,9,4,49,5,2,15,2,1,10,2,1,1,1,2,2,6,15,30,35,3,14,18,8,1,16,10,28,12,19,45,38,1,3,2,3, |
| 5053 | 13,2,1,7,3,6,5,3,4,3,1,5,7,8,1,5,3,18,5,3,6,1,21,4,24,9,24,40,3,14,3,21,3,2,1,2,4,2,3,1,15,15,6,5,1,1,3,1,5,6,1,9,7,3,3,2,1,4,3,8,21,5,16,4, |
| 5054 | 5,2,10,11,11,3,6,3,2,9,3,6,13,1,2,1,1,1,1,11,12,6,6,1,4,2,6,5,2,1,1,3,3,6,13,3,1,1,5,1,2,3,3,14,2,1,2,2,2,5,1,9,5,1,1,6,12,3,12,3,4,13,2,14, |
| 5055 | 2,8,1,17,5,1,16,4,2,2,21,8,9,6,23,20,12,25,19,9,38,8,3,21,40,25,33,13,4,3,1,4,1,2,4,1,2,5,26,2,1,1,2,1,3,6,2,1,1,1,1,1,1,2,3,1,1,1,9,2,3,1,1, |
| 5056 | 1,3,6,3,2,1,1,6,6,1,8,2,2,2,1,4,1,2,3,2,7,3,2,4,1,2,1,2,2,1,1,1,1,1,3,1,2,5,4,10,9,4,9,1,1,1,1,1,1,5,3,2,1,6,4,9,6,1,10,2,31,17,8,3,7,5,40,1, |
| 5057 | 7,7,1,6,5,2,10,7,8,4,15,39,25,6,28,47,18,10,7,1,3,1,1,2,1,1,1,3,3,3,1,1,1,3,4,2,1,4,1,3,6,10,7,8,6,2,2,1,3,3,2,5,8,7,9,12,2,15,1,1,4,1,2,1,1, |
| 5058 | 1,3,2,1,3,3,5,6,2,3,2,10,1,4,2,8,1,1,1,11,6,1,21,4,16,3,1,3,1,4,2,3,6,5,1,3,1,1,3,3,4,6,1,1,10,4,2,7,10,4,7,4,2,9,4,3,1,1,1,4,1,8,3,4,1,3,1, |
| 5059 | 6,1,4,2,1,4,7,2,1,8,1,4,5,1,1,2,2,4,6,2,7,1,10,1,1,3,4,11,10,8,21,4,6,1,3,5,2,1,2,28,5,5,2,3,13,1,2,3,1,4,2,1,5,20,3,8,11,1,3,3,3,1,8,10,9,2, |
| 5060 | 10,9,2,3,1,1,2,4,1,8,3,6,1,7,8,6,11,1,4,29,8,4,3,1,2,7,13,1,4,1,6,2,6,12,12,2,20,3,2,3,6,4,8,9,2,7,34,5,1,18,6,1,1,4,4,5,7,9,1,2,2,4,3,4,1,7, |
| 5061 | 2,2,2,6,2,3,25,5,3,6,1,4,6,7,4,2,1,4,2,13,6,4,4,3,1,5,3,4,4,3,2,1,1,4,1,2,1,1,3,1,11,1,6,3,1,7,3,6,2,8,8,6,9,3,4,11,3,2,10,12,2,5,11,1,6,4,5, |
| 5062 | 3,1,8,5,4,6,6,3,5,1,1,3,2,1,2,2,6,17,12,1,10,1,6,12,1,6,6,19,9,6,16,1,13,4,4,15,7,17,6,11,9,15,12,6,7,2,1,2,2,15,9,3,21,4,6,49,18,7,3,2,3,1, |
| 5063 | 6,8,2,2,6,2,9,1,3,6,4,4,1,2,16,2,5,2,1,6,2,3,5,3,1,2,5,1,2,1,9,3,1,8,6,4,8,11,3,1,1,1,1,3,1,13,8,4,1,3,2,2,1,4,1,11,1,5,2,1,5,2,5,8,6,1,1,7, |
| 5064 | 4,3,8,3,2,7,2,1,5,1,5,2,4,7,6,2,8,5,1,11,4,5,3,6,18,1,2,13,3,3,1,21,1,1,4,1,4,1,1,1,8,1,2,2,7,1,2,4,2,2,9,2,1,1,1,4,3,6,3,12,5,1,1,1,5,6,3,2, |
| 5065 | 4,8,2,2,4,2,7,1,8,9,5,2,3,2,1,3,2,13,7,14,6,5,1,1,2,1,4,2,23,2,1,1,6,3,1,4,1,15,3,1,7,3,9,14,1,3,1,4,1,1,5,8,1,3,8,3,8,15,11,4,14,4,4,2,5,5, |
| 5066 | 1,7,1,6,14,7,7,8,5,15,4,8,6,5,6,2,1,13,1,20,15,11,9,2,5,6,2,11,2,6,2,5,1,5,8,4,13,19,25,4,1,1,11,1,34,2,5,9,14,6,2,2,6,1,1,14,1,3,14,13,1,6, |
| 5067 | 12,21,14,14,6,32,17,8,32,9,28,1,2,4,11,8,3,1,14,2,5,15,1,1,1,1,3,6,4,1,3,4,11,3,1,1,11,30,1,5,1,4,1,5,8,1,1,3,2,4,3,17,35,2,6,12,17,3,1,6,2, |
| 5068 | 1,1,12,2,7,3,3,2,1,16,2,8,3,6,5,4,7,3,3,8,1,9,8,5,1,2,1,3,2,8,1,2,9,12,1,1,2,3,8,3,24,12,4,3,7,5,8,3,3,3,3,3,3,1,23,10,3,1,2,2,6,3,1,16,1,16, |
| 5069 | 22,3,10,4,11,6,9,7,7,3,6,2,2,2,4,10,2,1,1,2,8,7,1,6,4,1,3,3,3,5,10,12,12,2,3,12,8,15,1,1,16,6,6,1,5,9,11,4,11,4,2,6,12,1,17,5,13,1,4,9,5,1,11, |
| 5070 | 2,1,8,1,5,7,28,8,3,5,10,2,17,3,38,22,1,2,18,12,10,4,38,18,1,4,44,19,4,1,8,4,1,12,1,4,31,12,1,14,7,75,7,5,10,6,6,13,3,2,11,11,3,2,5,28,15,6,18, |
| 5071 | 18,5,6,4,3,16,1,7,18,7,36,3,5,3,1,7,1,9,1,10,7,2,4,2,6,2,9,7,4,3,32,12,3,7,10,2,23,16,3,1,12,3,31,4,11,1,3,8,9,5,1,30,15,6,12,3,2,2,11,19,9, |
| 5072 | 14,2,6,2,3,19,13,17,5,3,3,25,3,14,1,1,1,36,1,3,2,19,3,13,36,9,13,31,6,4,16,34,2,5,4,2,3,3,5,1,1,1,4,3,1,17,3,2,3,5,3,1,3,2,3,5,6,3,12,11,1,3, |
| 5073 | 1,2,26,7,12,7,2,14,3,3,7,7,11,25,25,28,16,4,36,1,2,1,6,2,1,9,3,27,17,4,3,4,13,4,1,3,2,2,1,10,4,2,4,6,3,8,2,1,18,1,1,24,2,2,4,33,2,3,63,7,1,6, |
| 5074 | 40,7,3,4,4,2,4,15,18,1,16,1,1,11,2,41,14,1,3,18,13,3,2,4,16,2,17,7,15,24,7,18,13,44,2,2,3,6,1,1,7,5,1,7,1,4,3,3,5,10,8,2,3,1,8,1,1,27,4,2,1, |
| 5075 | 12,1,2,1,10,6,1,6,7,5,2,3,7,11,5,11,3,6,6,2,3,15,4,9,1,1,2,1,2,11,2,8,12,8,5,4,2,3,1,5,2,2,1,14,1,12,11,4,1,11,17,17,4,3,2,5,5,7,3,1,5,9,9,8, |
| 5076 | 2,5,6,6,13,13,2,1,2,6,1,2,2,49,4,9,1,2,10,16,7,8,4,3,2,23,4,58,3,29,1,14,19,19,11,11,2,7,5,1,3,4,6,2,18,5,12,12,17,17,3,3,2,4,1,6,2,3,4,3,1, |
| 5077 | 1,1,1,5,1,1,9,1,3,1,3,6,1,8,1,1,2,6,4,14,3,1,4,11,4,1,3,32,1,2,4,13,4,1,2,4,2,1,3,1,11,1,4,2,1,4,4,6,3,5,1,6,5,7,6,3,23,3,5,3,5,3,3,13,3,9,10, |
| 5078 | 1,12,10,2,3,18,13,7,160,52,4,2,2,3,2,14,5,4,12,4,6,4,1,20,4,11,6,2,12,27,1,4,1,2,2,7,4,5,2,28,3,7,25,8,3,19,3,6,10,2,2,1,10,2,5,4,1,3,4,1,5, |
| 5079 | 3,2,6,9,3,6,2,16,3,3,16,4,5,5,3,2,1,2,16,15,8,2,6,21,2,4,1,22,5,8,1,1,21,11,2,1,11,11,19,13,12,4,2,3,2,3,6,1,8,11,1,4,2,9,5,2,1,11,2,9,1,1,2, |
| 5080 | 14,31,9,3,4,21,14,4,8,1,7,2,2,2,5,1,4,20,3,3,4,10,1,11,9,8,2,1,4,5,14,12,14,2,17,9,6,31,4,14,1,20,13,26,5,2,7,3,6,13,2,4,2,19,6,2,2,18,9,3,5, |
| 5081 | 12,12,14,4,6,2,3,6,9,5,22,4,5,25,6,4,8,5,2,6,27,2,35,2,16,3,7,8,8,6,6,5,9,17,2,20,6,19,2,13,3,1,1,1,4,17,12,2,14,7,1,4,18,12,38,33,2,10,1,1, |
| 5082 | 2,13,14,17,11,50,6,33,20,26,74,16,23,45,50,13,38,33,6,6,7,4,4,2,1,3,2,5,8,7,8,9,3,11,21,9,13,1,3,10,6,7,1,2,2,18,5,5,1,9,9,2,68,9,19,13,2,5, |
| 5083 | 1,4,4,7,4,13,3,9,10,21,17,3,26,2,1,5,2,4,5,4,1,7,4,7,3,4,2,1,6,1,1,20,4,1,9,2,2,1,3,3,2,3,2,1,1,1,20,2,3,1,6,2,3,6,2,4,8,1,3,2,10,3,5,3,4,4, |
| 5084 | 3,4,16,1,6,1,10,2,4,2,1,1,2,10,11,2,2,3,1,24,31,4,10,10,2,5,12,16,164,15,4,16,7,9,15,19,17,1,2,1,1,5,1,1,1,1,1,3,1,4,3,1,3,1,3,1,2,1,1,3,3,7, |
| 5085 | 2,8,1,2,2,2,1,3,4,3,7,8,12,92,2,10,3,1,3,14,5,25,16,42,4,7,7,4,2,21,5,27,26,27,21,25,30,31,2,1,5,13,3,22,5,6,6,11,9,12,1,5,9,7,5,5,22,60,3,5, |
| 5086 | 13,1,1,8,1,1,3,3,2,1,9,3,3,18,4,1,2,3,7,6,3,1,2,3,9,1,3,1,3,2,1,3,1,1,1,2,1,11,3,1,6,9,1,3,2,3,1,2,1,5,1,1,4,3,4,1,2,2,4,4,1,7,2,1,2,2,3,5,13, |
| 5087 | 18,3,4,14,9,9,4,16,3,7,5,8,2,6,48,28,3,1,1,4,2,14,8,2,9,2,1,15,2,4,3,2,10,16,12,8,7,1,1,3,1,1,1,2,7,4,1,6,4,38,39,16,23,7,15,15,3,2,12,7,21, |
| 5088 | 37,27,6,5,4,8,2,10,8,8,6,5,1,2,1,3,24,1,16,17,9,23,10,17,6,1,51,55,44,13,294,9,3,6,2,4,2,2,15,1,1,1,13,21,17,68,14,8,9,4,1,4,9,3,11,7,1,1,1, |
| 5089 | 5,6,3,2,1,1,1,2,3,8,1,2,2,4,1,5,5,2,1,4,3,7,13,4,1,4,1,3,1,1,1,5,5,10,1,6,1,5,2,1,5,2,4,1,4,5,7,3,18,2,9,11,32,4,3,3,2,4,7,11,16,9,11,8,13,38, |
| 5090 | 32,8,4,2,1,1,2,1,2,4,4,1,1,1,4,1,21,3,11,1,16,1,1,6,1,3,2,4,9,8,57,7,44,1,3,3,13,3,10,1,1,7,5,2,7,21,47,63,3,15,4,7,1,16,1,1,2,8,2,3,42,15,4, |
| 5091 | 1,29,7,22,10,3,78,16,12,20,18,4,67,11,5,1,3,15,6,21,31,32,27,18,13,71,35,5,142,4,10,1,2,50,19,33,16,35,37,16,19,27,7,1,133,19,1,4,8,7,20,1,4, |
| 5092 | 4,1,10,3,1,6,1,2,51,5,40,15,24,43,22928,11,1,13,154,70,3,1,1,7,4,10,1,2,1,1,2,1,2,1,2,2,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1, |
| 5093 | 3,2,1,1,1,1,2,1,1, |
| 5094 | }; |
| 5095 | static ImWchar base_ranges[] = |
| 5096 | { |
| 5097 | 0x0020, 0x00FF, |
| 5098 | 0x3000, 0x30FF, |
| 5099 | 0x31F0, 0x31FF, |
| 5100 | 0xFF00, 0xFFEF, |
| 5101 | 0xFFFD, 0xFFFD |
| 5102 | }; |
| 5103 | static ImWchar full_ranges[IM_COUNTOF(base_ranges) + IM_COUNTOF(accumulative_offsets_from_0x4E00)*2 + 1] = { 0 }; |
| 5104 | if (!full_ranges[0]) |
| 5105 | { |
| 5106 | memcpy(full_ranges, base_ranges, sizeof(base_ranges)); |
| 5107 | UnpackAccumulativeOffsetsIntoRanges(0x4E00, accumulative_offsets_from_0x4E00, IM_COUNTOF(accumulative_offsets_from_0x4E00), full_ranges + IM_COUNTOF(base_ranges)); |
| 5108 | } |
| 5109 | return &full_ranges[0]; |
| 5110 | } |
| 5111 | |
| 5112 | const ImWchar* ImFontAtlas::GetGlyphRangesCyrillic() |
| 5113 | { |
| 5114 | static const ImWchar ranges[] = |
| 5115 | { |
| 5116 | 0x0020, 0x00FF, |
| 5117 | 0x0400, 0x052F, |
| 5118 | 0x2DE0, 0x2DFF, |
| 5119 | 0xA640, 0xA69F, |
| 5120 | 0, |
| 5121 | }; |
| 5122 | return &ranges[0]; |
| 5123 | } |
| 5124 | |
| 5125 | const ImWchar* ImFontAtlas::GetGlyphRangesThai() |
| 5126 | { |
| 5127 | static const ImWchar ranges[] = |
| 5128 | { |
| 5129 | 0x0020, 0x00FF, |
| 5130 | 0x2010, 0x205E, |
| 5131 | 0x0E00, 0x0E7F, |
| 5132 | 0, |
| 5133 | }; |
| 5134 | return &ranges[0]; |
| 5135 | } |
| 5136 | |
| 5137 | const ImWchar* ImFontAtlas::GetGlyphRangesVietnamese() |
| 5138 | { |
| 5139 | static const ImWchar ranges[] = |
| 5140 | { |
| 5141 | 0x0020, 0x00FF, |
| 5142 | 0x0102, 0x0103, |
| 5143 | 0x0110, 0x0111, |
| 5144 | 0x0128, 0x0129, |
| 5145 | 0x0168, 0x0169, |
| 5146 | 0x01A0, 0x01A1, |
| 5147 | 0x01AF, 0x01B0, |
| 5148 | 0x1EA0, 0x1EF9, |
| 5149 | 0, |
| 5150 | }; |
| 5151 | return &ranges[0]; |
| 5152 | } |
| 5153 | #endif |
| 5154 | |
| 5155 | |
| 5156 | |
| 5157 | |
| 5158 | |
| 5159 | void ImFontGlyphRangesBuilder::AddText(const char* text, const char* text_end) |
| 5160 | { |
| 5161 | if (text_end == NULL) |
| 5162 | text_end = text + strlen(text); |
| 5163 | while (text < text_end) |
| 5164 | { |
| 5165 | unsigned int c = 0; |
| 5166 | int c_len = ImTextCharFromUtf8(&c, text, text_end); |
| 5167 | text += c_len; |
| 5168 | if (c_len == 0) |
| 5169 | break; |
| 5170 | AddChar((ImWchar)c); |
| 5171 | } |
| 5172 | } |
| 5173 | |
| 5174 | void ImFontGlyphRangesBuilder::AddRanges(const ImWchar* ranges) |
| 5175 | { |
| 5176 | for (; ranges[0]; ranges += 2) |
| 5177 | for (unsigned int c = ranges[0]; c <= ranges[1] && c <= IM_UNICODE_CODEPOINT_MAX; c++) |
| 5178 | AddChar((ImWchar)c); |
| 5179 | } |
| 5180 | |
| 5181 | void ImFontGlyphRangesBuilder::BuildRanges(ImVector<ImWchar>* out_ranges) |
| 5182 | { |
| 5183 | const int max_codepoint = IM_UNICODE_CODEPOINT_MAX; |
| 5184 | for (int n = 0; n <= max_codepoint; n++) |
| 5185 | if (GetBit(n)) |
| 5186 | { |
| 5187 | out_ranges->push_back((ImWchar)n); |
| 5188 | while (n < max_codepoint && GetBit(n + 1)) |
| 5189 | n++; |
| 5190 | out_ranges->push_back((ImWchar)n); |
| 5191 | } |
| 5192 | out_ranges->push_back(0); |
| 5193 | } |
| 5194 | |
| 5195 | |
| 5196 | |
| 5197 | |
| 5198 | |
| 5199 | ImFontBaked::ImFontBaked() |
| 5200 | { |
| 5201 | memset((void*)this, 0, sizeof(*this)); |
| 5202 | FallbackGlyphIndex = -1; |
| 5203 | } |
| 5204 | |
| 5205 | void ImFontBaked::ClearOutputData() |
| 5206 | { |
| 5207 | FallbackAdvanceX = 0.0f; |
| 5208 | Glyphs.clear(); |
| 5209 | IndexAdvanceX.clear(); |
| 5210 | IndexLookup.clear(); |
| 5211 | FallbackGlyphIndex = -1; |
| 5212 | Ascent = Descent = 0.0f; |
| 5213 | MetricsTotalSurface = 0; |
| 5214 | } |
| 5215 | |
| 5216 | ImFont::ImFont() |
| 5217 | { |
| 5218 | memset((void*)this, 0, sizeof(*this)); |
| 5219 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS |
| 5220 | Scale = 1.0f; |
| 5221 | #endif |
| 5222 | } |
| 5223 | |
| 5224 | ImFont::~ImFont() |
| 5225 | { |
| 5226 | ClearOutputData(); |
| 5227 | } |
| 5228 | |
| 5229 | void ImFont::ClearOutputData() |
| 5230 | { |
| 5231 | if (ImFontAtlas* atlas = OwnerAtlas) |
| 5232 | ImFontAtlasFontDiscardBakes(atlas, this, 0); |
| 5233 | |
| 5234 | memset(Used8kPagesMap, 0, sizeof(Used8kPagesMap)); |
| 5235 | LastBaked = NULL; |
| 5236 | } |
| 5237 | |
| 5238 | |
| 5239 | |
| 5240 | bool ImFont::IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last) |
| 5241 | { |
| 5242 | unsigned int page_begin = (c_begin / 8192); |
| 5243 | unsigned int page_last = (c_last / 8192); |
| 5244 | for (unsigned int page_n = page_begin; page_n <= page_last; page_n++) |
| 5245 | if ((page_n >> 3) < sizeof(Used8kPagesMap)) |
| 5246 | if (Used8kPagesMap[page_n >> 3] & (1 << (page_n & 7))) |
| 5247 | return false; |
| 5248 | return true; |
| 5249 | } |
| 5250 | |
| 5251 | |
| 5252 | |
| 5253 | |
| 5254 | ImFontGlyph* ImFontAtlasBakedAddFontGlyph(ImFontAtlas* atlas, ImFontBaked* baked, ImFontConfig* src, const ImFontGlyph* in_glyph) |
| 5255 | { |
| 5256 | int glyph_idx = baked->Glyphs.Size; |
| 5257 | baked->Glyphs.push_back(*in_glyph); |
| 5258 | ImFontGlyph* glyph = &baked->Glyphs[glyph_idx]; |
| 5259 | IM_ASSERT(baked->Glyphs.Size < 0xFFFE); |
| 5260 | |
| 5261 | |
| 5262 | if (glyph->PackId != ImFontAtlasRectId_Invalid) |
| 5263 | { |
| 5264 | ImTextureRect* r = ImFontAtlasPackGetRect(atlas, glyph->PackId); |
| 5265 | IM_ASSERT(glyph->U0 == 0.0f && glyph->V0 == 0.0f && glyph->U1 == 0.0f && glyph->V1 == 0.0f); |
| 5266 | glyph->U0 = (r->x) * atlas->TexUvScale.x; |
| 5267 | glyph->V0 = (r->y) * atlas->TexUvScale.y; |
| 5268 | glyph->U1 = (r->x + r->w) * atlas->TexUvScale.x; |
| 5269 | glyph->V1 = (r->y + r->h) * atlas->TexUvScale.y; |
| 5270 | baked->MetricsTotalSurface += r->w * r->h; |
| 5271 | } |
| 5272 | |
| 5273 | if (src != NULL) |
| 5274 | { |
| 5275 | |
| 5276 | const float ref_size = baked->OwnerFont->Sources[0]->SizePixels; |
| 5277 | const float offsets_scale = (ref_size != 0.0f) ? (baked->Size / ref_size) : 1.0f; |
| 5278 | float advance_x = ImClamp(glyph->AdvanceX, src->GlyphMinAdvanceX * offsets_scale, src->GlyphMaxAdvanceX * offsets_scale); |
| 5279 | if (advance_x != glyph->AdvanceX) |
| 5280 | { |
| 5281 | float char_off_x = src->PixelSnapH ? ImTrunc((advance_x - glyph->AdvanceX) * 0.5f) : (advance_x - glyph->AdvanceX) * 0.5f; |
| 5282 | glyph->X0 += char_off_x; |
| 5283 | glyph->X1 += char_off_x; |
| 5284 | } |
| 5285 | |
| 5286 | |
| 5287 | if (src->PixelSnapH) |
| 5288 | advance_x = IM_ROUND(advance_x); |
| 5289 | |
| 5290 | |
| 5291 | glyph->AdvanceX = advance_x + src->GlyphExtraAdvanceX; |
| 5292 | } |
| 5293 | if (glyph->Colored) |
| 5294 | atlas->TexPixelsUseColors = atlas->TexData->UseColors = true; |
| 5295 | |
| 5296 | |
| 5297 | const int codepoint = glyph->Codepoint; |
| 5298 | ImFontBaked_BuildGrowIndex(baked, codepoint + 1); |
| 5299 | baked->IndexAdvanceX[codepoint] = glyph->AdvanceX; |
| 5300 | baked->IndexLookup[codepoint] = (ImU16)glyph_idx; |
| 5301 | const int page_n = codepoint / 8192; |
| 5302 | baked->OwnerFont->Used8kPagesMap[page_n >> 3] |= 1 << (page_n & 7); |
| 5303 | |
| 5304 | return glyph; |
| 5305 | } |
| 5306 | |
| 5307 | |
| 5308 | void ImFontAtlasBakedAddFontGlyphAdvancedX(ImFontAtlas* atlas, ImFontBaked* baked, ImFontConfig* src, ImWchar codepoint, float advance_x) |
| 5309 | { |
| 5310 | IM_UNUSED(atlas); |
| 5311 | if (src != NULL) |
| 5312 | { |
| 5313 | |
| 5314 | const float ref_size = baked->OwnerFont->Sources[0]->SizePixels; |
| 5315 | const float offsets_scale = (ref_size != 0.0f) ? (baked->Size / ref_size) : 1.0f; |
| 5316 | advance_x = ImClamp(advance_x, src->GlyphMinAdvanceX * offsets_scale, src->GlyphMaxAdvanceX * offsets_scale); |
| 5317 | |
| 5318 | |
| 5319 | if (src->PixelSnapH) |
| 5320 | advance_x = IM_ROUND(advance_x); |
| 5321 | |
| 5322 | |
| 5323 | advance_x += src->GlyphExtraAdvanceX; |
| 5324 | } |
| 5325 | |
| 5326 | ImFontBaked_BuildGrowIndex(baked, codepoint + 1); |
| 5327 | baked->IndexAdvanceX[codepoint] = advance_x; |
| 5328 | } |
| 5329 | |
| 5330 | |
| 5331 | void ImFontAtlasBakedSetFontGlyphBitmap(ImFontAtlas* atlas, ImFontBaked* baked, ImFontConfig* src, ImFontGlyph* glyph, ImTextureRect* r, const unsigned char* src_pixels, ImTextureFormat src_fmt, int src_pitch) |
| 5332 | { |
| 5333 | ImTextureData* tex = atlas->TexData; |
| 5334 | IM_ASSERT(r->x + r->w <= tex->Width && r->y + r->h <= tex->Height); |
| 5335 | ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, (unsigned char*)tex->GetPixelsAt(r->x, r->y), tex->Format, tex->GetPitch(), r->w, r->h); |
| 5336 | ImFontAtlasPostProcessData pp_data = { atlas, baked->OwnerFont, src, baked, glyph, tex->GetPixelsAt(r->x, r->y), tex->Format, tex->GetPitch(), r->w, r->h }; |
| 5337 | ImFontAtlasTextureBlockPostProcess(&pp_data); |
| 5338 | ImFontAtlasTextureBlockQueueUpload(atlas, tex, r->x, r->y, r->w, r->h); |
| 5339 | } |
| 5340 | |
| 5341 | void ImFont::AddRemapChar(ImWchar from_codepoint, ImWchar to_codepoint) |
| 5342 | { |
| 5343 | RemapPairs.SetInt((ImGuiID)from_codepoint, (int)to_codepoint); |
| 5344 | } |
| 5345 | |
| 5346 | |
| 5347 | ImFontGlyph* ImFontBaked::FindGlyph(ImWchar c) |
| 5348 | { |
| 5349 | if (c < (size_t)IndexLookup.Size) IM_LIKELY |
| 5350 | { |
| 5351 | const int i = (int)IndexLookup.Data[c]; |
| 5352 | if (i == IM_FONTGLYPH_INDEX_NOT_FOUND) |
| 5353 | return &Glyphs.Data[FallbackGlyphIndex]; |
| 5354 | if (i != IM_FONTGLYPH_INDEX_UNUSED) |
| 5355 | return &Glyphs.Data[i]; |
| 5356 | } |
| 5357 | ImFontGlyph* glyph = ImFontBaked_BuildLoadGlyph(this, c, NULL); |
| 5358 | return glyph ? glyph : &Glyphs.Data[FallbackGlyphIndex]; |
| 5359 | } |
| 5360 | |
| 5361 | |
| 5362 | ImFontGlyph* ImFontBaked::FindGlyphNoFallback(ImWchar c) |
| 5363 | { |
| 5364 | if (c < (size_t)IndexLookup.Size) IM_LIKELY |
| 5365 | { |
| 5366 | const int i = (int)IndexLookup.Data[c]; |
| 5367 | if (i == IM_FONTGLYPH_INDEX_NOT_FOUND) |
| 5368 | return NULL; |
| 5369 | if (i != IM_FONTGLYPH_INDEX_UNUSED) |
| 5370 | return &Glyphs.Data[i]; |
| 5371 | } |
| 5372 | LoadNoFallback = true; |
| 5373 | ImFontGlyph* glyph = ImFontBaked_BuildLoadGlyph(this, c, NULL); |
| 5374 | LoadNoFallback = false; |
| 5375 | return glyph; |
| 5376 | } |
| 5377 | |
| 5378 | bool ImFontBaked::IsGlyphLoaded(ImWchar c) |
| 5379 | { |
| 5380 | if (c < (size_t)IndexLookup.Size) IM_LIKELY |
| 5381 | { |
| 5382 | const int i = (int)IndexLookup.Data[c]; |
| 5383 | if (i == IM_FONTGLYPH_INDEX_NOT_FOUND) |
| 5384 | return false; |
| 5385 | if (i != IM_FONTGLYPH_INDEX_UNUSED) |
| 5386 | return true; |
| 5387 | } |
| 5388 | return false; |
| 5389 | } |
| 5390 | |
| 5391 | |
| 5392 | bool ImFont::IsGlyphInFont(ImWchar c) |
| 5393 | { |
| 5394 | ImFontAtlas* atlas = OwnerAtlas; |
| 5395 | ImFontAtlas_FontHookRemapCodepoint(atlas, this, &c); |
| 5396 | for (ImFontConfig* src : Sources) |
| 5397 | { |
| 5398 | const ImFontLoader* loader = src->FontLoader ? src->FontLoader : atlas->FontLoader; |
| 5399 | if (loader->FontSrcContainsGlyph != NULL && loader->FontSrcContainsGlyph(atlas, src, c)) |
| 5400 | return true; |
| 5401 | } |
| 5402 | return false; |
| 5403 | } |
| 5404 | |
| 5405 | |
| 5406 | IM_MSVC_RUNTIME_CHECKS_OFF |
| 5407 | float ImFontBaked::GetCharAdvance(ImWchar c) |
| 5408 | { |
| 5409 | if ((int)c < IndexAdvanceX.Size) |
| 5410 | { |
| 5411 | |
| 5412 | const float x = IndexAdvanceX.Data[c]; |
| 5413 | if (x >= 0.0f) |
| 5414 | return x; |
| 5415 | } |
| 5416 | return ImFontBaked_BuildLoadGlyphAdvanceX(this, c); |
| 5417 | } |
| 5418 | IM_MSVC_RUNTIME_CHECKS_RESTORE |
| 5419 | |
| 5420 | ImGuiID ImFontAtlasBakedGetId(ImGuiID font_id, float baked_size, float rasterizer_density) |
| 5421 | { |
| 5422 | struct { ImGuiID FontId; float BakedSize; float RasterizerDensity; } hashed_data; |
| 5423 | hashed_data.FontId = font_id; |
| 5424 | hashed_data.BakedSize = baked_size; |
| 5425 | hashed_data.RasterizerDensity = rasterizer_density; |
| 5426 | return ImHashData(&hashed_data, sizeof(hashed_data)); |
| 5427 | } |
| 5428 | |
| 5429 | |
| 5430 | ImFontBaked* ImFont::GetFontBaked(float size, float density) |
| 5431 | { |
| 5432 | ImFontBaked* baked = LastBaked; |
| 5433 | |
| 5434 | |
| 5435 | |
| 5436 | size = ImGui::GetRoundedFontSize(size); |
| 5437 | |
| 5438 | if (density < 0.0f) |
| 5439 | density = CurrentRasterizerDensity; |
| 5440 | if (baked && baked->Size == size && baked->RasterizerDensity == density) |
| 5441 | return baked; |
| 5442 | |
| 5443 | ImFontAtlas* atlas = OwnerAtlas; |
| 5444 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 5445 | baked = ImFontAtlasBakedGetOrAdd(atlas, this, size, density); |
| 5446 | if (baked == NULL) |
| 5447 | return NULL; |
| 5448 | baked->LastUsedFrame = builder->FrameCount; |
| 5449 | LastBaked = baked; |
| 5450 | return baked; |
| 5451 | } |
| 5452 | |
| 5453 | ImFontBaked* ImFontAtlasBakedGetOrAdd(ImFontAtlas* atlas, ImFont* font, float font_size, float font_rasterizer_density) |
| 5454 | { |
| 5455 | |
| 5456 | |
| 5457 | IM_ASSERT(font_size > 0.0f && font_rasterizer_density > 0.0f); |
| 5458 | ImGuiID baked_id = ImFontAtlasBakedGetId(font->FontId, font_size, font_rasterizer_density); |
| 5459 | ImFontAtlasBuilder* builder = atlas->Builder; |
| 5460 | ImFontBaked** p_baked_in_map = (ImFontBaked**)builder->BakedMap.GetVoidPtrRef(baked_id); |
| 5461 | ImFontBaked* baked = *p_baked_in_map; |
| 5462 | if (baked != NULL) |
| 5463 | { |
| 5464 | IM_ASSERT(baked->Size == font_size && baked->OwnerFont == font && baked->BakedId == baked_id); |
| 5465 | return baked; |
| 5466 | } |
| 5467 | |
| 5468 | |
| 5469 | |
| 5470 | if ((font->Flags & ImFontFlags_LockBakedSizes) || atlas->Locked) |
| 5471 | { |
| 5472 | baked = ImFontAtlasBakedGetClosestMatch(atlas, font, font_size, font_rasterizer_density); |
| 5473 | if (baked != NULL) |
| 5474 | return baked; |
| 5475 | if (atlas->Locked) |
| 5476 | { |
| 5477 | IM_ASSERT(!atlas->Locked && "Cannot use dynamic font size with a locked ImFontAtlas!"); |
| 5478 | return NULL; |
| 5479 | } |
| 5480 | } |
| 5481 | |
| 5482 | |
| 5483 | baked = ImFontAtlasBakedAdd(atlas, font, font_size, font_rasterizer_density, baked_id); |
| 5484 | *p_baked_in_map = baked; |
| 5485 | return baked; |
| 5486 | } |
| 5487 | |
| 5488 | |
| 5489 | const char* ImTextCalcWordWrapNextLineStart(const char* text, const char* text_end, ImDrawTextFlags flags) |
| 5490 | { |
| 5491 | if ((flags & ImDrawTextFlags_WrapKeepBlanks) == 0) |
| 5492 | while (text < text_end && ImCharIsBlankA(*text)) |
| 5493 | text++; |
| 5494 | if (text < text_end && *text == '\n') |
| 5495 | text++; |
| 5496 | return text; |
| 5497 | } |
| 5498 | |
| 5499 | void ImTextClassifierClear(ImU32* bits, unsigned int codepoint_min, unsigned int codepoint_end, ImWcharClass char_class) |
| 5500 | { |
| 5501 | for (unsigned int c = codepoint_min; c < codepoint_end; c++) |
| 5502 | ImTextClassifierSetCharClass(bits, codepoint_min, codepoint_end, char_class, c); |
| 5503 | } |
| 5504 | |
| 5505 | void ImTextClassifierSetCharClass(ImU32* bits, unsigned int codepoint_min, unsigned int codepoint_end, ImWcharClass char_class, unsigned int c) |
| 5506 | { |
| 5507 | IM_ASSERT(c >= codepoint_min && c < codepoint_end); |
| 5508 | IM_UNUSED(codepoint_end); |
| 5509 | c -= codepoint_min; |
| 5510 | const ImU32 shift = (c & 15) << 1; |
| 5511 | bits[c >> 4] = (bits[c >> 4] & ~(0x03 << shift)) | (char_class << shift); |
| 5512 | } |
| 5513 | |
| 5514 | void ImTextClassifierSetCharClassFromStr(ImU32* bits, unsigned int codepoint_min, unsigned int codepoint_end, ImWcharClass char_class, const char* s) |
| 5515 | { |
| 5516 | const char* s_end = s + strlen(s); |
| 5517 | while (*s) |
| 5518 | { |
| 5519 | unsigned int c; |
| 5520 | s += ImTextCharFromUtf8(&c, s, s_end); |
| 5521 | ImTextClassifierSetCharClass(bits, codepoint_min, codepoint_end, char_class, c); |
| 5522 | } |
| 5523 | } |
| 5524 | |
| 5525 | #define ImTextClassifierGet(_BITS, _CHAR_OFFSET) ((_BITS[(_CHAR_OFFSET) >> 4] >> (((_CHAR_OFFSET) & 15) << 1)) & 0x03) |
| 5526 | |
| 5527 | |
| 5528 | static ImU32 g_CharClassifierIsSeparator_0000_007f[128 / 16] = {}; |
| 5529 | static ImU32 g_CharClassifierIsSeparator_3000_300f[ 16 / 16] = {}; |
| 5530 | |
| 5531 | void ImTextInitClassifiers() |
| 5532 | { |
| 5533 | if (ImTextClassifierGet(g_CharClassifierIsSeparator_0000_007f, ',') != 0) |
| 5534 | return; |
| 5535 | |
| 5536 | |
| 5537 | |
| 5538 | ImTextClassifierClear(g_CharClassifierIsSeparator_0000_007f, 0, 128, ImWcharClass_Other); |
| 5539 | ImTextClassifierSetCharClassFromStr(g_CharClassifierIsSeparator_0000_007f, 0, 128, ImWcharClass_Blank, " \t"); |
| 5540 | ImTextClassifierSetCharClassFromStr(g_CharClassifierIsSeparator_0000_007f, 0, 128, ImWcharClass_Punct, ".,;!?\""); |
| 5541 | |
| 5542 | ImTextClassifierClear(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, ImWcharClass_Other); |
| 5543 | ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, ImWcharClass_Blank, 0x3000); |
| 5544 | ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, ImWcharClass_Punct, 0x3001); |
| 5545 | ImTextClassifierSetCharClass(g_CharClassifierIsSeparator_3000_300f, 0x3000, 0x300F, ImWcharClass_Punct, 0x3002); |
| 5546 | } |
| 5547 | |
| 5548 | |
| 5549 | |
| 5550 | |
| 5551 | const char* ImFontCalcWordWrapPositionEx(ImFont* font, float size, const char* text, const char* text_end, float wrap_width, ImDrawTextFlags flags) |
| 5552 | { |
| 5553 | |
| 5554 | |
| 5555 | |
| 5556 | |
| 5557 | |
| 5558 | |
| 5559 | |
| 5560 | |
| 5561 | |
| 5562 | |
| 5563 | ImFontBaked* baked = font->GetFontBaked(size); |
| 5564 | const float scale = size / baked->Size; |
| 5565 | |
| 5566 | float line_width = 0.0f; |
| 5567 | float blank_width = 0.0f; |
| 5568 | wrap_width /= scale; |
| 5569 | |
| 5570 | const char* s = text; |
| 5571 | IM_ASSERT(text_end != NULL); |
| 5572 | |
| 5573 | int prev_type = ImWcharClass_Other; |
| 5574 | const bool keep_blanks = (flags & ImDrawTextFlags_WrapKeepBlanks) != 0; |
| 5575 | |
| 5576 | |
| 5577 | |
| 5578 | const char* span_end = s; |
| 5579 | float span_width = 0.0f; |
| 5580 | |
| 5581 | while (s < text_end) |
| 5582 | { |
| 5583 | unsigned int c = (unsigned int)*s; |
| 5584 | const char* next_s; |
| 5585 | if (c < 0x80) |
| 5586 | next_s = s + 1; |
| 5587 | else |
| 5588 | next_s = s + ImTextCharFromUtf8(&c, s, text_end); |
| 5589 | |
| 5590 | if (c < 32) |
| 5591 | { |
| 5592 | if (c == '\n') |
| 5593 | return s; |
| 5594 | if (c == '\r') |
| 5595 | { |
| 5596 | s = next_s; |
| 5597 | continue; |
| 5598 | } |
| 5599 | } |
| 5600 | |
| 5601 | |
| 5602 | float char_width = (c < (unsigned int)baked->IndexAdvanceX.Size) ? baked->IndexAdvanceX.Data[c] : -1.0f; |
| 5603 | if (char_width < 0.0f) |
| 5604 | char_width = BuildLoadGlyphGetAdvanceOrFallback(baked, c); |
| 5605 | |
| 5606 | |
| 5607 | int curr_type; |
| 5608 | if (c < 128) |
| 5609 | curr_type = ImTextClassifierGet(g_CharClassifierIsSeparator_0000_007f, c); |
| 5610 | else if (c >= 0x3000 && c < 0x3010) |
| 5611 | curr_type = ImTextClassifierGet(g_CharClassifierIsSeparator_3000_300f, c & 15); |
| 5612 | else |
| 5613 | curr_type = ImWcharClass_Other; |
| 5614 | |
| 5615 | if (curr_type == ImWcharClass_Blank) |
| 5616 | { |
| 5617 | |
| 5618 | if (prev_type != ImWcharClass_Blank && !keep_blanks) |
| 5619 | { |
| 5620 | span_end = s; |
| 5621 | line_width += span_width; |
| 5622 | span_width = 0.0f; |
| 5623 | } |
| 5624 | blank_width += char_width; |
| 5625 | } |
| 5626 | else |
| 5627 | { |
| 5628 | |
| 5629 | if (prev_type == ImWcharClass_Punct && curr_type != ImWcharClass_Punct && !(c >= '0' && c <= '9')) |
| 5630 | { |
| 5631 | span_end = s; |
| 5632 | line_width += span_width + blank_width; |
| 5633 | span_width = blank_width = 0.0f; |
| 5634 | } |
| 5635 | |
| 5636 | else if (prev_type == ImWcharClass_Blank && keep_blanks) |
| 5637 | { |
| 5638 | span_end = s; |
| 5639 | line_width += span_width + blank_width; |
| 5640 | span_width = blank_width = 0.0f; |
| 5641 | } |
| 5642 | span_width += char_width; |
| 5643 | } |
| 5644 | |
| 5645 | if (span_width + blank_width + line_width > wrap_width) |
| 5646 | { |
| 5647 | if (span_width + blank_width > wrap_width) |
| 5648 | break; |
| 5649 | |
| 5650 | |
| 5651 | |
| 5652 | return span_end; |
| 5653 | } |
| 5654 | |
| 5655 | prev_type = curr_type; |
| 5656 | s = next_s; |
| 5657 | } |
| 5658 | |
| 5659 | |
| 5660 | |
| 5661 | if (s == text && text < text_end) |
| 5662 | return s + ImTextCountUtf8BytesFromChar(s, text_end); |
| 5663 | return s; |
| 5664 | } |
| 5665 | |
| 5666 | const char* ImFont::CalcWordWrapPosition(float size, const char* text, const char* text_end, float wrap_width) |
| 5667 | { |
| 5668 | return ImFontCalcWordWrapPositionEx(this, size, text, text_end, wrap_width, ImDrawTextFlags_None); |
| 5669 | } |
| 5670 | |
| 5671 | ImVec2 ImFontCalcTextSizeEx(ImFont* font, float size, float max_width, float wrap_width, const char* text_begin, const char* text_end_display, const char* text_end, const char** out_remaining, ImVec2* out_offset, ImDrawTextFlags flags) |
| 5672 | { |
| 5673 | if (!text_end) |
| 5674 | text_end = text_begin + ImStrlen(text_begin); |
| 5675 | if (!text_end_display) |
| 5676 | text_end_display = text_end; |
| 5677 | |
| 5678 | ImFontBaked* baked = font->GetFontBaked(size); |
| 5679 | const float line_height = size; |
| 5680 | const float scale = line_height / baked->Size; |
| 5681 | |
| 5682 | ImVec2 text_size = ImVec2(0, 0); |
| 5683 | float line_width = 0.0f; |
| 5684 | |
| 5685 | const bool word_wrap_enabled = (wrap_width > 0.0f); |
| 5686 | const char* word_wrap_eol = NULL; |
| 5687 | |
| 5688 | const char* s = text_begin; |
| 5689 | while (s < text_end_display) |
| 5690 | { |
| 5691 | |
| 5692 | if (word_wrap_enabled) |
| 5693 | { |
| 5694 | |
| 5695 | if (!word_wrap_eol) |
| 5696 | word_wrap_eol = ImFontCalcWordWrapPositionEx(font, size, s, text_end, wrap_width - line_width, flags); |
| 5697 | |
| 5698 | if (s >= word_wrap_eol) |
| 5699 | { |
| 5700 | if (text_size.x < line_width) |
| 5701 | text_size.x = line_width; |
| 5702 | text_size.y += line_height; |
| 5703 | line_width = 0.0f; |
| 5704 | s = ImTextCalcWordWrapNextLineStart(s, text_end, flags); |
| 5705 | if (flags & ImDrawTextFlags_StopOnNewLine) |
| 5706 | break; |
| 5707 | word_wrap_eol = NULL; |
| 5708 | continue; |
| 5709 | } |
| 5710 | } |
| 5711 | |
| 5712 | |
| 5713 | const char* prev_s = s; |
| 5714 | unsigned int c = (unsigned int)*s; |
| 5715 | if (c < 0x80) |
| 5716 | s += 1; |
| 5717 | else |
| 5718 | s += ImTextCharFromUtf8(&c, s, text_end); |
| 5719 | |
| 5720 | if (c == '\n') |
| 5721 | { |
| 5722 | text_size.x = ImMax(text_size.x, line_width); |
| 5723 | text_size.y += line_height; |
| 5724 | line_width = 0.0f; |
| 5725 | if (flags & ImDrawTextFlags_StopOnNewLine) |
| 5726 | break; |
| 5727 | continue; |
| 5728 | } |
| 5729 | if (c == '\r') |
| 5730 | continue; |
| 5731 | |
| 5732 | |
| 5733 | float char_width = (c < (unsigned int)baked->IndexAdvanceX.Size) ? baked->IndexAdvanceX.Data[c] : -1.0f; |
| 5734 | if (char_width < 0.0f) |
| 5735 | char_width = BuildLoadGlyphGetAdvanceOrFallback(baked, c); |
| 5736 | char_width *= scale; |
| 5737 | |
| 5738 | if (line_width + char_width >= max_width) |
| 5739 | { |
| 5740 | s = prev_s; |
| 5741 | break; |
| 5742 | } |
| 5743 | |
| 5744 | line_width += char_width; |
| 5745 | } |
| 5746 | |
| 5747 | if (text_size.x < line_width) |
| 5748 | text_size.x = line_width; |
| 5749 | |
| 5750 | if (out_offset != NULL) |
| 5751 | *out_offset = ImVec2(line_width, text_size.y + line_height); |
| 5752 | |
| 5753 | if (line_width > 0 || text_size.y == 0.0f) |
| 5754 | text_size.y += line_height; |
| 5755 | |
| 5756 | if (out_remaining != NULL) |
| 5757 | *out_remaining = s; |
| 5758 | |
| 5759 | return text_size; |
| 5760 | } |
| 5761 | |
| 5762 | ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end, const char** out_remaining) |
| 5763 | { |
| 5764 | return ImFontCalcTextSizeEx(this, size, max_width, wrap_width, text_begin, text_end, text_end, out_remaining, NULL, ImDrawTextFlags_None); |
| 5765 | } |
| 5766 | |
| 5767 | |
| 5768 | void ImFont::RenderChar(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, ImWchar c, const ImVec4* cpu_fine_clip) |
| 5769 | { |
| 5770 | ImFontBaked* baked = GetFontBaked(size); |
| 5771 | const ImFontGlyph* glyph = baked->FindGlyph(c); |
| 5772 | if (!glyph || !glyph->Visible) |
| 5773 | return; |
| 5774 | if (glyph->Colored) |
| 5775 | col |= ~IM_COL32_A_MASK; |
| 5776 | float scale = (size >= 0.0f) ? (size / baked->Size) : 1.0f; |
| 5777 | float x = pos.x; |
| 5778 | float y = pos.y; |
| 5779 | if ((draw_list->Flags & ImDrawListFlags_TextNoPixelSnap) == 0) |
| 5780 | { |
| 5781 | x = IM_TRUNC(x); |
| 5782 | y = IM_TRUNC(y); |
| 5783 | } |
| 5784 | |
| 5785 | float x1 = x + glyph->X0 * scale; |
| 5786 | float x2 = x + glyph->X1 * scale; |
| 5787 | if (cpu_fine_clip && (x1 > cpu_fine_clip->z || x2 < cpu_fine_clip->x)) |
| 5788 | return; |
| 5789 | float y1 = y + glyph->Y0 * scale; |
| 5790 | float y2 = y + glyph->Y1 * scale; |
| 5791 | float u1 = glyph->U0; |
| 5792 | float v1 = glyph->V0; |
| 5793 | float u2 = glyph->U1; |
| 5794 | float v2 = glyph->V1; |
| 5795 | |
| 5796 | |
| 5797 | |
| 5798 | if (cpu_fine_clip != NULL) |
| 5799 | { |
| 5800 | if (x1 < cpu_fine_clip->x) { u1 = u1 + (1.0f - (x2 - cpu_fine_clip->x) / (x2 - x1)) * (u2 - u1); x1 = cpu_fine_clip->x; } |
| 5801 | if (y1 < cpu_fine_clip->y) { v1 = v1 + (1.0f - (y2 - cpu_fine_clip->y) / (y2 - y1)) * (v2 - v1); y1 = cpu_fine_clip->y; } |
| 5802 | if (x2 > cpu_fine_clip->z) { u2 = u1 + ((cpu_fine_clip->z - x1) / (x2 - x1)) * (u2 - u1); x2 = cpu_fine_clip->z; } |
| 5803 | if (y2 > cpu_fine_clip->w) { v2 = v1 + ((cpu_fine_clip->w - y1) / (y2 - y1)) * (v2 - v1); y2 = cpu_fine_clip->w; } |
| 5804 | if (y1 >= y2) |
| 5805 | return; |
| 5806 | } |
| 5807 | draw_list->PrimReserve(6, 4); |
| 5808 | draw_list->PrimRectUV(ImVec2(x1, y1), ImVec2(x2, y2), ImVec2(u1, v1), ImVec2(u2, v2), col); |
| 5809 | } |
| 5810 | |
| 5811 | |
| 5812 | |
| 5813 | void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width, ImDrawTextFlags flags) |
| 5814 | { |
| 5815 | begin: |
| 5816 | |
| 5817 | float x = pos.x; |
| 5818 | float y = pos.y; |
| 5819 | if (y > clip_rect.w) |
| 5820 | return; |
| 5821 | if ((draw_list->Flags & ImDrawListFlags_TextNoPixelSnap) == 0) |
| 5822 | { |
| 5823 | x = IM_TRUNC(x); |
| 5824 | y = IM_TRUNC(y); |
| 5825 | } |
| 5826 | |
| 5827 | if (!text_end) |
| 5828 | text_end = text_begin + ImStrlen(text_begin); |
| 5829 | |
| 5830 | const float line_height = size; |
| 5831 | ImFontBaked* baked = GetFontBaked(size); |
| 5832 | |
| 5833 | const float scale = size / baked->Size; |
| 5834 | const float origin_x = x; |
| 5835 | const bool word_wrap_enabled = (wrap_width > 0.0f); |
| 5836 | |
| 5837 | |
| 5838 | const char* s = text_begin; |
| 5839 | if (y + line_height < clip_rect.y) |
| 5840 | while (y + line_height < clip_rect.y && s < text_end) |
| 5841 | { |
| 5842 | const char* line_end = (const char*)ImMemchr(s, '\n', text_end - s); |
| 5843 | if (word_wrap_enabled) |
| 5844 | { |
| 5845 | |
| 5846 | |
| 5847 | |
| 5848 | s = ImFontCalcWordWrapPositionEx(this, size, s, line_end ? line_end : text_end, wrap_width, flags); |
| 5849 | s = ImTextCalcWordWrapNextLineStart(s, text_end, flags); |
| 5850 | } |
| 5851 | else |
| 5852 | { |
| 5853 | s = line_end ? line_end + 1 : text_end; |
| 5854 | } |
| 5855 | y += line_height; |
| 5856 | } |
| 5857 | |
| 5858 | |
| 5859 | |
| 5860 | if (text_end - s > 10000 && !word_wrap_enabled) |
| 5861 | { |
| 5862 | const char* s_end = s; |
| 5863 | float y_end = y; |
| 5864 | while (y_end < clip_rect.w && s_end < text_end) |
| 5865 | { |
| 5866 | s_end = (const char*)ImMemchr(s_end, '\n', text_end - s_end); |
| 5867 | s_end = s_end ? s_end + 1 : text_end; |
| 5868 | y_end += line_height; |
| 5869 | } |
| 5870 | text_end = s_end; |
| 5871 | } |
| 5872 | if (s == text_end) |
| 5873 | return; |
| 5874 | |
| 5875 | |
| 5876 | const int vtx_count_max = (int)(text_end - s) * 4; |
| 5877 | const int idx_count_max = (int)(text_end - s) * 6; |
| 5878 | const int idx_expected_size = draw_list->IdxBuffer.Size + idx_count_max; |
| 5879 | draw_list->PrimReserve(idx_count_max, vtx_count_max); |
| 5880 | ImDrawVert* vtx_write = draw_list->_VtxWritePtr; |
| 5881 | ImDrawIdx* idx_write = draw_list->_IdxWritePtr; |
| 5882 | unsigned int vtx_index = draw_list->_VtxCurrentIdx; |
| 5883 | const int cmd_count = draw_list->CmdBuffer.Size; |
| 5884 | const bool cpu_fine_clip = (flags & ImDrawTextFlags_CpuFineClip) != 0; |
| 5885 | |
| 5886 | const ImU32 col_untinted = col | ~IM_COL32_A_MASK; |
| 5887 | const char* word_wrap_eol = NULL; |
| 5888 | |
| 5889 | while (s < text_end) |
| 5890 | { |
| 5891 | if (word_wrap_enabled) |
| 5892 | { |
| 5893 | |
| 5894 | if (!word_wrap_eol) |
| 5895 | word_wrap_eol = ImFontCalcWordWrapPositionEx(this, size, s, text_end, wrap_width - (x - origin_x), flags); |
| 5896 | |
| 5897 | if (s >= word_wrap_eol) |
| 5898 | { |
| 5899 | x = origin_x; |
| 5900 | y += line_height; |
| 5901 | if (y > clip_rect.w) |
| 5902 | break; |
| 5903 | word_wrap_eol = NULL; |
| 5904 | s = ImTextCalcWordWrapNextLineStart(s, text_end, flags); |
| 5905 | continue; |
| 5906 | } |
| 5907 | } |
| 5908 | |
| 5909 | |
| 5910 | unsigned int c = (unsigned int)*s; |
| 5911 | if (c < 0x80) |
| 5912 | s += 1; |
| 5913 | else |
| 5914 | s += ImTextCharFromUtf8(&c, s, text_end); |
| 5915 | |
| 5916 | if (c < 32) |
| 5917 | { |
| 5918 | if (c == '\n') |
| 5919 | { |
| 5920 | x = origin_x; |
| 5921 | y += line_height; |
| 5922 | if (y > clip_rect.w) |
| 5923 | break; |
| 5924 | continue; |
| 5925 | } |
| 5926 | if (c == '\r') |
| 5927 | continue; |
| 5928 | } |
| 5929 | |
| 5930 | const ImFontGlyph* glyph = baked->FindGlyph((ImWchar)c); |
| 5931 | |
| 5932 | |
| 5933 | |
| 5934 | float char_width = glyph->AdvanceX * scale; |
| 5935 | if (glyph->Visible) |
| 5936 | { |
| 5937 | |
| 5938 | float x1 = x + glyph->X0 * scale; |
| 5939 | float x2 = x + glyph->X1 * scale; |
| 5940 | float y1 = y + glyph->Y0 * scale; |
| 5941 | float y2 = y + glyph->Y1 * scale; |
| 5942 | if (x1 <= clip_rect.z && x2 >= clip_rect.x) |
| 5943 | { |
| 5944 | |
| 5945 | float u1 = glyph->U0; |
| 5946 | float v1 = glyph->V0; |
| 5947 | float u2 = glyph->U1; |
| 5948 | float v2 = glyph->V1; |
| 5949 | |
| 5950 | |
| 5951 | if (cpu_fine_clip) |
| 5952 | { |
| 5953 | if (x1 < clip_rect.x) |
| 5954 | { |
| 5955 | u1 = u1 + (1.0f - (x2 - clip_rect.x) / (x2 - x1)) * (u2 - u1); |
| 5956 | x1 = clip_rect.x; |
| 5957 | } |
| 5958 | if (y1 < clip_rect.y) |
| 5959 | { |
| 5960 | v1 = v1 + (1.0f - (y2 - clip_rect.y) / (y2 - y1)) * (v2 - v1); |
| 5961 | y1 = clip_rect.y; |
| 5962 | } |
| 5963 | if (x2 > clip_rect.z) |
| 5964 | { |
| 5965 | u2 = u1 + ((clip_rect.z - x1) / (x2 - x1)) * (u2 - u1); |
| 5966 | x2 = clip_rect.z; |
| 5967 | } |
| 5968 | if (y2 > clip_rect.w) |
| 5969 | { |
| 5970 | v2 = v1 + ((clip_rect.w - y1) / (y2 - y1)) * (v2 - v1); |
| 5971 | y2 = clip_rect.w; |
| 5972 | } |
| 5973 | if (y1 >= y2) |
| 5974 | { |
| 5975 | x += char_width; |
| 5976 | continue; |
| 5977 | } |
| 5978 | } |
| 5979 | |
| 5980 | |
| 5981 | ImU32 glyph_col = glyph->Colored ? col_untinted : col; |
| 5982 | |
| 5983 | |
| 5984 | { |
| 5985 | vtx_write[0].pos.x = x1; vtx_write[0].pos.y = y1; vtx_write[0].col = glyph_col; vtx_write[0].uv.x = u1; vtx_write[0].uv.y = v1; |
| 5986 | vtx_write[1].pos.x = x2; vtx_write[1].pos.y = y1; vtx_write[1].col = glyph_col; vtx_write[1].uv.x = u2; vtx_write[1].uv.y = v1; |
| 5987 | vtx_write[2].pos.x = x2; vtx_write[2].pos.y = y2; vtx_write[2].col = glyph_col; vtx_write[2].uv.x = u2; vtx_write[2].uv.y = v2; |
| 5988 | vtx_write[3].pos.x = x1; vtx_write[3].pos.y = y2; vtx_write[3].col = glyph_col; vtx_write[3].uv.x = u1; vtx_write[3].uv.y = v2; |
| 5989 | idx_write[0] = (ImDrawIdx)(vtx_index); idx_write[1] = (ImDrawIdx)(vtx_index + 1); idx_write[2] = (ImDrawIdx)(vtx_index + 2); |
| 5990 | idx_write[3] = (ImDrawIdx)(vtx_index); idx_write[4] = (ImDrawIdx)(vtx_index + 2); idx_write[5] = (ImDrawIdx)(vtx_index + 3); |
| 5991 | vtx_write += 4; |
| 5992 | vtx_index += 4; |
| 5993 | idx_write += 6; |
| 5994 | } |
| 5995 | } |
| 5996 | } |
| 5997 | x += char_width; |
| 5998 | } |
| 5999 | |
| 6000 | |
| 6001 | if (cmd_count != draw_list->CmdBuffer.Size) |
| 6002 | { |
| 6003 | IM_ASSERT(draw_list->CmdBuffer[draw_list->CmdBuffer.Size - 1].ElemCount == 0); |
| 6004 | draw_list->CmdBuffer.pop_back(); |
| 6005 | draw_list->PrimUnreserve(idx_count_max, vtx_count_max); |
| 6006 | draw_list->AddDrawCmd(); |
| 6007 | |
| 6008 | |
| 6009 | goto begin; |
| 6010 | |
| 6011 | |
| 6012 | } |
| 6013 | |
| 6014 | |
| 6015 | draw_list->VtxBuffer.Size = (int)(vtx_write - draw_list->VtxBuffer.Data); |
| 6016 | draw_list->IdxBuffer.Size = (int)(idx_write - draw_list->IdxBuffer.Data); |
| 6017 | draw_list->CmdBuffer[draw_list->CmdBuffer.Size - 1].ElemCount -= (idx_expected_size - draw_list->IdxBuffer.Size); |
| 6018 | draw_list->_VtxWritePtr = vtx_write; |
| 6019 | draw_list->_IdxWritePtr = idx_write; |
| 6020 | draw_list->_VtxCurrentIdx = vtx_index; |
| 6021 | } |
| 6022 | |
| 6023 | |
| 6024 | |
| 6025 | |
| 6026 | |
| 6027 | |
| 6028 | |
| 6029 | |
| 6030 | |
| 6031 | |
| 6032 | |
| 6033 | |
| 6034 | |
| 6035 | |
| 6036 | |
| 6037 | |
| 6038 | |
| 6039 | |
| 6040 | void ImGui::RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale) |
| 6041 | { |
| 6042 | const float h = draw_list->_Data->FontSize * 1.00f; |
| 6043 | float r = h * 0.40f * scale; |
| 6044 | ImVec2 center = pos + ImVec2(h * 0.50f, h * 0.50f * scale); |
| 6045 | |
| 6046 | ImVec2 a, b, c; |
| 6047 | switch (dir) |
| 6048 | { |
| 6049 | case ImGuiDir_Up: |
| 6050 | case ImGuiDir_Down: |
| 6051 | if (dir == ImGuiDir_Up) r = -r; |
| 6052 | a = ImVec2(+0.000f, +0.750f) * r; |
| 6053 | b = ImVec2(-0.866f, -0.750f) * r; |
| 6054 | c = ImVec2(+0.866f, -0.750f) * r; |
| 6055 | break; |
| 6056 | case ImGuiDir_Left: |
| 6057 | case ImGuiDir_Right: |
| 6058 | if (dir == ImGuiDir_Left) r = -r; |
| 6059 | a = ImVec2(+0.750f, +0.000f) * r; |
| 6060 | b = ImVec2(-0.750f, +0.866f) * r; |
| 6061 | c = ImVec2(-0.750f, -0.866f) * r; |
| 6062 | break; |
| 6063 | case ImGuiDir_None: |
| 6064 | case ImGuiDir_COUNT: |
| 6065 | IM_ASSERT(0); |
| 6066 | break; |
| 6067 | } |
| 6068 | draw_list->AddTriangleFilled(center + a, center + b, center + c, col); |
| 6069 | } |
| 6070 | |
| 6071 | void ImGui::RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col) |
| 6072 | { |
| 6073 | |
| 6074 | float font_size = draw_list->_Data->FontSize; |
| 6075 | draw_list->AddCircleFilled(pos, font_size * 0.20f, col, (font_size < 22) ? 8 : (font_size < 40) ? 12 : 0); |
| 6076 | } |
| 6077 | |
| 6078 | void ImGui::RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz) |
| 6079 | { |
| 6080 | float thickness = ImMax(sz / 5.0f, 1.0f); |
| 6081 | sz -= thickness * 0.5f; |
| 6082 | pos += ImVec2(thickness * 0.25f, thickness * 0.25f); |
| 6083 | |
| 6084 | float third = sz / 3.0f; |
| 6085 | float bx = pos.x + third; |
| 6086 | float by = pos.y + sz - third * 0.5f; |
| 6087 | draw_list->PathLineTo(ImVec2(bx - third, by - third)); |
| 6088 | draw_list->PathLineTo(ImVec2(bx, by)); |
| 6089 | draw_list->PathLineTo(ImVec2(bx + third * 2.0f, by - third * 2.0f)); |
| 6090 | draw_list->PathStroke(col, thickness); |
| 6091 | } |
| 6092 | |
| 6093 | |
| 6094 | void ImGui::RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col) |
| 6095 | { |
| 6096 | switch (direction) |
| 6097 | { |
| 6098 | case ImGuiDir_Left: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col); return; |
| 6099 | case ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return; |
| 6100 | case ImGuiDir_Up: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col); return; |
| 6101 | case ImGuiDir_Down: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return; |
| 6102 | case ImGuiDir_None: case ImGuiDir_COUNT: break; |
| 6103 | } |
| 6104 | } |
| 6105 | |
| 6106 | |
| 6107 | |
| 6108 | void ImGui::RenderArrowDockMenu(ImDrawList* draw_list, ImVec2 p_min, float sz, ImU32 col) |
| 6109 | { |
| 6110 | draw_list->AddRectFilled(p_min + ImVec2(sz * 0.20f, sz * 0.15f), p_min + ImVec2(sz * 0.80f, sz * 0.30f), col); |
| 6111 | RenderArrowPointingAt(draw_list, p_min + ImVec2(sz * 0.50f, sz * 0.85f), ImVec2(sz * 0.30f, sz * 0.40f), ImGuiDir_Down, col); |
| 6112 | } |
| 6113 | |
| 6114 | static inline float ImAcos01(float x) |
| 6115 | { |
| 6116 | if (x <= 0.0f) return IM_PI * 0.5f; |
| 6117 | if (x >= 1.0f) return 0.0f; |
| 6118 | return ImAcos(x); |
| 6119 | |
| 6120 | } |
| 6121 | |
| 6122 | |
| 6123 | |
| 6124 | |
| 6125 | void ImGui::RenderRectFilledInRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float fill_x0, float fill_x1, float rounding) |
| 6126 | { |
| 6127 | if (fill_x0 > fill_x1) |
| 6128 | return; |
| 6129 | |
| 6130 | ImVec2 p0 = ImVec2(fill_x0, rect.Min.y); |
| 6131 | ImVec2 p1 = ImVec2(fill_x1, rect.Max.y); |
| 6132 | if (rounding == 0.0f) |
| 6133 | { |
| 6134 | draw_list->AddRectFilled(p0, p1, col, 0.0f); |
| 6135 | return; |
| 6136 | } |
| 6137 | |
| 6138 | rounding = ImClamp(ImMin((rect.Max.x - rect.Min.x) * 0.5f, (rect.Max.y - rect.Min.y) * 0.5f) - 1.0f, 0.0f, rounding); |
| 6139 | const float inv_rounding = 1.0f / rounding; |
| 6140 | const float arc0_b = ImAcos01(1.0f - (p0.x - rect.Min.x) * inv_rounding); |
| 6141 | const float arc0_e = ImAcos01(1.0f - (p1.x - rect.Min.x) * inv_rounding); |
| 6142 | const float half_pi = IM_PI * 0.5f; |
| 6143 | const float x0 = ImMax(p0.x, rect.Min.x + rounding); |
| 6144 | if (arc0_b == arc0_e) |
| 6145 | { |
| 6146 | draw_list->PathLineTo(ImVec2(x0, p1.y)); |
| 6147 | draw_list->PathLineTo(ImVec2(x0, p0.y)); |
| 6148 | } |
| 6149 | else if (arc0_b == 0.0f && arc0_e == half_pi) |
| 6150 | { |
| 6151 | draw_list->PathArcToFast(ImVec2(x0, p1.y - rounding), rounding, 3, 6); |
| 6152 | draw_list->PathArcToFast(ImVec2(x0, p0.y + rounding), rounding, 6, 9); |
| 6153 | } |
| 6154 | else |
| 6155 | { |
| 6156 | draw_list->PathArcTo(ImVec2(x0, p1.y - rounding), rounding, IM_PI - arc0_e, IM_PI - arc0_b); |
| 6157 | draw_list->PathArcTo(ImVec2(x0, p0.y + rounding), rounding, IM_PI + arc0_b, IM_PI + arc0_e); |
| 6158 | } |
| 6159 | if (p1.x > rect.Min.x + rounding) |
| 6160 | { |
| 6161 | const float arc1_b = ImAcos01(1.0f - (rect.Max.x - p1.x) * inv_rounding); |
| 6162 | const float arc1_e = ImAcos01(1.0f - (rect.Max.x - p0.x) * inv_rounding); |
| 6163 | const float x1 = ImMin(p1.x, rect.Max.x - rounding); |
| 6164 | if (arc1_b == arc1_e) |
| 6165 | { |
| 6166 | draw_list->PathLineTo(ImVec2(x1, p0.y)); |
| 6167 | draw_list->PathLineTo(ImVec2(x1, p1.y)); |
| 6168 | } |
| 6169 | else if (arc1_b == 0.0f && arc1_e == half_pi) |
| 6170 | { |
| 6171 | draw_list->PathArcToFast(ImVec2(x1, p0.y + rounding), rounding, 9, 12); |
| 6172 | draw_list->PathArcToFast(ImVec2(x1, p1.y - rounding), rounding, 0, 3); |
| 6173 | } |
| 6174 | else |
| 6175 | { |
| 6176 | draw_list->PathArcTo(ImVec2(x1, p0.y + rounding), rounding, -arc1_e, -arc1_b); |
| 6177 | draw_list->PathArcTo(ImVec2(x1, p1.y - rounding), rounding, +arc1_b, +arc1_e); |
| 6178 | } |
| 6179 | } |
| 6180 | draw_list->PathFillConvex(col); |
| 6181 | } |
| 6182 | |
| 6183 | void ImGui::RenderRectFilledWithHole(ImDrawList* draw_list, const ImRect& outer, const ImRect& inner, ImU32 col, float rounding) |
| 6184 | { |
| 6185 | const bool fill_L = (inner.Min.x > outer.Min.x); |
| 6186 | const bool fill_R = (inner.Max.x < outer.Max.x); |
| 6187 | const bool fill_U = (inner.Min.y > outer.Min.y); |
| 6188 | const bool fill_D = (inner.Max.y < outer.Max.y); |
| 6189 | if (fill_L) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Min.y), ImVec2(inner.Min.x, inner.Max.y), col, rounding, ImDrawFlags_RoundCornersNone | (fill_U ? 0 : ImDrawFlags_RoundCornersTopLeft) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomLeft)); |
| 6190 | if (fill_R) draw_list->AddRectFilled(ImVec2(inner.Max.x, inner.Min.y), ImVec2(outer.Max.x, inner.Max.y), col, rounding, ImDrawFlags_RoundCornersNone | (fill_U ? 0 : ImDrawFlags_RoundCornersTopRight) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomRight)); |
| 6191 | if (fill_U) draw_list->AddRectFilled(ImVec2(inner.Min.x, outer.Min.y), ImVec2(inner.Max.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersNone | (fill_L ? 0 : ImDrawFlags_RoundCornersTopLeft) | (fill_R ? 0 : ImDrawFlags_RoundCornersTopRight)); |
| 6192 | if (fill_D) draw_list->AddRectFilled(ImVec2(inner.Min.x, inner.Max.y), ImVec2(inner.Max.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersNone | (fill_L ? 0 : ImDrawFlags_RoundCornersBottomLeft) | (fill_R ? 0 : ImDrawFlags_RoundCornersBottomRight)); |
| 6193 | if (fill_L && fill_U) draw_list->AddRectFilled(ImVec2(outer.Min.x, outer.Min.y), ImVec2(inner.Min.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopLeft); |
| 6194 | if (fill_R && fill_U) draw_list->AddRectFilled(ImVec2(inner.Max.x, outer.Min.y), ImVec2(outer.Max.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopRight); |
| 6195 | if (fill_L && fill_D) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Max.y), ImVec2(inner.Min.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersBottomLeft); |
| 6196 | if (fill_R && fill_D) draw_list->AddRectFilled(ImVec2(inner.Max.x, inner.Max.y), ImVec2(outer.Max.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersBottomRight); |
| 6197 | } |
| 6198 | |
| 6199 | ImDrawFlags ImGui::CalcRoundingFlagsForRectInRect(const ImRect& r_in, const ImRect& r_outer, float threshold) |
| 6200 | { |
| 6201 | bool round_l = r_in.Min.x <= r_outer.Min.x + threshold; |
| 6202 | bool round_r = r_in.Max.x >= r_outer.Max.x - threshold; |
| 6203 | bool round_t = r_in.Min.y <= r_outer.Min.y + threshold; |
| 6204 | bool round_b = r_in.Max.y >= r_outer.Max.y - threshold; |
| 6205 | return ImDrawFlags_RoundCornersNone |
| 6206 | | ((round_t && round_l) ? ImDrawFlags_RoundCornersTopLeft : 0) | ((round_t && round_r) ? ImDrawFlags_RoundCornersTopRight : 0) |
| 6207 | | ((round_b && round_l) ? ImDrawFlags_RoundCornersBottomLeft : 0) | ((round_b && round_r) ? ImDrawFlags_RoundCornersBottomRight : 0); |
| 6208 | } |
| 6209 | |
| 6210 | |
| 6211 | |
| 6212 | |
| 6213 | |
| 6214 | void ImGui::RenderColorRectWithAlphaCheckerboard(ImDrawList* draw_list, ImVec2 p_min, ImVec2 p_max, ImU32 col, float grid_step, ImVec2 grid_off, float rounding, ImDrawFlags flags) |
| 6215 | { |
| 6216 | if ((flags & ImDrawFlags_RoundCornersMask_) == 0) |
| 6217 | flags = ImDrawFlags_RoundCornersDefault_; |
| 6218 | if (((col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT) < 0xFF) |
| 6219 | { |
| 6220 | ImU32 col_bg1 = GetColorU32(ImAlphaBlendColors(IM_COL32(128, 128, 128, 255), col)); |
| 6221 | ImU32 col_bg2 = GetColorU32(ImAlphaBlendColors(IM_COL32(204, 204, 204, 255), col)); |
| 6222 | draw_list->AddRectFilled(p_min, p_max, col_bg1, rounding, flags); |
| 6223 | |
| 6224 | int yi = 0; |
| 6225 | for (float y = p_min.y + grid_off.y; y < p_max.y; y += grid_step, yi++) |
| 6226 | { |
| 6227 | float y1 = ImClamp(y, p_min.y, p_max.y), y2 = ImMin(y + grid_step, p_max.y); |
| 6228 | if (y2 <= y1) |
| 6229 | continue; |
| 6230 | for (float x = p_min.x + grid_off.x + ((yi ^ 1) & 1) * grid_step; x < p_max.x; x += grid_step * 2.0f) |
| 6231 | { |
| 6232 | float x1 = ImClamp(x, p_min.x, p_max.x), x2 = ImMin(x + grid_step, p_max.x); |
| 6233 | if (x2 <= x1) |
| 6234 | continue; |
| 6235 | ImDrawFlags cell_flags = ImDrawFlags_RoundCornersNone; |
| 6236 | if (y1 <= p_min.y) { if (x1 <= p_min.x) cell_flags |= ImDrawFlags_RoundCornersTopLeft; if (x2 >= p_max.x) cell_flags |= ImDrawFlags_RoundCornersTopRight; } |
| 6237 | if (y2 >= p_max.y) { if (x1 <= p_min.x) cell_flags |= ImDrawFlags_RoundCornersBottomLeft; if (x2 >= p_max.x) cell_flags |= ImDrawFlags_RoundCornersBottomRight; } |
| 6238 | |
| 6239 | |
| 6240 | cell_flags = (flags == ImDrawFlags_RoundCornersNone || cell_flags == ImDrawFlags_RoundCornersNone) ? ImDrawFlags_RoundCornersNone : (cell_flags & flags); |
| 6241 | draw_list->AddRectFilled(ImVec2(x1, y1), ImVec2(x2, y2), col_bg2, rounding, cell_flags); |
| 6242 | } |
| 6243 | } |
| 6244 | } |
| 6245 | else |
| 6246 | { |
| 6247 | draw_list->AddRectFilled(p_min, p_max, col, rounding, flags); |
| 6248 | } |
| 6249 | } |
| 6250 | |
| 6251 | |
| 6252 | |
| 6253 | |
| 6254 | |
| 6255 | |
| 6256 | |
| 6257 | |
| 6258 | |
| 6259 | |
| 6260 | static unsigned int stb_decompress_length(const unsigned char *input) |
| 6261 | { |
| 6262 | return (input[8] << 24) + (input[9] << 16) + (input[10] << 8) + input[11]; |
| 6263 | } |
| 6264 | |
| 6265 | static unsigned char *stb__barrier_out_e, *stb__barrier_out_b; |
| 6266 | static const unsigned char *stb__barrier_in_b; |
| 6267 | static unsigned char *stb__dout; |
| 6268 | static void stb__match(const unsigned char *data, unsigned int length) |
| 6269 | { |
| 6270 | |
| 6271 | IM_ASSERT(stb__dout + length <= stb__barrier_out_e); |
| 6272 | if (stb__dout + length > stb__barrier_out_e) { stb__dout += length; return; } |
| 6273 | if (data < stb__barrier_out_b) { stb__dout = stb__barrier_out_e+1; return; } |
| 6274 | while (length--) *stb__dout++ = *data++; |
| 6275 | } |
| 6276 | |
| 6277 | static void stb__lit(const unsigned char *data, unsigned int length) |
| 6278 | { |
| 6279 | IM_ASSERT(stb__dout + length <= stb__barrier_out_e); |
| 6280 | if (stb__dout + length > stb__barrier_out_e) { stb__dout += length; return; } |
| 6281 | if (data < stb__barrier_in_b) { stb__dout = stb__barrier_out_e+1; return; } |
| 6282 | memcpy(stb__dout, data, length); |
| 6283 | stb__dout += length; |
| 6284 | } |
| 6285 | |
| 6286 | #define stb__in2(x) ((i[x] << 8) + i[(x)+1]) |
| 6287 | #define stb__in3(x) ((i[x] << 16) + stb__in2((x)+1)) |
| 6288 | #define stb__in4(x) ((i[x] << 24) + stb__in3((x)+1)) |
| 6289 | |
| 6290 | static const unsigned char *stb_decompress_token(const unsigned char *i) |
| 6291 | { |
| 6292 | if (*i >= 0x20) { |
| 6293 | if (*i >= 0x80) stb__match(stb__dout-i[1]-1, i[0] - 0x80 + 1), i += 2; |
| 6294 | else if (*i >= 0x40) stb__match(stb__dout-(stb__in2(0) - 0x4000 + 1), i[2]+1), i += 3; |
| 6295 | else stb__lit(i+1, i[0] - 0x20 + 1), i += 1 + (i[0] - 0x20 + 1); |
| 6296 | } else { |
| 6297 | if (*i >= 0x18) stb__match(stb__dout-(stb__in3(0) - 0x180000 + 1), i[3]+1), i += 4; |
| 6298 | else if (*i >= 0x10) stb__match(stb__dout-(stb__in3(0) - 0x100000 + 1), stb__in2(3)+1), i += 5; |
| 6299 | else if (*i >= 0x08) stb__lit(i+2, stb__in2(0) - 0x0800 + 1), i += 2 + (stb__in2(0) - 0x0800 + 1); |
| 6300 | else if (*i == 0x07) stb__lit(i+3, stb__in2(1) + 1), i += 3 + (stb__in2(1) + 1); |
| 6301 | else if (*i == 0x06) stb__match(stb__dout-(stb__in3(1)+1), i[4]+1), i += 5; |
| 6302 | else if (*i == 0x04) stb__match(stb__dout-(stb__in3(1)+1), stb__in2(4)+1), i += 6; |
| 6303 | } |
| 6304 | return i; |
| 6305 | } |
| 6306 | |
| 6307 | static unsigned int stb_adler32(unsigned int adler32, unsigned char *buffer, unsigned int buflen) |
| 6308 | { |
| 6309 | const unsigned long ADLER_MOD = 65521; |
| 6310 | unsigned long s1 = adler32 & 0xffff, s2 = adler32 >> 16; |
| 6311 | unsigned long blocklen = buflen % 5552; |
| 6312 | |
| 6313 | unsigned long i; |
| 6314 | while (buflen) { |
| 6315 | for (i=0; i + 7 < blocklen; i += 8) { |
| 6316 | s1 += buffer[0], s2 += s1; |
| 6317 | s1 += buffer[1], s2 += s1; |
| 6318 | s1 += buffer[2], s2 += s1; |
| 6319 | s1 += buffer[3], s2 += s1; |
| 6320 | s1 += buffer[4], s2 += s1; |
| 6321 | s1 += buffer[5], s2 += s1; |
| 6322 | s1 += buffer[6], s2 += s1; |
| 6323 | s1 += buffer[7], s2 += s1; |
| 6324 | |
| 6325 | buffer += 8; |
| 6326 | } |
| 6327 | |
| 6328 | for (; i < blocklen; ++i) |
| 6329 | s1 += *buffer++, s2 += s1; |
| 6330 | |
| 6331 | s1 %= ADLER_MOD, s2 %= ADLER_MOD; |
| 6332 | buflen -= blocklen; |
| 6333 | blocklen = 5552; |
| 6334 | } |
| 6335 | return (unsigned int)(s2 << 16) + (unsigned int)s1; |
| 6336 | } |
| 6337 | |
| 6338 | static unsigned int stb_decompress(unsigned char *output, const unsigned char *i, unsigned int ) |
| 6339 | { |
| 6340 | if (stb__in4(0) != 0x57bC0000) return 0; |
| 6341 | if (stb__in4(4) != 0) return 0; |
| 6342 | const unsigned int olen = stb_decompress_length(i); |
| 6343 | stb__barrier_in_b = i; |
| 6344 | stb__barrier_out_e = output + olen; |
| 6345 | stb__barrier_out_b = output; |
| 6346 | i += 16; |
| 6347 | |
| 6348 | stb__dout = output; |
| 6349 | for (;;) { |
| 6350 | const unsigned char *old_i = i; |
| 6351 | i = stb_decompress_token(i); |
| 6352 | if (i == old_i) { |
| 6353 | if (*i == 0x05 && i[1] == 0xfa) { |
| 6354 | IM_ASSERT(stb__dout == output + olen); |
| 6355 | if (stb__dout != output + olen) return 0; |
| 6356 | if (stb_adler32(1, output, olen) != (unsigned int) stb__in4(2)) |
| 6357 | return 0; |
| 6358 | return olen; |
| 6359 | } else { |
| 6360 | IM_ASSERT(0); |
| 6361 | return 0; |
| 6362 | } |
| 6363 | } |
| 6364 | IM_ASSERT(stb__dout <= output + olen); |
| 6365 | if (stb__dout > output + olen) |
| 6366 | return 0; |
| 6367 | } |
| 6368 | } |
| 6369 | |
| 6370 | |
| 6371 | |
| 6372 | |
| 6373 | |
| 6374 | |
| 6375 | |
| 6376 | |
| 6377 | #if !defined(IMGUI_DISABLE_DEFAULT_FONT) && !defined(IMGUI_DISABLE_DEFAULT_FONT_BITMAP) |
| 6378 | |
| 6379 | |
| 6380 | |
| 6381 | static const unsigned int proggy_clean_ttf_compressed_size = 9583; |
| 6382 | static const unsigned char proggy_clean_ttf_compressed_data[9583] = |
| 6383 | { |
| 6384 | 87,188,0,0,0,0,0,0,0,0,160,248,0,4,0,0,55,0,1,0,0,0,12,0,128,0,3,0,64,79,83,47,50,136,235,116,144,0,0,1,72,130,21,44,78,99,109,97,112,2,18,35,117,0,0,3,160,130,19,36,82,99,118,116, |
| 6385 | 32,130,23,130,2,33,4,252,130,4,56,2,103,108,121,102,18,175,137,86,0,0,7,4,0,0,146,128,104,101,97,100,215,145,102,211,130,27,32,204,130,3,33,54,104,130,16,39,8,66,1,195,0,0,1,4,130, |
| 6386 | 15,59,36,104,109,116,120,138,0,126,128,0,0,1,152,0,0,2,6,108,111,99,97,140,115,176,216,0,0,5,130,30,41,2,4,109,97,120,112,1,174,0,218,130,31,32,40,130,16,44,32,110,97,109,101,37,89, |
| 6387 | 187,150,0,0,153,132,130,19,44,158,112,111,115,116,166,172,131,239,0,0,155,36,130,51,44,210,112,114,101,112,105,2,1,18,0,0,4,244,130,47,32,8,132,203,46,1,0,0,60,85,233,213,95,15,60, |
| 6388 | 245,0,3,8,0,131,0,34,183,103,119,130,63,43,0,0,189,146,166,215,0,0,254,128,3,128,131,111,130,241,33,2,0,133,0,32,1,130,65,38,192,254,64,0,0,3,128,131,16,130,5,32,1,131,7,138,3,33,2, |
| 6389 | 0,130,17,36,1,1,0,144,0,130,121,130,23,38,2,0,8,0,64,0,10,130,9,32,118,130,9,130,6,32,0,130,59,33,1,144,131,200,35,2,188,2,138,130,16,32,143,133,7,37,1,197,0,50,2,0,131,0,33,4,9,131, |
| 6390 | 5,145,3,43,65,108,116,115,0,64,0,0,32,172,8,0,131,0,35,5,0,1,128,131,77,131,3,33,3,128,191,1,33,1,128,130,184,35,0,0,128,0,130,3,131,11,32,1,130,7,33,0,128,131,1,32,1,136,9,32,0,132, |
| 6391 | 15,135,5,32,1,131,13,135,27,144,35,32,1,149,25,131,21,32,0,130,0,32,128,132,103,130,35,132,39,32,0,136,45,136,97,133,17,130,5,33,0,0,136,19,34,0,128,1,133,13,133,5,32,128,130,15,132, |
| 6392 | 131,32,3,130,5,32,3,132,27,144,71,32,0,133,27,130,29,130,31,136,29,131,63,131,3,65,63,5,132,5,132,205,130,9,33,0,0,131,9,137,119,32,3,132,19,138,243,130,55,32,1,132,35,135,19,131,201, |
| 6393 | 136,11,132,143,137,13,130,41,32,0,131,3,144,35,33,128,0,135,1,131,223,131,3,141,17,134,13,136,63,134,15,136,53,143,15,130,96,33,0,3,131,4,130,3,34,28,0,1,130,5,34,0,0,76,130,17,131, |
| 6394 | 9,36,28,0,4,0,48,130,17,46,8,0,8,0,2,0,0,0,127,0,255,32,172,255,255,130,9,34,0,0,129,132,9,130,102,33,223,213,134,53,132,22,33,1,6,132,6,64,4,215,32,129,165,216,39,177,0,1,141,184, |
| 6395 | 1,255,133,134,45,33,198,0,193,1,8,190,244,1,28,1,158,2,20,2,136,2,252,3,20,3,88,3,156,3,222,4,20,4,50,4,80,4,98,4,162,5,22,5,102,5,188,6,18,6,116,6,214,7,56,7,126,7,236,8,78,8,108, |
| 6396 | 8,150,8,208,9,16,9,74,9,136,10,22,10,128,11,4,11,86,11,200,12,46,12,130,12,234,13,94,13,164,13,234,14,80,14,150,15,40,15,176,16,18,16,116,16,224,17,82,17,182,18,4,18,110,18,196,19, |
| 6397 | 76,19,172,19,246,20,88,20,174,20,234,21,64,21,128,21,166,21,184,22,18,22,126,22,198,23,52,23,142,23,224,24,86,24,186,24,238,25,54,25,150,25,212,26,72,26,156,26,240,27,92,27,200,28, |
| 6398 | 4,28,76,28,150,28,234,29,42,29,146,29,210,30,64,30,142,30,224,31,36,31,118,31,166,31,166,32,16,130,1,52,46,32,138,32,178,32,200,33,20,33,116,33,152,33,238,34,98,34,134,35,12,130,1, |
| 6399 | 33,128,35,131,1,60,152,35,176,35,216,36,0,36,74,36,104,36,144,36,174,37,6,37,96,37,130,37,248,37,248,38,88,38,170,130,1,8,190,216,39,64,39,154,40,10,40,104,40,168,41,14,41,32,41,184, |
| 6400 | 41,248,42,54,42,96,42,96,43,2,43,42,43,94,43,172,43,230,44,32,44,52,44,154,45,40,45,92,45,120,45,170,45,232,46,38,46,166,47,38,47,182,47,244,48,94,48,200,49,62,49,180,50,30,50,158, |
| 6401 | 51,30,51,130,51,238,52,92,52,206,53,58,53,134,53,212,54,38,54,114,54,230,55,118,55,216,56,58,56,166,57,18,57,116,57,174,58,46,58,154,59,6,59,124,59,232,60,58,60,150,61,34,61,134,61, |
| 6402 | 236,62,86,62,198,63,42,63,154,64,18,64,106,64,208,65,54,65,162,66,8,66,64,66,122,66,184,66,240,67,98,67,204,68,42,68,138,68,238,69,88,69,182,69,226,70,84,70,180,71,20,71,122,71,218, |
| 6403 | 72,84,72,198,73,64,0,36,70,21,8,8,77,3,0,7,0,11,0,15,0,19,0,23,0,27,0,31,0,35,0,39,0,43,0,47,0,51,0,55,0,59,0,63,0,67,0,71,0,75,0,79,0,83,0,87,0,91,0,95,0,99,0,103,0,107,0,111,0,115, |
| 6404 | 0,119,0,123,0,127,0,131,0,135,0,139,0,143,0,0,17,53,51,21,49,150,3,32,5,130,23,32,33,130,3,211,7,151,115,32,128,133,0,37,252,128,128,2,128,128,190,5,133,74,32,4,133,6,206,5,42,0,7, |
| 6405 | 1,128,0,0,2,0,4,0,0,65,139,13,37,0,1,53,51,21,7,146,3,32,3,130,19,32,1,141,133,32,3,141,14,131,13,38,255,0,128,128,0,6,1,130,84,35,2,128,4,128,140,91,132,89,32,51,65,143,6,139,7,33, |
| 6406 | 1,0,130,57,32,254,130,3,32,128,132,4,32,4,131,14,138,89,35,0,0,24,0,130,0,33,3,128,144,171,66,55,33,148,115,65,187,19,32,5,130,151,143,155,163,39,32,1,136,182,32,253,134,178,132,7, |
| 6407 | 132,200,145,17,32,3,65,48,17,165,17,39,0,0,21,0,128,255,128,3,65,175,17,65,3,27,132,253,131,217,139,201,155,233,155,27,131,67,131,31,130,241,33,255,0,131,181,137,232,132,15,132,4,138, |
| 6408 | 247,34,255,0,128,179,238,32,0,130,0,32,20,65,239,48,33,0,19,67,235,10,32,51,65,203,14,65,215,11,32,7,154,27,135,39,32,33,130,35,33,128,128,130,231,32,253,132,231,32,128,132,232,34, |
| 6409 | 128,128,254,133,13,136,8,32,253,65,186,5,130,36,130,42,176,234,133,231,34,128,0,0,66,215,44,33,0,1,68,235,6,68,211,19,32,49,68,239,14,139,207,139,47,66,13,7,32,51,130,47,33,1,0,130, |
| 6410 | 207,35,128,128,1,0,131,222,131,5,130,212,130,6,131,212,32,0,130,10,133,220,130,233,130,226,32,254,133,255,178,233,39,3,1,128,3,0,2,0,4,68,15,7,68,99,12,130,89,130,104,33,128,4,133, |
| 6411 | 93,130,10,38,0,0,11,1,0,255,0,68,63,16,70,39,9,66,215,8,32,7,68,77,6,68,175,14,32,29,68,195,6,132,7,35,2,0,128,255,131,91,132,4,65,178,5,141,111,67,129,23,165,135,140,107,142,135,33, |
| 6412 | 21,5,69,71,6,131,7,33,1,0,140,104,132,142,130,4,137,247,140,30,68,255,12,39,11,0,128,0,128,3,0,3,69,171,15,67,251,7,65,15,8,66,249,11,65,229,7,67,211,7,66,13,7,35,1,128,128,254,133, |
| 6413 | 93,32,254,131,145,132,4,132,18,32,2,151,128,130,23,34,0,0,9,154,131,65,207,8,68,107,15,68,51,7,32,7,70,59,7,135,121,130,82,32,128,151,111,41,0,0,4,0,128,255,0,1,128,1,137,239,33,0, |
| 6414 | 37,70,145,10,65,77,10,65,212,14,37,0,0,0,5,0,128,66,109,5,70,123,10,33,0,19,72,33,18,133,237,70,209,11,33,0,2,130,113,137,119,136,115,33,1,0,133,43,130,5,34,0,0,10,69,135,6,70,219, |
| 6415 | 13,66,155,7,65,9,12,66,157,11,66,9,11,32,7,130,141,132,252,66,151,9,137,9,66,15,30,36,0,20,0,128,0,130,218,71,11,42,68,51,8,65,141,7,73,19,15,69,47,23,143,39,66,81,7,32,1,66,55,6,34, |
| 6416 | 1,128,128,68,25,5,69,32,6,137,6,136,25,32,254,131,42,32,3,66,88,26,148,26,32,0,130,0,32,14,164,231,70,225,12,66,233,7,67,133,19,71,203,15,130,161,32,255,130,155,32,254,139,127,134, |
| 6417 | 12,164,174,33,0,15,164,159,33,59,0,65,125,20,66,25,7,32,5,68,191,6,66,29,7,144,165,65,105,9,35,128,128,255,0,137,2,133,182,164,169,33,128,128,197,171,130,155,68,235,7,32,21,70,77,19, |
| 6418 | 66,21,10,68,97,8,66,30,5,66,4,43,34,0,17,0,71,19,41,65,253,20,71,25,23,65,91,15,65,115,7,34,2,128,128,66,9,8,130,169,33,1,0,66,212,13,132,28,72,201,43,35,0,0,0,18,66,27,38,76,231,5, |
| 6419 | 68,157,20,135,157,32,7,68,185,13,65,129,28,66,20,5,32,253,66,210,11,65,128,49,133,61,32,0,65,135,6,74,111,37,72,149,12,66,203,19,65,147,19,68,93,7,68,85,8,76,4,5,33,255,0,133,129,34, |
| 6420 | 254,0,128,68,69,8,181,197,34,0,0,12,65,135,32,65,123,20,69,183,27,133,156,66,50,5,72,87,10,67,137,32,33,0,19,160,139,78,251,13,68,55,20,67,119,19,65,91,36,69,177,15,32,254,143,16,65, |
| 6421 | 98,53,32,128,130,0,32,0,66,43,54,70,141,23,66,23,15,131,39,69,47,11,131,15,70,129,19,74,161,9,36,128,255,0,128,254,130,153,65,148,32,67,41,9,34,0,0,4,79,15,5,73,99,10,71,203,8,32,3, |
| 6422 | 72,123,6,72,43,8,32,2,133,56,131,99,130,9,34,0,0,6,72,175,5,73,159,14,144,63,135,197,132,189,133,66,33,255,0,73,6,7,70,137,12,35,0,0,0,10,130,3,73,243,25,67,113,12,65,73,7,69,161,7, |
| 6423 | 138,7,37,21,2,0,128,128,254,134,3,73,116,27,33,128,128,130,111,39,12,0,128,1,0,3,128,2,72,219,21,35,43,0,47,0,67,47,20,130,111,33,21,1,68,167,13,81,147,8,133,230,32,128,77,73,6,32, |
| 6424 | 128,131,142,134,18,130,6,32,255,75,18,12,131,243,37,128,0,128,3,128,3,74,231,21,135,123,32,29,134,107,135,7,32,21,74,117,7,135,7,134,96,135,246,74,103,23,132,242,33,0,10,67,151,28, |
| 6425 | 67,133,20,66,141,11,131,11,32,3,77,71,6,32,128,130,113,32,1,81,4,6,134,218,66,130,24,131,31,34,0,26,0,130,0,77,255,44,83,15,11,148,155,68,13,7,32,49,78,231,18,79,7,11,73,243,11,32, |
| 6426 | 33,65,187,10,130,63,65,87,8,73,239,19,35,0,128,1,0,131,226,32,252,65,100,6,32,128,139,8,33,1,0,130,21,32,253,72,155,44,73,255,20,32,128,71,67,8,81,243,39,67,15,20,74,191,23,68,121, |
| 6427 | 27,32,1,66,150,6,32,254,79,19,11,131,214,32,128,130,215,37,2,0,128,253,0,128,136,5,65,220,24,147,212,130,210,33,0,24,72,219,42,84,255,13,67,119,16,69,245,19,72,225,19,65,3,15,69,93, |
| 6428 | 19,131,55,132,178,71,115,14,81,228,6,142,245,33,253,0,132,43,172,252,65,16,11,75,219,8,65,219,31,66,223,24,75,223,10,33,29,1,80,243,10,66,175,8,131,110,134,203,133,172,130,16,70,30, |
| 6429 | 7,164,183,130,163,32,20,65,171,48,65,163,36,65,143,23,65,151,19,65,147,13,65,134,17,133,17,130,216,67,114,5,164,217,65,137,12,72,147,48,79,71,19,74,169,22,80,251,8,65,173,7,66,157, |
| 6430 | 15,74,173,15,32,254,65,170,8,71,186,45,72,131,6,77,143,40,187,195,152,179,65,123,38,68,215,57,68,179,15,65,85,7,69,187,14,32,21,66,95,15,67,19,25,32,1,83,223,6,32,2,76,240,7,77,166, |
| 6431 | 43,65,8,5,130,206,32,0,67,39,54,143,167,66,255,19,82,193,11,151,47,85,171,5,67,27,17,132,160,69,172,11,69,184,56,66,95,6,33,12,1,130,237,32,2,68,179,27,68,175,16,80,135,15,72,55,7, |
| 6432 | 71,87,12,73,3,12,132,12,66,75,32,76,215,5,169,139,147,135,148,139,81,12,12,81,185,36,75,251,7,65,23,27,76,215,9,87,165,12,65,209,15,72,157,7,65,245,31,32,128,71,128,6,32,1,82,125,5, |
| 6433 | 34,0,128,254,131,169,32,254,131,187,71,180,9,132,27,32,2,88,129,44,32,0,78,47,40,65,79,23,79,171,14,32,21,71,87,8,72,15,14,65,224,33,130,139,74,27,62,93,23,7,68,31,7,75,27,7,139,15, |
| 6434 | 74,3,7,74,23,27,65,165,11,65,177,15,67,123,5,32,1,130,221,32,252,71,96,5,74,12,12,133,244,130,25,34,1,0,128,130,2,139,8,93,26,8,65,9,32,65,57,14,140,14,32,0,73,79,67,68,119,11,135, |
| 6435 | 11,32,51,90,75,14,139,247,65,43,7,131,19,139,11,69,159,11,65,247,6,36,1,128,128,253,0,90,71,9,33,1,0,132,14,32,128,89,93,14,69,133,6,130,44,131,30,131,6,65,20,56,33,0,16,72,179,40, |
| 6436 | 75,47,12,65,215,19,74,95,19,65,43,11,131,168,67,110,5,75,23,17,69,106,6,75,65,5,71,204,43,32,0,80,75,47,71,203,15,159,181,68,91,11,67,197,7,73,101,13,68,85,6,33,128,128,130,214,130, |
| 6437 | 25,32,254,74,236,48,130,194,37,0,18,0,128,255,128,77,215,40,65,139,64,32,51,80,159,10,65,147,39,130,219,84,212,43,130,46,75,19,97,74,33,11,65,201,23,65,173,31,33,1,0,79,133,6,66,150, |
| 6438 | 5,67,75,48,85,187,6,70,207,37,32,71,87,221,13,73,163,14,80,167,15,132,15,83,193,19,82,209,8,78,99,9,72,190,11,77,110,49,89,63,5,80,91,35,99,63,32,70,235,23,81,99,10,69,148,10,65,110, |
| 6439 | 36,32,0,65,99,47,95,219,11,68,171,51,66,87,7,72,57,7,74,45,17,143,17,65,114,50,33,14,0,65,111,40,159,195,98,135,15,35,7,53,51,21,100,78,9,95,146,16,32,254,82,114,6,32,128,67,208,37, |
| 6440 | 130,166,99,79,58,32,17,96,99,14,72,31,19,72,87,31,82,155,7,67,47,14,32,21,131,75,134,231,72,51,17,72,78,8,133,8,80,133,6,33,253,128,88,37,9,66,124,36,72,65,12,134,12,71,55,43,66,139, |
| 6441 | 27,85,135,10,91,33,12,65,35,11,66,131,11,71,32,8,90,127,6,130,244,71,76,11,168,207,33,0,12,66,123,32,32,0,65,183,15,68,135,11,66,111,7,67,235,11,66,111,15,32,254,97,66,12,160,154,67, |
| 6442 | 227,52,80,33,15,87,249,15,93,45,31,75,111,12,93,45,11,77,99,9,160,184,81,31,12,32,15,98,135,30,104,175,7,77,249,36,69,73,15,78,5,12,32,254,66,151,19,34,128,128,4,87,32,12,149,35,133, |
| 6443 | 21,96,151,31,32,19,72,35,5,98,173,15,143,15,32,21,143,99,158,129,33,0,0,65,35,52,65,11,15,147,15,98,75,11,33,1,0,143,151,132,15,32,254,99,200,37,132,43,130,4,39,0,10,0,128,1,128,3, |
| 6444 | 0,104,151,14,97,187,20,69,131,15,67,195,11,87,227,7,33,128,128,132,128,33,254,0,68,131,9,65,46,26,42,0,0,0,7,0,0,255,128,3,128,0,88,223,15,33,0,21,89,61,22,66,209,12,65,2,12,37,0,2, |
| 6445 | 1,0,3,128,101,83,8,36,0,1,53,51,29,130,3,34,21,1,0,66,53,8,32,0,68,215,6,100,55,25,107,111,9,66,193,11,72,167,8,73,143,31,139,31,33,1,0,131,158,32,254,132,5,33,253,128,65,16,9,133, |
| 6446 | 17,89,130,25,141,212,33,0,0,93,39,8,90,131,25,93,39,14,66,217,6,106,179,8,159,181,71,125,15,139,47,138,141,87,11,14,76,23,14,65,231,26,140,209,66,122,8,81,179,5,101,195,26,32,47,74, |
| 6447 | 75,13,69,159,11,83,235,11,67,21,16,136,167,131,106,130,165,130,15,32,128,101,90,24,134,142,32,0,65,103,51,108,23,11,101,231,15,75,173,23,74,237,23,66,15,6,66,46,17,66,58,17,65,105, |
| 6448 | 49,66,247,55,71,179,12,70,139,15,86,229,7,84,167,15,32,1,95,72,12,89,49,6,33,128,128,65,136,38,66,30,9,32,0,100,239,7,66,247,29,70,105,20,65,141,19,69,81,15,130,144,32,128,83,41,5, |
| 6449 | 32,255,131,177,68,185,5,133,126,65,97,37,32,0,130,0,33,21,0,130,55,66,195,28,67,155,13,34,79,0,83,66,213,13,73,241,19,66,59,19,65,125,11,135,201,66,249,16,32,128,66,44,11,66,56,17, |
| 6450 | 68,143,8,68,124,38,67,183,12,96,211,9,65,143,29,112,171,5,32,0,68,131,63,34,33,53,51,71,121,11,32,254,98,251,16,32,253,74,231,10,65,175,37,133,206,37,0,0,8,1,0,0,107,123,11,113,115, |
| 6451 | 9,33,0,1,130,117,131,3,73,103,7,66,51,18,66,44,5,133,75,70,88,5,32,254,65,39,12,68,80,9,34,12,0,128,107,179,28,68,223,6,155,111,86,147,15,32,2,131,82,141,110,33,254,0,130,15,32,4,103, |
| 6452 | 184,15,141,35,87,176,5,83,11,5,71,235,23,114,107,11,65,189,16,70,33,15,86,153,31,135,126,86,145,30,65,183,41,32,0,130,0,32,10,65,183,24,34,35,0,39,67,85,9,65,179,15,143,15,33,1,0,65, |
| 6453 | 28,17,157,136,130,123,32,20,130,3,32,0,97,135,24,115,167,19,80,71,12,32,51,110,163,14,78,35,19,131,19,155,23,77,229,8,78,9,17,151,17,67,231,46,94,135,8,73,31,31,93,215,56,82,171,25, |
| 6454 | 72,77,8,162,179,169,167,99,131,11,69,85,19,66,215,15,76,129,13,68,115,22,72,79,35,67,113,5,34,0,0,19,70,31,46,65,89,52,73,223,15,85,199,33,95,33,8,132,203,73,29,32,67,48,16,177,215, |
| 6455 | 101,13,15,65,141,43,69,141,15,75,89,5,70,0,11,70,235,21,178,215,36,10,0,128,0,0,71,207,24,33,0,19,100,67,6,80,215,11,66,67,7,80,43,12,71,106,7,80,192,5,65,63,5,66,217,26,33,0,13,156, |
| 6456 | 119,68,95,5,72,233,12,134,129,85,81,11,76,165,20,65,43,8,73,136,8,75,10,31,38,128,128,0,0,0,13,1,130,4,32,3,106,235,29,114,179,12,66,131,23,32,7,77,133,6,67,89,12,131,139,116,60,9, |
| 6457 | 89,15,37,32,0,74,15,7,103,11,22,65,35,5,33,55,0,93,81,28,67,239,23,78,85,5,107,93,14,66,84,17,65,193,26,74,183,10,66,67,34,143,135,79,91,15,32,7,117,111,8,75,56,9,84,212,9,154,134, |
| 6458 | 32,0,130,0,32,18,130,3,70,171,41,83,7,16,70,131,19,84,191,15,84,175,19,84,167,30,84,158,12,154,193,68,107,15,33,0,0,65,79,42,65,71,7,73,55,7,118,191,16,83,180,9,32,255,76,166,9,154, |
| 6459 | 141,32,0,130,0,69,195,52,65,225,15,151,15,75,215,31,80,56,10,68,240,17,100,32,9,70,147,39,65,93,12,71,71,41,92,85,15,84,135,23,78,35,15,110,27,10,84,125,8,107,115,29,136,160,38,0,0, |
| 6460 | 14,0,128,255,0,82,155,24,67,239,8,119,255,11,69,131,11,77,29,6,112,31,8,134,27,105,203,8,32,2,75,51,11,75,195,12,74,13,29,136,161,37,128,0,0,0,11,1,130,163,82,115,8,125,191,17,69,35, |
| 6461 | 12,74,137,15,143,15,32,1,65,157,12,136,12,161,142,65,43,40,65,199,6,65,19,24,102,185,11,76,123,11,99,6,12,135,12,32,254,130,8,161,155,101,23,9,39,8,0,0,1,128,3,128,2,78,63,17,72,245, |
| 6462 | 12,67,41,11,90,167,9,32,128,97,49,9,32,128,109,51,14,132,97,81,191,8,130,97,125,99,12,121,35,9,127,75,15,71,79,12,81,151,23,87,97,7,70,223,15,80,245,16,105,97,15,32,254,113,17,6,32, |
| 6463 | 128,130,8,105,105,8,76,122,18,65,243,21,74,63,7,38,4,1,0,255,0,2,0,119,247,28,133,65,32,255,141,91,35,0,0,0,16,67,63,36,34,59,0,63,77,59,9,119,147,11,143,241,66,173,15,66,31,11,67, |
| 6464 | 75,8,81,74,16,32,128,131,255,87,181,42,127,43,5,34,255,128,2,120,235,11,37,19,0,23,0,0,37,109,191,14,118,219,7,127,43,14,65,79,14,35,0,0,0,3,73,91,5,130,5,38,3,0,7,0,11,0,0,70,205, |
| 6465 | 11,88,221,12,32,0,73,135,7,87,15,22,73,135,10,79,153,15,97,71,19,65,49,11,32,1,131,104,121,235,11,80,65,11,142,179,144,14,81,123,46,32,1,88,217,5,112,5,8,65,201,15,83,29,15,122,147, |
| 6466 | 11,135,179,142,175,143,185,67,247,39,66,199,7,35,5,0,128,3,69,203,15,123,163,12,67,127,7,130,119,71,153,10,141,102,70,175,8,32,128,121,235,30,136,89,100,191,11,116,195,11,111,235,15, |
| 6467 | 72,39,7,32,2,97,43,5,132,5,94,67,8,131,8,125,253,10,32,3,65,158,16,146,16,130,170,40,0,21,0,128,0,0,3,128,5,88,219,15,24,64,159,32,135,141,65,167,15,68,163,10,97,73,49,32,255,82,58, |
| 6468 | 7,93,80,8,97,81,16,24,67,87,52,34,0,0,5,130,231,33,128,2,80,51,13,65,129,8,113,61,6,132,175,65,219,5,130,136,77,152,17,32,0,95,131,61,70,215,6,33,21,51,90,53,10,78,97,23,105,77,31, |
| 6469 | 65,117,7,139,75,24,68,195,9,24,64,22,9,33,0,128,130,11,33,128,128,66,25,5,121,38,5,134,5,134,45,66,40,36,66,59,18,34,128,0,0,66,59,81,135,245,123,103,19,120,159,19,77,175,12,33,255, |
| 6470 | 0,87,29,10,94,70,21,66,59,54,39,3,1,128,3,0,2,128,4,24,65,7,15,66,47,7,72,98,12,37,0,0,0,3,1,0,24,65,55,21,131,195,32,1,67,178,6,33,4,0,77,141,8,32,6,131,47,74,67,16,24,69,3,20,24, |
| 6471 | 65,251,7,133,234,130,229,94,108,17,35,0,0,6,0,141,175,86,59,5,162,79,85,166,8,70,112,13,32,13,24,64,67,26,24,71,255,7,123,211,12,80,121,11,69,215,15,66,217,11,69,71,10,131,113,132, |
| 6472 | 126,119,90,9,66,117,19,132,19,32,0,130,0,24,64,47,59,33,7,0,73,227,5,68,243,15,85,13,12,76,37,22,74,254,15,130,138,33,0,4,65,111,6,137,79,65,107,16,32,1,77,200,6,34,128,128,3,75,154, |
| 6473 | 12,37,0,16,0,0,2,0,104,115,36,140,157,68,67,19,68,51,15,106,243,15,134,120,70,37,10,68,27,10,140,152,65,121,24,32,128,94,155,7,67,11,8,24,74,11,25,65,3,12,83,89,18,82,21,37,67,200, |
| 6474 | 5,130,144,24,64,172,12,33,4,0,134,162,74,80,14,145,184,32,0,130,0,69,251,20,32,19,81,243,5,82,143,8,33,5,53,89,203,5,133,112,79,109,15,33,0,21,130,71,80,175,41,36,75,0,79,0,83,121, |
| 6475 | 117,9,87,89,27,66,103,11,70,13,15,75,191,11,135,67,87,97,20,109,203,5,69,246,8,108,171,5,78,195,38,65,51,13,107,203,11,77,3,17,24,75,239,17,65,229,28,79,129,39,130,175,32,128,123,253, |
| 6476 | 7,132,142,24,65,51,15,65,239,41,36,128,128,0,0,13,65,171,5,66,163,28,136,183,118,137,11,80,255,15,67,65,7,74,111,8,32,0,130,157,32,253,24,76,35,10,103,212,5,81,175,9,69,141,7,66,150, |
| 6477 | 29,131,158,24,75,199,28,124,185,7,76,205,15,68,124,14,32,3,123,139,16,130,16,33,128,128,108,199,6,33,0,3,65,191,35,107,11,6,73,197,11,24,70,121,15,83,247,15,24,70,173,23,69,205,14, |
| 6478 | 32,253,131,140,32,254,136,4,94,198,9,32,3,78,4,13,66,127,13,143,13,32,0,130,0,33,16,0,24,69,59,39,109,147,12,76,253,19,24,69,207,15,69,229,15,130,195,71,90,10,139,10,130,152,73,43, |
| 6479 | 40,91,139,10,65,131,37,35,75,0,79,0,84,227,12,143,151,68,25,15,80,9,23,95,169,11,34,128,2,128,112,186,5,130,6,83,161,19,76,50,6,130,37,65,145,44,110,83,5,32,16,67,99,6,71,67,15,76, |
| 6480 | 55,17,140,215,67,97,23,76,69,15,77,237,11,104,211,23,77,238,11,65,154,43,33,0,10,83,15,28,83,13,20,67,145,19,67,141,14,97,149,21,68,9,15,86,251,5,66,207,5,66,27,37,82,1,23,127,71,12, |
| 6481 | 94,235,10,110,175,24,98,243,15,132,154,132,4,24,66,69,10,32,4,67,156,43,130,198,35,2,1,0,4,75,27,9,69,85,9,95,240,7,32,128,130,35,32,28,66,43,40,24,82,63,23,83,123,12,72,231,15,127, |
| 6482 | 59,23,116,23,19,117,71,7,24,77,99,15,67,111,15,71,101,8,36,2,128,128,252,128,127,60,11,32,1,132,16,130,18,141,24,67,107,9,32,3,68,194,15,175,15,38,0,11,0,128,1,128,2,80,63,25,32,0, |
| 6483 | 24,65,73,11,69,185,15,83,243,16,32,0,24,81,165,8,130,86,77,35,6,155,163,88,203,5,24,66,195,30,70,19,19,24,80,133,15,32,1,75,211,8,32,254,108,133,8,79,87,20,65,32,9,41,0,0,7,0,128,0, |
| 6484 | 0,2,128,2,68,87,15,66,1,16,92,201,16,24,76,24,17,133,17,34,128,0,30,66,127,64,34,115,0,119,73,205,9,66,43,11,109,143,15,24,79,203,11,90,143,15,131,15,155,31,65,185,15,86,87,11,35,128, |
| 6485 | 128,253,0,69,7,6,130,213,33,1,0,119,178,15,142,17,66,141,74,83,28,6,36,7,0,0,4,128,82,39,18,76,149,12,67,69,21,32,128,79,118,15,32,0,130,0,32,8,131,206,32,2,79,83,9,100,223,14,102, |
| 6486 | 113,23,115,115,7,24,65,231,12,130,162,32,4,68,182,19,130,102,93,143,8,69,107,29,24,77,255,12,143,197,72,51,7,76,195,15,132,139,85,49,15,130,152,131,18,71,81,23,70,14,11,36,0,10,0,128, |
| 6487 | 2,69,59,9,89,151,15,66,241,11,76,165,12,71,43,15,75,49,13,65,12,23,132,37,32,0,179,115,130,231,95,181,16,132,77,32,254,67,224,8,65,126,20,79,171,8,32,2,89,81,5,75,143,6,80,41,8,34, |
| 6488 | 2,0,128,24,81,72,9,32,0,130,0,35,17,0,0,255,77,99,39,95,65,36,67,109,15,24,69,93,11,77,239,5,95,77,23,35,128,1,0,128,24,86,7,8,132,167,32,2,69,198,41,130,202,33,0,26,120,75,44,24,89, |
| 6489 | 51,15,71,243,12,70,239,11,24,84,3,11,66,7,11,71,255,10,32,21,69,155,35,88,151,12,32,128,74,38,10,65,210,8,74,251,5,65,226,5,75,201,13,32,3,65,9,41,146,41,40,0,0,0,9,1,0,1,0,2,91,99, |
| 6490 | 19,32,35,106,119,13,70,219,15,83,239,12,137,154,32,2,67,252,19,36,128,0,0,4,1,130,196,32,2,130,8,91,107,8,32,0,135,81,24,73,211,8,132,161,73,164,13,36,0,8,0,128,2,105,123,26,139,67, |
| 6491 | 76,99,15,34,1,0,128,135,76,83,156,20,92,104,8,67,251,30,24,86,47,27,123,207,12,24,86,7,15,71,227,8,32,4,65,20,20,131,127,32,0,130,123,32,0,71,223,26,32,19,90,195,22,71,223,15,84,200, |
| 6492 | 6,32,128,133,241,24,84,149,9,67,41,25,36,0,0,0,22,0,88,111,49,32,87,66,21,5,77,3,27,123,75,7,71,143,19,135,183,71,183,19,130,171,74,252,5,131,5,89,87,17,32,1,132,18,130,232,68,11,10, |
| 6493 | 33,1,128,70,208,16,66,230,18,147,18,130,254,223,255,75,27,23,65,59,15,135,39,155,255,34,128,128,254,104,92,8,33,0,128,65,32,11,65,1,58,33,26,0,130,0,72,71,18,78,55,17,76,11,19,86,101, |
| 6494 | 12,75,223,11,89,15,11,24,76,87,15,75,235,15,131,15,72,95,7,85,71,11,72,115,11,73,64,6,34,1,128,128,66,215,9,34,128,254,128,134,14,33,128,255,67,102,5,32,0,130,16,70,38,11,66,26,57, |
| 6495 | 88,11,8,24,76,215,34,78,139,7,95,245,7,32,7,24,73,75,23,32,128,131,167,130,170,101,158,9,82,49,22,118,139,6,32,18,67,155,44,116,187,9,108,55,14,80,155,23,66,131,15,93,77,10,131,168, |
| 6496 | 32,128,73,211,12,24,75,187,22,32,4,96,71,20,67,108,19,132,19,120,207,8,32,5,76,79,15,66,111,21,66,95,8,32,3,190,211,111,3,8,211,212,32,20,65,167,44,34,75,0,79,97,59,13,32,33,112,63, |
| 6497 | 10,65,147,19,69,39,19,143,39,24,66,71,9,130,224,65,185,43,94,176,12,65,183,24,71,38,8,24,72,167,7,65,191,38,136,235,24,96,167,12,65,203,62,115,131,13,65,208,42,175,235,67,127,6,32, |
| 6498 | 4,76,171,29,114,187,5,32,71,65,211,5,65,203,68,72,51,8,164,219,32,0,172,214,71,239,58,78,3,27,66,143,15,77,19,15,147,31,35,33,53,51,21,66,183,10,173,245,66,170,30,150,30,34,0,0,23, |
| 6499 | 80,123,54,76,1,16,73,125,15,82,245,11,167,253,24,76,85,12,70,184,5,32,254,131,185,37,254,0,128,1,0,128,133,16,117,158,18,92,27,38,65,3,17,130,251,35,17,0,128,254,24,69,83,39,140,243, |
| 6500 | 121,73,19,109,167,7,81,41,15,24,95,175,12,102,227,15,121,96,11,24,95,189,7,32,3,145,171,154,17,24,77,47,9,33,0,5,70,71,37,68,135,7,32,29,117,171,11,69,87,15,24,79,97,19,24,79,149,23, |
| 6501 | 131,59,32,1,75,235,5,72,115,11,72,143,7,132,188,71,27,46,131,51,32,0,69,95,6,175,215,32,21,131,167,81,15,19,151,191,151,23,131,215,71,43,5,32,254,24,79,164,24,74,109,8,77,166,13,65, |
| 6502 | 176,26,88,162,5,98,159,6,171,219,120,247,6,79,29,8,99,169,10,103,59,19,65,209,35,131,35,91,25,19,112,94,15,83,36,8,173,229,33,20,0,88,75,43,71,31,12,65,191,71,33,1,0,130,203,32,254, |
| 6503 | 131,4,68,66,7,67,130,6,104,61,13,173,215,38,13,1,0,0,0,2,128,67,111,28,74,129,16,104,35,19,79,161,16,87,14,7,138,143,132,10,67,62,36,114,115,5,162,151,67,33,16,108,181,15,143,151,67, |
| 6504 | 5,5,24,100,242,15,170,153,34,0,0,14,65,51,34,32,55,79,75,9,32,51,74,7,10,65,57,38,132,142,32,254,72,0,14,139,163,32,128,80,254,8,67,158,21,65,63,7,32,4,72,227,27,95,155,12,67,119,19, |
| 6505 | 124,91,24,149,154,72,177,34,97,223,8,155,151,24,108,227,15,88,147,16,72,117,19,68,35,11,92,253,15,70,199,15,24,87,209,17,32,2,87,233,7,32,1,24,88,195,10,119,24,8,32,3,81,227,24,65, |
| 6506 | 125,21,35,128,128,0,25,76,59,48,24,90,187,9,97,235,12,66,61,11,91,105,19,24,79,141,11,24,79,117,15,24,79,129,27,90,53,13,130,13,32,253,131,228,24,79,133,40,69,70,8,66,137,31,65,33, |
| 6507 | 19,96,107,8,68,119,29,66,7,5,68,125,16,65,253,19,65,241,27,24,90,179,13,24,79,143,18,33,128,128,130,246,32,254,130,168,68,154,36,77,51,9,97,47,5,167,195,32,21,131,183,78,239,27,155, |
| 6508 | 195,78,231,14,201,196,77,11,6,32,5,73,111,37,97,247,12,77,19,31,155,207,78,215,19,162,212,69,17,14,66,91,19,80,143,57,78,203,39,159,215,32,128,93,134,8,24,80,109,24,66,113,15,169,215, |
| 6509 | 66,115,6,32,4,69,63,33,32,0,101,113,7,86,227,35,143,211,36,49,53,51,21,1,77,185,14,65,159,28,69,251,34,67,56,8,33,9,0,24,107,175,25,90,111,12,110,251,11,119,189,24,119,187,34,87,15, |
| 6510 | 9,32,4,66,231,37,90,39,7,66,239,8,84,219,15,69,105,23,24,85,27,27,87,31,11,33,1,128,76,94,6,32,1,85,241,7,33,128,128,106,48,10,33,128,128,69,136,11,133,13,24,79,116,49,84,236,8,24, |
| 6511 | 91,87,9,32,5,165,255,69,115,12,66,27,15,159,15,24,72,247,12,74,178,5,24,80,64,15,33,0,128,143,17,77,89,51,130,214,24,81,43,7,170,215,74,49,8,159,199,143,31,139,215,69,143,5,32,254, |
| 6512 | 24,81,50,35,181,217,84,123,70,143,195,159,15,65,187,16,66,123,7,65,175,15,65,193,29,68,207,39,79,27,5,70,131,6,32,4,68,211,33,33,67,0,83,143,14,159,207,143,31,140,223,33,0,128,24,80, |
| 6513 | 82,14,24,93,16,23,32,253,65,195,5,68,227,40,133,214,107,31,7,32,5,67,115,27,87,9,8,107,31,43,66,125,6,32,0,103,177,23,131,127,72,203,36,32,0,110,103,8,155,163,73,135,6,32,19,24,112, |
| 6514 | 99,10,65,71,11,73,143,19,143,31,126,195,5,24,85,21,9,24,76,47,14,32,254,24,93,77,36,68,207,11,39,25,0,0,255,128,3,128,4,66,51,37,95,247,13,82,255,24,76,39,19,147,221,66,85,27,24,118, |
| 6515 | 7,8,24,74,249,12,76,74,8,91,234,8,67,80,17,131,222,33,253,0,121,30,44,73,0,16,69,15,6,32,0,65,23,38,69,231,12,65,179,6,98,131,16,86,31,27,24,108,157,14,80,160,8,24,65,46,17,33,4,0, |
| 6516 | 96,2,18,144,191,65,226,8,68,19,5,171,199,80,9,15,180,199,67,89,5,32,255,24,79,173,28,174,201,24,79,179,50,32,1,24,122,5,10,82,61,10,180,209,83,19,8,32,128,24,80,129,27,111,248,43,131, |
| 6517 | 71,24,115,103,8,67,127,41,78,213,24,100,247,19,66,115,39,75,107,5,32,254,165,219,78,170,40,24,112,163,49,32,1,97,203,6,65,173,64,32,0,83,54,7,133,217,88,37,12,32,254,131,28,33,128, |
| 6518 | 3,67,71,44,84,183,6,32,5,69,223,33,96,7,7,123,137,16,192,211,24,112,14,9,32,255,67,88,29,68,14,10,84,197,38,33,0,22,116,47,50,32,87,106,99,9,116,49,15,89,225,15,97,231,23,70,41,19, |
| 6519 | 82,85,8,93,167,6,32,253,132,236,108,190,7,89,251,5,116,49,58,33,128,128,131,234,32,15,24,74,67,38,70,227,24,24,83,45,23,89,219,12,70,187,12,89,216,19,32,2,69,185,24,141,24,70,143,66, |
| 6520 | 24,82,119,56,78,24,10,32,253,133,149,132,6,24,106,233,7,69,198,48,178,203,81,243,12,68,211,15,106,255,23,66,91,15,69,193,7,100,39,10,24,83,72,16,176,204,33,19,0,88,207,45,68,21,12, |
| 6521 | 68,17,10,65,157,53,68,17,6,32,254,92,67,10,65,161,25,69,182,43,24,118,91,47,69,183,18,181,209,111,253,12,89,159,8,66,112,12,69,184,45,35,0,0,0,9,24,80,227,26,73,185,16,118,195,15,131, |
| 6522 | 15,33,1,0,65,59,15,66,39,27,160,111,66,205,12,148,111,143,110,33,128,128,156,112,24,81,199,8,75,199,23,66,117,20,155,121,32,254,68,126,12,72,213,29,134,239,149,123,89,27,16,148,117, |
| 6523 | 65,245,8,24,71,159,14,141,134,134,28,73,51,55,109,77,15,105,131,11,68,67,11,76,169,27,107,209,12,102,174,8,32,128,72,100,18,116,163,56,79,203,11,75,183,44,85,119,19,71,119,23,151,227, |
| 6524 | 32,1,93,27,8,65,122,5,77,102,8,110,120,20,66,23,8,66,175,17,66,63,12,133,12,79,35,8,74,235,33,67,149,16,69,243,15,78,57,15,69,235,16,67,177,7,151,192,130,23,67,84,29,141,192,174,187, |
| 6525 | 77,67,15,69,11,12,159,187,77,59,10,199,189,24,70,235,50,96,83,19,66,53,23,105,65,19,77,47,12,163,199,66,67,37,78,207,50,67,23,23,174,205,67,228,6,71,107,13,67,22,14,66,85,11,83,187, |
| 6526 | 38,124,47,49,95,7,19,66,83,23,67,23,19,24,96,78,17,80,101,16,71,98,40,33,0,7,88,131,22,24,89,245,12,84,45,12,102,213,5,123,12,9,32,2,126,21,14,43,255,0,128,128,0,0,20,0,128,255,128, |
| 6527 | 3,126,19,39,32,75,106,51,7,113,129,15,24,110,135,19,126,47,15,115,117,11,69,47,11,32,2,109,76,9,102,109,9,32,128,75,2,10,130,21,32,254,69,47,6,32,3,94,217,47,32,0,65,247,10,69,15,46, |
| 6528 | 65,235,31,65,243,15,101,139,10,66,174,14,65,247,16,72,102,28,69,17,14,84,243,9,165,191,88,47,48,66,53,12,32,128,71,108,6,203,193,32,17,75,187,42,73,65,16,65,133,52,114,123,9,167,199, |
| 6529 | 69,21,37,86,127,44,75,171,11,180,197,78,213,12,148,200,81,97,46,24,95,243,9,32,4,66,75,33,113,103,9,87,243,36,143,225,24,84,27,31,90,145,8,148,216,67,49,5,24,84,34,14,75,155,27,67, |
| 6530 | 52,13,140,13,36,0,20,0,128,255,24,135,99,46,88,59,43,155,249,80,165,7,136,144,71,161,23,32,253,132,33,32,254,88,87,44,136,84,35,128,0,0,21,81,103,5,94,47,44,76,51,12,143,197,151,15, |
| 6531 | 65,215,31,24,64,77,13,65,220,20,65,214,14,71,4,40,65,213,13,32,0,130,0,35,21,1,2,0,135,0,34,36,0,72,134,10,36,1,0,26,0,130,134,11,36,2,0,14,0,108,134,11,32,3,138,23,32,4,138,11,34, |
| 6532 | 5,0,20,134,33,34,0,0,6,132,23,32,1,134,15,32,18,130,25,133,11,37,1,0,13,0,49,0,133,11,36,2,0,7,0,38,134,11,36,3,0,17,0,45,134,11,32,4,138,35,36,5,0,10,0,62,134,23,32,6,132,23,36,3, |
| 6533 | 0,1,4,9,130,87,131,167,133,11,133,167,133,11,133,167,133,11,37,3,0,34,0,122,0,133,11,133,167,133,11,133,167,133,11,133,167,34,50,0,48,130,1,34,52,0,47,134,5,8,49,49,0,53,98,121,32, |
| 6534 | 84,114,105,115,116,97,110,32,71,114,105,109,109,101,114,82,101,103,117,108,97,114,84,84,88,32,80,114,111,103,103,121,67,108,101,97,110,84,84,50,48,48,52,47,130,2,53,49,53,0,98,0,121, |
| 6535 | 0,32,0,84,0,114,0,105,0,115,0,116,0,97,0,110,130,15,32,71,132,15,36,109,0,109,0,101,130,9,32,82,130,5,36,103,0,117,0,108,130,29,32,114,130,43,34,84,0,88,130,35,32,80,130,25,34,111, |
| 6536 | 0,103,130,1,34,121,0,67,130,27,32,101,132,59,32,84,130,31,33,0,0,65,155,9,34,20,0,0,65,11,6,130,8,135,2,33,1,1,130,9,8,120,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14, |
| 6537 | 1,15,1,16,1,17,1,18,1,19,1,20,1,21,1,22,1,23,1,24,1,25,1,26,1,27,1,28,1,29,1,30,1,31,1,32,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15,0,16,0,17,0,18,0,19,0,20,0,21,0, |
| 6538 | 22,0,23,0,24,0,25,0,26,0,27,0,28,0,29,0,30,0,31,130,187,8,66,33,0,34,0,35,0,36,0,37,0,38,0,39,0,40,0,41,0,42,0,43,0,44,0,45,0,46,0,47,0,48,0,49,0,50,0,51,0,52,0,53,0,54,0,55,0,56,0, |
| 6539 | 57,0,58,0,59,0,60,0,61,0,62,0,63,0,64,0,65,0,66,130,243,9,75,68,0,69,0,70,0,71,0,72,0,73,0,74,0,75,0,76,0,77,0,78,0,79,0,80,0,81,0,82,0,83,0,84,0,85,0,86,0,87,0,88,0,89,0,90,0,91,0, |
| 6540 | 92,0,93,0,94,0,95,0,96,0,97,1,33,1,34,1,35,1,36,1,37,1,38,1,39,1,40,1,41,1,42,1,43,1,44,1,45,1,46,1,47,1,48,1,49,1,50,1,51,1,52,1,53,1,54,1,55,1,56,1,57,1,58,1,59,1,60,1,61,1,62,1, |
| 6541 | 63,1,64,1,65,0,172,0,163,0,132,0,133,0,189,0,150,0,232,0,134,0,142,0,139,0,157,0,169,0,164,0,239,0,138,0,218,0,131,0,147,0,242,0,243,0,141,0,151,0,136,0,195,0,222,0,241,0,158,0,170, |
| 6542 | 0,245,0,244,0,246,0,162,0,173,0,201,0,199,0,174,0,98,0,99,0,144,0,100,0,203,0,101,0,200,0,202,0,207,0,204,0,205,0,206,0,233,0,102,0,211,0,208,0,209,0,175,0,103,0,240,0,145,0,214,0, |
| 6543 | 212,0,213,0,104,0,235,0,237,0,137,0,106,0,105,0,107,0,109,0,108,0,110,0,160,0,111,0,113,0,112,0,114,0,115,0,117,0,116,0,118,0,119,0,234,0,120,0,122,0,121,0,123,0,125,0,124,0,184,0, |
| 6544 | 161,0,127,0,126,0,128,0,129,0,236,0,238,0,186,14,117,110,105,99,111,100,101,35,48,120,48,48,48,49,141,14,32,50,141,14,32,51,141,14,32,52,141,14,32,53,141,14,32,54,141,14,32,55,141, |
| 6545 | 14,32,56,141,14,32,57,141,14,32,97,141,14,32,98,141,14,32,99,141,14,32,100,141,14,32,101,141,14,32,102,140,14,33,49,48,141,14,141,239,32,49,141,239,32,49,141,239,32,49,141,239,32,49, |
| 6546 | 141,239,32,49,141,239,32,49,141,239,32,49,141,239,32,49,141,239,32,49,141,239,32,49,141,239,32,49,141,239,32,49,141,239,32,49,141,239,45,49,102,6,100,101,108,101,116,101,4,69,117,114, |
| 6547 | 111,140,236,32,56,141,236,32,56,141,236,32,56,141,236,32,56,141,236,32,56,141,236,32,56,141,236,32,56,141,236,32,56,141,236,32,56,141,236,32,56,141,236,32,56,141,236,32,56,141,236, |
| 6548 | 32,56,141,236,32,56,141,236,32,56,65,220,13,32,57,65,220,13,32,57,141,239,32,57,141,239,32,57,141,239,32,57,141,239,32,57,141,239,32,57,141,239,32,57,141,239,32,57,141,239,32,57,141, |
| 6549 | 239,32,57,141,239,32,57,141,239,32,57,141,239,32,57,141,239,32,57,141,239,35,57,102,0,0,5,250,72,249,98,247, |
| 6550 | }; |
| 6551 | |
| 6552 | static const char* GetDefaultCompressedFontDataProggyClean(int* out_size) |
| 6553 | { |
| 6554 | *out_size = proggy_clean_ttf_compressed_size; |
| 6555 | return (const char*)proggy_clean_ttf_compressed_data; |
| 6556 | } |
| 6557 | #endif |
| 6558 | |
| 6559 | |
| 6560 | |
| 6561 | |
| 6562 | |
| 6563 | |
| 6564 | |
| 6565 | |
| 6566 | #if !defined(IMGUI_DISABLE_DEFAULT_FONT) && !defined(IMGUI_DISABLE_DEFAULT_FONT_VECTOR) |
| 6567 | |
| 6568 | |
| 6569 | |
| 6570 | static const unsigned int proggy_forever_minimal_ttf_compressed_size = 14562; |
| 6571 | static const unsigned char proggy_forever_minimal_ttf_compressed_data[14562] = |
| 6572 | { |
| 6573 | 87,188,0,0,0,0,0,0,0,0,72,124,0,4,0,0,55,0,1,0,0,0,14,0,128,0,3,0,96,70,70,84,77,176,111,174,190,0,0,72,96,130,21,40,28,71,68,69,70,0,136,0,105,130,15,32,64,130,15,44,30,79,83,47,50, |
| 6574 | 104,97,19,194,0,0,1,104,130,15,44,96,99,109,97,112,177,173,221,139,0,0,3,80,130,19,44,114,99,118,116,32,0,33,2,121,0,0,4,196,130,31,38,4,103,97,115,112,255,255,130,89,34,0,72,56,130, |
| 6575 | 15,56,8,103,108,121,102,239,245,108,207,0,0,6,76,0,0,62,224,104,101,97,100,44,57,58,3,130,27,32,236,130,3,33,54,104,130,16,35,4,62,0,230,130,75,32,36,130,15,39,36,104,109,116,120,24, |
| 6576 | 22,19,130,95,33,1,200,130,19,40,136,108,111,99,97,80,9,64,114,130,95,131,15,39,130,109,97,120,112,1,7,0,131,31,32,72,130,47,44,32,110,97,109,101,10,160,159,151,0,0,69,44,130,47,44, |
| 6577 | 68,112,111,115,116,70,77,175,253,0,0,70,112,130,15,32,197,132,235,32,1,130,9,42,224,136,151,95,15,60,245,0,11,3,232,130,55,36,0,229,175,187,66,132,7,42,178,59,232,255,225,255,68,1, |
| 6578 | 215,2,176,130,15,34,8,0,2,130,5,131,2,130,51,39,2,131,255,71,0,0,1,184,130,31,34,226,1,215,132,73,131,25,135,3,32,4,132,17,37,192,0,90,0,5,0,131,0,33,2,0,130,44,132,19,34,64,0,46,130, |
| 6579 | 11,38,0,0,4,1,184,1,144,131,29,35,2,138,2,187,130,17,32,140,133,7,38,1,223,0,49,1,2,0,138,0,37,128,0,0,7,16,0,136,123,33,0,88,130,0,37,0,64,0,32,32,172,133,131,34,2,175,0,131,63,33, |
| 6580 | 3,0,130,0,35,1,133,2,6,130,6,38,32,0,1,1,184,0,33,130,9,130,161,32,0,132,3,39,0,166,0,116,255,249,0,49,130,113,36,4,0,185,0,135,130,1,38,27,0,22,0,154,0,53,130,25,40,39,0,41,0,79,0, |
| 6581 | 50,0,45,130,17,32,49,130,11,33,46,0,131,17,36,166,0,143,0,24,132,1,34,48,255,225,130,55,34,38,0,47,130,23,44,52,0,58,0,35,0,42,0,66,0,65,0,19,130,79,32,19,130,47,38,35,0,44,0,13,0, |
| 6582 | 38,130,21,38,9,0,37,0,13,255,250,130,121,36,5,0,33,0,104,130,47,40,104,0,37,255,242,0,124,0,48,130,95,32,59,130,3,34,37,0,40,130,5,36,62,0,139,0,100,130,57,36,133,0,20,0,62,130,55, |
| 6583 | 32,50,130,19,40,69,0,69,0,87,0,54,0,29,130,167,32,20,130,107,36,64,0,63,0,188,130,3,36,22,0,21,0,159,130,7,36,40,0,55,0,5,130,17,34,64,0,109,130,33,34,92,0,50,130,5,42,109,0,101,0, |
| 6584 | 24,0,115,0,109,0,131,130,121,32,48,130,39,36,143,0,114,0,83,130,77,32,19,130,157,34,18,0,73,130,49,32,5,136,3,32,2,130,85,33,52,0,133,1,33,66,0,133,1,32,17,130,125,32,35,130,209,131, |
| 6585 | 3,36,46,0,1,0,46,132,1,32,47,130,51,32,42,130,25,32,38,130,213,135,3,34,5,0,59,130,99,32,37,132,3,34,51,0,68,132,1,32,42,130,189,33,43,0,135,1,36,24,0,12,0,61,134,1,32,26,130,131,38, |
| 6586 | 26,0,30,0,0,0,3,134,3,32,28,130,93,130,10,35,0,108,0,3,132,9,36,28,0,4,0,80,130,16,34,16,0,16,132,35,46,126,0,133,0,171,0,210,0,211,0,255,32,172,255,255,130,25,32,32,130,17,34,161, |
| 6587 | 0,174,130,17,32,212,131,17,45,255,227,255,221,255,194,255,192,255,95,255,191,224,19,132,67,130,36,139,2,34,1,6,0,136,22,35,1,2,0,0,66,53,9,32,0,133,0,32,1,130,142,8,148,4,5,6,7,8,9, |
| 6588 | 10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69, |
| 6589 | 70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,0,132,133,135,137,145,149,155,160,159,161,163,162,164,166,168,167,169,170,172,171,173,174,176,178, |
| 6590 | 177,179,181,180,185,184,186,187,0,112,100,101,105,0,118,158,110,107,0,116,106,0,134,151,0,113,0,0,103,117,132,158,38,108,122,0,165,183,127,99,132,11,38,109,123,0,0,128,131,148,132, |
| 6591 | 11,130,4,37,182,0,190,60,0,191,130,8,34,0,0,119,130,5,47,130,138,129,139,136,141,142,143,140,50,147,0,146,153,154,152,130,18,32,111,130,3,32,120,130,3,130,2,34,33,2,121,130,5,33,42, |
| 6592 | 0,133,1,9,155,68,0,86,0,134,0,210,1,14,1,104,1,116,1,148,1,180,1,212,1,232,2,6,2,20,2,38,2,54,2,100,2,122,2,172,2,232,3,2,3,60,3,116,3,134,3,210,4,10,4,40,4,82,4,102,4,122,4,142,4, |
| 6593 | 204,5,36,5,60,5,118,5,158,5,184,5,208,5,228,6,24,6,44,6,68,6,94,6,118,6,134,6,160,6,182,6,224,7,14,7,64,7,106,7,182,7,200,7,238,8,0,8,28,8,52,8,72,8,96,8,114,8,130,8,148,8,166,8,180, |
| 6594 | 8,194,9,12,9,58,9,92,9,140,9,182,9,214,10,14,10,44,10,74,10,110,10,134,10,150,10,198,10,230,11,4,11,50,11,96,11,130,11,188,11,216,11,250,12,14,12,42,12,66,12,114,12,142,12,198,12,210, |
| 6595 | 13,10,13,62,13,126,13,152,13,198,13,238,14,34,14,72,14,90,14,198,14,232,15,32,15,106,15,134,15,200,15,214,15,244,16,16,16,56,16,114,16,128,16,182,16,212,16,230,17,2,17,22,17,60,17, |
| 6596 | 86,17,132,17,194,18,20,18,76,18,108,18,140,18,176,18,228,19,24,19,74,19,110,19,168,19,198,19,228,20,6,20,56,20,86,20,116,20,150,20,200,20,252,21,44,21,92,21,144,21,212,22,24,22,50, |
| 6597 | 22,112,22,148,22,186,22,226,23,28,23,56,23,90,23,160,23,246,24,76,24,164,25,18,25,124,25,226,26,94,26,150,26,198,26,248,27,44,27,114,27,144,27,174,27,208,28,2,28,74,28,136,28,174,28, |
| 6598 | 212,28,254,29,60,29,118,29,172,29,230,30,16,30,58,30,104,30,166,30,206,30,244,31,48,31,112,0,0,0,2,0,33,0,0,1,42,2,154,0,3,0,7,0,46,177,1,0,47,60,178,7,4,0,237,50,177,6,5,220,60,178, |
| 6599 | 3,2,130,10,34,0,177,3,131,22,32,5,131,22,39,178,7,6,1,252,60,178,1,131,23,52,51,17,33,17,39,51,17,35,33,1,9,232,199,199,2,154,253,102,33,2,88,131,83,38,166,255,254,1,18,2,35,130,81, |
| 6600 | 61,13,0,0,54,50,22,20,6,34,38,52,55,35,3,55,51,21,198,44,32,32,44,32,85,59,14,1,83,105,31,131,11,36,122,1,4,91,91,130,135,38,116,1,70,1,68,2,7,132,135,37,0,1,35,53,51,7,130,3,8,40, |
| 6601 | 1,67,64,64,142,65,65,1,70,192,192,192,0,2,255,248,0,3,1,191,2,3,0,3,0,31,0,0,63,1,35,7,37,35,7,51,21,35,7,35,55,132,3,34,53,51,55,130,51,35,55,51,7,51,131,3,53,254,30,92,30,1,29,104, |
| 6602 | 31,92,106,38,59,38,92,38,58,38,96,110,31,98,112,134,11,34,90,201,115,130,0,33,54,143,130,0,35,54,115,54,144,130,0,32,0,130,85,8,37,49,255,241,1,135,2,22,0,6,0,11,0,52,0,0,55,62,1,53, |
| 6603 | 52,38,47,1,53,6,21,20,23,30,3,21,20,7,21,35,53,46,1,130,16,8,109,30,2,23,53,46,3,53,52,54,55,53,51,21,30,1,31,1,21,38,39,21,50,249,32,41,36,37,60,72,137,22,40,46,28,141,60,36,67,15, |
| 6604 | 15,6,21,69,37,31,44,43,22,75,65,60,25,55,15,15,43,67,3,81,7,37,31,30,32,10,73,135,12,61,44,30,4,15,28,50,33,114,15,44,43,1,14,6,6,63,4,11,22,3,162,6,15,26,42,29,53,67,9,45,42,2,11, |
| 6605 | 5,5,62,29,4,150,0,5,130,1,36,11,1,178,1,250,130,161,52,11,0,19,0,27,0,35,0,0,1,51,1,35,36,50,54,52,38,34,6,20,65,97,7,34,2,20,22,132,17,65,111,5,53,54,50,1,74,71,254,222,71,1,16,41, |
| 6606 | 30,30,41,29,7,84,60,60,84,59,174,130,9,34,29,41,122,130,9,51,59,84,1,249,254,21,47,27,39,27,27,39,115,56,79,56,56,79,1,26,131,11,33,27,7,131,11,8,59,56,0,0,0,3,0,4,255,246,1,179,2, |
| 6607 | 21,0,9,0,28,0,62,0,0,55,50,55,46,1,39,6,21,20,22,3,28,2,30,5,23,62,1,53,52,38,35,34,6,1,23,35,38,39,6,35,34,38,53,52,54,55,46,2,130,5,8,101,51,50,22,21,20,14,2,7,22,23,54,53,55,20, |
| 6608 | 206,52,37,25,110,24,65,80,41,1,2,3,6,8,12,7,37,37,31,23,24,35,1,2,67,72,13,21,60,89,72,104,52,44,22,19,15,63,60,61,51,15,32,25,24,89,58,36,61,44,36,28,131,28,54,59,48,62,1,125,1,7, |
| 6609 | 3,7,5,10,9,13,16,9,25,40,24,21,25,32,254,143,79,15,24,49,96,66,50,74,33,25,130,17,56,41,69,55,49,20,36,34,20,17,107,69,65,72,1,108,0,1,0,185,1,70,0,255,2,8,130,189,42,0,19,35,53,51, |
| 6610 | 254,68,68,1,71,193,130,23,8,59,135,255,193,1,49,2,62,0,17,0,0,1,14,1,20,22,23,35,46,4,52,62,2,63,1,1,49,43,55,55,43,60,4,15,38,29,24,23,32,33,11,11,2,61,60,177,161,177,60,6,21,68,70, |
| 6611 | 103,97,102,75,61,16,16,130,50,32,0,138,63,34,19,30,4,130,220,40,15,1,35,62,1,52,38,39,195,137,57,32,60,131,73,44,2,61,6,22,68,71,103,97,101,75,60,16,16,132,73,32,0,131,63,38,27,0,69, |
| 6612 | 1,157,1,199,132,127,8,41,7,23,7,39,21,35,53,7,39,55,39,55,23,53,51,21,55,1,157,131,131,33,128,64,129,32,131,131,32,129,64,128,1,77,71,71,50,70,142,142,70,50,134,7,49,0,1,0,22,0,74, |
| 6613 | 1,162,1,185,0,11,0,0,19,51,21,35,130,62,130,221,37,53,51,251,166,166,62,130,2,38,1,31,59,154,154,59,154,130,39,39,154,255,129,1,30,0,107,0,130,180,32,54,65,133,5,8,37,15,1,39,54,55, |
| 6614 | 46,1,53,52,209,45,31,21,31,30,11,11,26,55,10,17,25,107,32,22,32,61,40,32,7,7,37,48,41,1,31,21,22,131,163,54,53,0,227,1,131,1,32,0,3,0,0,37,33,53,33,1,131,254,178,1,78,228,60,132,191, |
| 6615 | 40,166,255,255,1,18,0,105,0,7,67,209,9,67,203,5,37,105,31,44,31,31,44,132,35,38,39,255,222,1,144,2,39,131,63,49,9,1,35,1,1,144,254,221,69,1,34,2,39,253,184,2,72,0,130,21,8,73,41,255, |
| 6616 | 247,1,143,2,14,0,10,0,21,0,27,0,0,55,50,62,3,53,52,39,7,22,19,34,14,3,21,20,23,55,38,39,50,16,35,34,16,220,17,28,30,21,14,4,190,27,57,17,28,31,20,14,4,189,26,57,178,178,178,51,7,26, |
| 6617 | 44,78,53,40,34,230,52,1,161,8,131,10,39,39,33,229,52,58,253,234,2,130,186,41,0,1,0,79,0,0,1,104,2,7,130,91,40,0,19,39,55,51,17,51,21,33,130,5,50,81,1,106,68,105,254,233,1,105,1,103, |
| 6618 | 81,78,254,55,61,61,1,122,130,43,32,50,130,43,37,134,2,17,0,31,0,130,43,49,62,2,51,50,30,2,21,20,6,15,1,33,21,33,53,52,55,54,67,247,5,8,58,35,34,6,7,55,1,8,29,81,37,48,72,36,17,44,59, |
| 6619 | 147,1,1,254,173,13,1,165,37,40,58,45,26,75,24,1,159,65,5,16,27,30,48,46,21,40,78,58,146,61,46,14,12,1,165,38,80,33,33,47,27,13,0,130,94,41,0,45,255,246,1,139,2,16,0,41,130,12,32,22, |
| 6620 | 130,93,38,35,34,38,47,1,53,30,130,108,40,54,53,52,38,43,1,53,51,50,131,8,130,101,37,15,1,53,54,51,50,131,35,8,62,1,26,112,107,85,34,78,22,23,7,25,80,41,57,65,65,49,64,64,46,56,55,45, |
| 6621 | 33,72,20,20,74,68,78,98,51,1,22,30,109,65,84,13,7,6,69,4,12,19,51,49,46,52,58,45,38,37,43,14,7,7,64,23,74,59,50,55,130,119,34,2,0,22,130,111,45,162,2,7,0,2,0,13,0,0,37,17,3,59,1,66, |
| 6622 | 44,6,54,19,51,1,16,179,237,88,88,67,241,208,100,181,1,18,254,238,58,123,123,73,1,66,130,46,33,0,49,130,171,32,135,130,51,37,40,0,0,19,17,33,130,47,130,143,37,30,3,21,20,14,2,137,181, |
| 6623 | 36,62,2,53,52,46,130,15,8,68,6,7,72,1,33,221,24,41,25,48,51,38,24,35,61,67,38,43,70,14,14,7,24,76,38,21,39,39,23,23,40,44,25,28,56,14,1,2,1,4,59,127,11,10,25,38,63,40,49,72,38,18,11, |
| 6624 | 6,5,71,4,11,19,11,25,48,33,33,48,25,12,13,7,130,157,55,41,255,248,1,143,2,8,0,9,0,37,0,0,55,50,53,52,35,34,6,21,20,22,19,65,139,5,130,119,42,53,52,62,2,51,50,22,31,1,21,38,131,26,8, |
| 6625 | 58,54,224,101,101,41,59,59,51,31,56,49,29,91,82,87,98,36,63,79,48,24,46,11,10,31,59,69,89,36,48,119,121,57,64,63,56,1,39,20,40,68,43,90,89,114,136,73,110,63,31,8,4,3,66,25,95,98,72, |
| 6626 | 0,130,0,38,1,0,46,0,0,1,138,130,227,32,6,130,227,8,42,53,33,21,3,35,19,46,1,91,197,78,190,1,203,59,29,254,23,1,202,0,0,3,0,39,255,246,1,145,2,17,0,15,0,31,0,52,0,0,54,50,62,2,130,243, |
| 6627 | 38,34,14,2,20,30,1,18,132,6,32,2,132,18,35,1,23,30,1,65,210,5,35,53,52,55,38,68,239,7,8,50,199,42,32,32,18,18,33,32,40,32,33,18,18,32,72,37,29,29,16,17,29,28,36,28,30,16,16,29,33,48, |
| 6628 | 52,104,76,77,104,99,84,95,71,70,96,45,7,20,42,63,42,19,7,7,19,130,6,43,20,1,166,6,17,37,53,37,16,6,6,16,130,6,59,17,191,16,72,52,69,78,77,70,107,33,30,91,62,69,70,61,90,0,2,0,41,0, |
| 6629 | 0,1,143,2,16,65,43,5,43,19,34,21,20,51,50,54,53,52,38,3,34,69,108,11,65,170,5,32,22,131,26,8,44,6,215,100,100,42,59,60,51,30,57,48,29,91,82,86,99,36,64,79,47,24,46,11,11,32,59,68,89, |
| 6630 | 35,1,216,120,120,56,64,64,56,254,217,20,39,68,44,89,90,65,44,6,35,3,4,65,24,65,44,5,55,2,0,166,0,81,1,18,1,171,0,7,0,15,0,0,18,34,38,52,54,50,22,20,6,71,199,6,38,242,44,32,32,44,32, |
| 6631 | 76,132,5,39,1,65,31,44,31,31,44,165,132,5,32,0,130,0,36,2,0,143,255,209,134,59,32,24,140,59,35,21,20,14,2,68,137,8,37,243,45,31,31,45,31,130,67,41,22,30,31,11,10,27,55,10,17,25,135, |
| 6632 | 74,37,32,22,33,60,41,31,68,150,10,8,37,0,1,0,24,0,84,1,160,1,176,0,6,0,0,19,37,21,13,1,21,37,24,1,135,254,200,1,56,254,121,1,30,145,62,111,112,62,145,132,123,38,24,0,152,1,159,1,114, |
| 6633 | 72,67,5,34,37,33,53,132,1,33,1,159,130,37,32,135,131,3,35,153,59,99,59,130,39,141,79,37,5,21,5,53,45,1,131,79,32,121,130,79,36,200,1,176,145,57,131,81,132,79,42,48,0,0,1,135,2,31,0, |
| 6634 | 34,0,42,130,121,33,50,22,130,195,44,3,29,1,35,53,52,62,4,53,52,38,35,34,132,209,34,62,4,16,65,25,6,58,226,83,82,29,42,42,29,70,21,33,38,33,22,52,43,25,45,29,22,4,5,52,2,10,34,38,61, |
| 6635 | 132,239,8,33,2,31,68,52,28,47,33,30,33,17,41,41,22,39,28,29,23,31,16,30,33,16,23,23,8,8,34,4,14,35,26,22,254,75,65,71,9,47,255,225,255,233,1,215,2,32,0,7,0,64,0,0,54,50,71,233,5,39, |
| 6636 | 5,23,14,4,35,34,46,3,71,98,10,46,21,35,53,6,35,34,38,52,54,51,50,22,31,1,50,132,151,8,122,6,21,20,30,2,51,50,62,3,214,60,43,43,60,43,1,5,38,2,11,38,43,71,37,63,103,67,46,20,141,105, |
| 6637 | 105,128,15,24,21,10,55,36,43,55,79,80,55,28,49,10,11,45,84,70,81,118,39,61,75,39,35,64,40,30,14,168,56,79,57,57,79,120,46,4,11,27,21,17,33,55,74,79,42,120,163,78,67,24,35,17,7,1,198, |
| 6638 | 19,31,93,131,94,26,13,13,28,34,57,124,104,53,87,55,30,13,20,20,13,0,0,0,2,0,5,0,0,1,178,2,7,130,9,8,38,10,0,0,55,51,3,55,19,35,39,35,7,35,19,141,158,79,45,169,77,41,193,40,77,169,192, |
| 6639 | 1,9,61,253,250,136,136,2,6,0,3,0,38,130,47,32,146,130,47,36,8,0,17,0,39,130,49,32,50,69,22,5,36,21,17,21,22,55,131,10,42,35,23,30,4,21,20,14,2,43,1,17,69,159,6,8,61,220,65,52,62,45, |
| 6640 | 121,71,39,84,49,42,77,12,23,34,25,18,30,50,57,31,194,177,43,62,32,15,49,58,47,52,47,43,189,1,147,156,1,2,4,76,42,33,183,3,7,20,27,48,31,38,57,32,14,2,5,25,43,46,24,42,55,130,110,47, |
| 6641 | 0,47,255,248,1,137,2,18,0,26,0,0,37,21,6,35,67,62,7,58,23,21,38,35,34,14,2,21,20,30,1,51,50,1,136,49,79,56,86,50,24,112,104,77,51,51,77,130,65,55,15,26,66,50,77,93,73,28,42,74,95,58, |
| 6642 | 117,151,32,71,45,33,59,74,46,62,91,59,130,233,130,183,33,1,144,130,195,34,6,0,13,131,193,33,53,52,130,172,58,19,50,17,16,35,7,17,199,125,125,84,84,201,200,160,58,202,201,254,109,1, |
| 6643 | 204,254,253,254,254,1,130,247,34,1,0,52,130,136,32,131,130,51,8,34,11,0,0,19,33,21,33,23,51,21,35,21,33,21,33,53,1,77,254,253,1,227,228,1,4,254,178,2,6,59,153,59,188,59,0,130,0,38, |
| 6644 | 1,0,58,0,0,1,126,130,47,32,9,132,47,34,35,31,1,130,47,40,35,58,1,67,249,1,181,182,74,130,41,35,158,1,59,241,130,34,33,0,35,130,219,32,148,130,219,32,36,130,219,38,39,35,53,51,21,14, |
| 6645 | 4,149,224,47,62,1,1,78,1,99,170,2,7,27,32,54,30,56,85,51,130,233,33,78,50,132,233,47,14,25,66,50,27,42,11,67,141,58,223,2,7,18,13,11,143,241,37,11,7,0,1,0,42,130,108,32,141,133,191, |
| 6646 | 57,51,17,51,21,51,53,51,17,35,53,35,21,43,75,204,75,75,204,2,6,212,212,253,250,247,246,130,39,32,66,130,39,32,117,133,39,36,19,53,33,21,35,130,43,55,5,53,55,17,67,1,50,116,116,254, |
| 6647 | 206,115,1,203,59,59,254,112,58,1,57,1,1,145,132,231,36,65,255,249,1,118,130,47,32,13,130,231,8,33,51,17,20,6,35,7,53,51,50,54,53,17,35,158,216,66,78,164,147,48,37,140,2,6,254,158,80, |
| 6648 | 90,1,57,48,58,1,47,130,50,39,0,1,0,19,0,0,1,165,137,139,59,55,51,7,19,35,3,7,21,19,75,233,85,212,221,90,180,57,2,6,230,230,212,254,206,1,4,57,202,130,48,34,1,0,49,130,47,32,135,130, |
| 6649 | 47,50,5,0,0,55,17,51,17,33,21,49,75,1,10,1,2,5,254,53,58,132,31,131,79,32,164,130,31,56,12,0,0,51,17,51,23,55,51,17,7,17,3,35,3,17,20,100,99,101,100,65,107,57,106,130,130,42,254,253, |
| 6650 | 251,1,1,197,254,239,1,19,254,130,52,34,1,0,41,130,83,32,142,65,159,5,35,51,3,51,19,130,86,130,48,38,45,3,98,186,72,95,186,130,46,55,90,1,166,253,250,1,166,254,90,0,0,2,0,35,255,250, |
| 6651 | 1,149,2,18,0,5,0,25,130,229,63,50,16,35,34,16,18,50,62,3,52,46,3,34,14,3,20,30,2,220,184,184,184,167,34,27,30,20,13,13,20,30,27,131,8,33,14,14,130,22,50,17,253,234,2,22,254,37,8,26, |
| 6652 | 43,78,106,78,44,26,8,8,26,44,130,8,33,43,26,130,179,38,2,0,44,255,255,1,139,132,179,32,30,131,83,71,166,5,45,43,1,21,55,50,22,21,20,6,43,1,28,1,30,130,3,8,47,49,35,17,50,206,32,46, |
| 6653 | 22,10,10,21,42,30,93,99,85,91,85,84,108,1,1,75,174,1,10,19,31,31,17,17,31,31,18,195,252,80,70,71,89,5,21,55,48,50,29,2,6,130,90,45,0,2,0,13,255,184,1,171,2,15,0,12,0,32,131,91,39,17, |
| 6654 | 20,7,23,21,35,39,6,143,182,39,198,184,40,84,48,82,40,58,147,187,40,14,254,245,123,67,97,44,91,27,149,193,38,2,0,38,0,0,1,145,130,191,34,9,0,24,130,99,34,35,21,22,73,125,5,35,15,1,35, |
| 6655 | 17,73,20,5,8,45,7,23,35,39,38,213,99,68,39,34,51,53,139,3,72,179,79,83,57,44,122,79,111,97,1,205,184,1,2,2,46,45,43,47,242,218,2,5,89,69,45,69,16,229,217,1,130,184,42,1,0,42,255,246, |
| 6656 | 1,141,2,17,0,54,130,91,44,21,46,2,35,34,6,21,20,30,7,23,30,3,73,135,16,32,39,69,75,6,8,95,30,2,23,1,109,6,21,67,35,62,61,6,14,11,25,12,31,9,33,1,23,42,48,29,101,89,43,78,18,18,7,27, |
| 6657 | 86,45,45,66,61,69,34,48,47,24,103,87,18,40,32,27,8,1,245,71,4,13,21,41,48,11,18,15,11,10,5,7,3,5,1,4,17,33,58,39,78,74,16,9,8,73,5,16,27,46,45,46,37,14,6,17,31,50,34,72,82,5,8,9,84, |
| 6658 | 93,5,32,9,130,143,32,175,130,235,32,7,130,233,56,53,33,21,35,17,7,17,10,1,164,172,75,1,203,59,59,254,54,1,1,203,0,1,0,37,130,187,32,147,130,35,32,24,66,163,5,32,20,74,49,5,8,50,17, |
| 6659 | 51,17,20,14,3,34,46,3,37,76,6,19,43,32,67,48,75,6,22,38,68,95,70,38,22,7,166,1,96,254,153,26,35,34,18,54,67,1,95,254,173,33,48,53,33,22,21,32,50,44,130,75,32,13,130,111,32,171,130, |
| 6660 | 75,8,32,6,0,0,51,3,51,27,1,51,3,174,161,73,134,134,72,161,2,6,254,58,1,198,253,250,0,1,255,249,0,0,1,190,130,35,32,12,135,35,131,38,47,35,11,1,75,81,63,58,63,83,64,57,64,81,73,72,73, |
| 6661 | 130,47,44,99,1,157,254,98,1,158,253,250,1,184,254,72,130,55,32,255,130,55,32,185,67,123,5,8,33,19,39,51,23,55,51,7,19,35,39,7,35,184,160,80,121,123,81,165,177,80,141,141,80,1,19,243, |
| 6662 | 195,195,243,254,237,218,218,130,139,32,5,130,47,32,178,130,47,36,8,0,0,55,3,131,47,50,3,21,35,182,176,79,135,134,80,177,75,234,1,28,228,228,254,227,233,130,34,33,0,33,130,4,32,151, |
| 6663 | 130,39,32,9,65,35,5,60,1,33,21,5,53,1,41,1,102,254,224,1,40,254,138,1,24,1,203,59,53,254,106,58,1,56,1,147,0,130,42,41,0,104,255,189,1,80,2,73,0,7,130,12,55,39,17,51,21,35,17,51,1, |
| 6664 | 79,162,162,231,231,2,18,1,253,226,56,2,140,0,1,0,76,151,10,41,19,1,35,1,109,1,35,70,254,222,76,150,7,130,31,138,67,52,19,51,17,35,53,51,17,7,104,231,231,163,163,2,73,253,116,56,2,30, |
| 6665 | 1,130,90,37,0,37,1,63,1,147,65,75,5,33,19,23,131,233,45,55,252,150,82,100,101,82,150,2,6,198,141,141,198,131,139,55,255,241,255,190,1,199,255,247,0,3,0,0,5,33,53,33,1,198,254,44,1, |
| 6666 | 212,66,56,131,27,39,0,124,1,160,1,60,2,57,131,27,131,63,39,207,108,82,109,2,57,153,153,130,27,8,175,2,0,48,255,246,1,136,1,143,0,17,0,54,0,0,55,50,62,3,53,34,35,38,14,4,21,20,22,39, |
| 6667 | 52,62,3,23,48,60,1,46,6,35,7,53,50,54,51,21,50,30,2,21,7,35,54,39,6,35,34,38,204,32,48,23,13,2,10,21,24,45,39,32,22,13,51,118,28,50,69,81,45,2,3,7,9,15,18,26,16,122,18,58,34,38,58, |
| 6668 | 52,29,1,61,2,2,38,99,64,79,44,26,33,49,27,17,1,2,3,10,18,28,20,37,35,72,36,51,28,16,1,1,14,7,17,10,16,10,12,7,5,2,54,2,1,12,33,65,47,241,25,27,61,63,0,0,2,0,50,255,247,1,134,2,49,0, |
| 6669 | 9,0,30,0,0,54,50,54,53,52,38,34,6,21,20,39,62,4,67,150,5,130,127,8,57,47,1,7,35,17,51,172,112,50,51,110,52,3,1,5,18,23,42,25,71,87,88,59,32,62,16,15,7,61,68,45,82,68,67,83,83,67,68, |
| 6670 | 212,3,8,20,16,12,102,101,98,106,29,15,15,49,2,47,0,1,0,59,130,91,32,125,130,239,35,20,0,0,1,131,84,36,22,51,50,55,21,72,197,7,8,34,23,21,38,1,13,65,72,72,65,62,49,47,78,85,110,110, |
| 6671 | 85,78,47,49,1,89,74,76,76,74,43,65,32,106,196,106,32,65,43,139,159,32,7,133,159,133,158,38,19,51,17,35,39,14,4,130,155,8,35,53,52,54,51,50,30,2,31,1,122,200,48,104,48,200,68,62,6,3, |
| 6672 | 8,26,27,41,20,59,88,87,70,25,42,24,17,3,4,45,150,131,158,51,1,109,253,209,49,3,7,21,15,13,106,98,101,102,12,17,17,6,7,0,130,0,34,2,0,37,130,163,32,147,130,163,37,5,0,26,0,0,19,130, |
| 6673 | 165,35,51,52,7,20,130,168,32,54,133,169,132,95,8,42,22,29,1,32,227,47,69,224,227,62,67,42,62,46,70,82,89,109,105,79,91,90,254,218,1,89,68,48,116,165,56,79,18,21,64,29,109,95,93,110, |
| 6674 | 97,73,48,130,83,42,1,0,40,0,3,1,144,2,36,0,19,132,247,37,29,1,51,21,35,17,130,1,33,53,51,130,77,61,59,1,21,1,40,35,31,125,125,68,122,122,65,64,108,1,237,25,37,75,57,254,217,1,39,57, |
| 6675 | 52,78,62,55,133,147,36,50,255,70,1,134,130,147,32,9,73,49,5,77,51,8,44,51,17,20,6,43,1,53,51,50,62,2,61,1,137,254,8,60,22,23,222,99,99,53,51,51,159,61,90,81,130,136,28,42,23,10,1,5, |
| 6676 | 18,24,42,25,71,91,91,60,48,52,28,53,142,150,82,68,65,77,1,80,254,110,86,86,58,22,36,37,18,59,2,6,16,12,10,101,100,98,101,20,29,130,162,41,0,62,0,1,1,122,2,49,0,18,74,253,5,8,45,17, |
| 6677 | 35,53,52,38,35,34,6,29,1,35,17,51,21,54,253,53,72,68,40,37,47,56,68,68,37,1,146,78,67,255,0,250,45,48,61,59,223,2,47,218,60,0,2,0,139,130,59,38,45,2,30,0,11,0,17,130,74,8,40,35,34, |
| 6678 | 61,1,52,59,1,50,29,1,20,7,53,51,17,35,17,1,35,56,10,10,56,9,161,161,68,1,202,10,64,9,9,64,10,127,59,254,123,1,74,130,232,34,2,0,100,130,231,32,84,130,59,34,12,0,24,130,121,130,47,32, |
| 6679 | 20,132,221,35,54,53,17,55,138,72,39,165,174,127,112,105,29,37,59,132,72,43,1,76,58,254,98,161,59,52,50,1,100,126,133,79,39,0,1,0,41,0,2,1,142,132,131,38,0,55,23,35,39,7,21,130,183, |
| 6680 | 53,17,55,51,210,188,81,154,51,70,70,181,80,245,243,201,45,156,2,27,254,201,161,130,118,130,47,32,133,130,179,36,51,2,8,0,5,130,117,131,164,41,35,133,173,69,104,2,7,253,250,1,72,63, |
| 6681 | 5,46,20,255,254,1,164,1,143,0,30,0,0,1,50,22,21,130,198,36,52,35,34,6,7,138,7,48,51,21,54,51,50,23,62,1,1,68,43,52,61,52,26,26,3,132,4,52,62,62,31,42,52,26,13,48,1,143,69,53,254,234, |
| 6682 | 1,5,84,34,37,254,238,130,6,42,33,36,254,236,1,133,18,29,49,22,27,130,128,32,1,65,111,5,33,1,147,65,111,20,32,23,65,111,9,33,64,4,65,112,12,35,1,133,48,60,66,31,5,42,42,255,247,1,141, |
| 6683 | 1,144,0,9,0,17,67,179,11,32,18,130,171,8,40,20,32,53,52,174,92,58,59,90,59,21,166,94,254,158,44,72,80,80,70,70,80,80,1,28,102,102,205,205,102,0,2,0,50,255,78,1,134,1,136,0,67,79,6, |
| 6684 | 38,54,53,52,34,21,20,19,131,57,8,62,6,35,34,46,2,47,1,21,35,17,51,23,62,4,176,103,48,199,107,66,89,87,71,25,41,24,18,3,3,68,61,7,1,6,20,25,41,38,82,67,148,148,67,1,16,105,99,101,103, |
| 6685 | 12,18,17,6,6,221,2,48,49,2,8,20,16,13,152,91,35,51,17,35,53,67,171,13,38,160,104,48,200,216,62,68,66,165,5,41,70,87,89,66,23,41,26,19,4,4,134,91,44,6,253,208,221,2,8,21,15,13,103,101, |
| 6686 | 99,105,132,99,36,0,0,1,0,69,130,4,36,115,1,142,0,19,130,7,35,50,22,31,1,71,239,5,33,29,1,130,173,8,36,7,62,1,1,12,29,52,11,11,4,16,56,31,56,71,68,68,2,17,69,1,142,15,7,8,65,5,12,20, |
| 6687 | 60,35,245,1,133,53,27,35,130,54,46,0,69,255,254,1,115,1,151,0,38,0,0,55,30,1,130,250,34,39,46,1,80,126,9,39,46,2,35,34,21,20,22,23,79,243,7,8,78,47,1,69,53,109,71,91,83,57,14,32,65, |
| 6688 | 44,33,62,14,15,6,19,63,33,90,36,57,70,69,88,73,31,70,20,20,88,27,14,32,35,49,15,15,53,44,22,38,36,20,11,6,6,62,4,11,17,57,25,29,8,11,46,55,57,66,12,6,6,0,0,0,1,0,87,0,6,1,97,2,4,0, |
| 6689 | 17,130,115,41,51,21,35,34,46,3,53,17,51,21,130,9,57,21,20,216,136,125,25,33,41,24,16,68,162,162,65,58,3,15,26,50,34,1,124,118,58,204,70,132,55,40,54,255,246,1,130,1,133,0,21,130,55, |
| 6690 | 33,53,51,80,10,5,34,55,51,19,65,74,6,8,32,54,68,86,44,62,3,68,1,64,1,3,17,23,45,27,79,73,145,244,241,102,53,39,251,254,124,42,2,7,19,13,12,74,132,67,32,29,130,128,32,155,130,67,53, |
| 6691 | 6,0,0,1,51,3,35,3,51,19,1,84,70,148,86,147,71,120,1,133,254,123,130,3,32,186,130,38,39,0,1,255,248,255,255,1,192,130,39,33,12,0,132,39,33,39,7,131,42,48,55,51,23,1,124,67,97,63,68, |
| 6692 | 65,65,97,68,68,53,76,60,130,47,34,123,215,215,130,5,34,208,192,192,132,55,33,0,20,130,55,32,163,130,55,35,11,0,0,37,71,43,5,57,39,51,23,55,51,1,1,162,78,122,120,78,162,149,76,110,109, |
| 6693 | 76,203,203,155,155,204,185,141,141,77,151,5,38,68,1,137,1,134,0,31,130,12,32,18,77,244,5,44,53,51,50,62,4,53,52,53,35,34,38,53,19,130,230,59,22,51,23,3,1,134,3,12,24,47,32,195,176, |
| 6694 | 16,23,13,8,3,1,133,71,72,1,68,29,41,137,1,130,122,56,135,48,17,47,52,36,59,12,24,22,34,17,14,4,2,78,49,1,6,229,49,50,1,1,73,132,239,32,64,130,143,32,119,130,95,8,41,14,0,0,55,51,23, |
| 6695 | 33,53,62,3,39,35,53,33,21,2,137,237,1,254,202,15,50,105,69,1,229,1,45,238,52,52,59,17,58,122,82,1,50,60,254,235,130,54,8,32,0,1,0,63,255,178,1,120,2,84,0,41,0,0,1,21,20,7,22,29,1,20, |
| 6696 | 22,59,1,21,34,35,34,46,3,61,1,83,197,7,130,9,33,62,3,130,22,8,61,35,34,6,1,11,72,72,38,42,29,31,13,38,54,27,14,3,38,43,51,51,43,38,3,14,27,54,38,44,29,42,38,1,215,100,95,17,17,96,99, |
| 6697 | 34,29,62,20,26,44,30,23,86,43,32,66,32,42,87,23,30,44,26,19,62,29,130,98,53,0,188,255,200,0,252,2,63,0,3,0,0,23,35,17,51,252,64,64,55,2,117,141,135,32,19,84,60,5,36,50,51,50,30,3,134, |
| 6698 | 142,130,119,130,9,33,14,3,69,35,5,130,141,55,55,38,172,37,42,29,30,14,37,54,27,15,2,38,44,51,51,44,38,2,15,27,54,37,130,132,41,37,72,72,1,115,100,33,29,62,19,131,129,33,87,42,130,129, |
| 6699 | 45,43,86,24,29,44,26,20,62,29,33,100,96,17,16,130,248,42,1,0,22,0,177,1,161,1,93,0,33,130,148,34,23,14,4,131,238,39,7,14,1,15,1,39,62,4,131,119,54,55,62,1,55,1,103,58,5,5,17,21,40, |
| 6700 | 25,25,43,30,28,31,16,20,25,3,3,143,16,62,1,66,13,21,21,45,24,20,26,35,36,21,2,3,45,21,21,13,21,22,44,24,21,26,36,35,22,3,3,45,20,130,229,32,21,130,95,45,163,0,106,0,15,0,31,0,47,0, |
| 6701 | 0,55,50,22,130,200,36,6,43,1,34,38,130,197,34,54,59,1,157,15,43,51,104,5,7,7,5,71,4,8,8,4,222,131,9,32,70,131,4,32,221,136,9,35,105,7,5,81,131,12,150,4,42,0,0,2,0,159,255,235,1,25, |
| 6702 | 2,9,90,167,5,33,18,34,82,231,5,59,7,51,23,7,35,53,245,50,35,35,50,35,84,46,29,1,101,1,145,35,49,35,35,49,105,196,155,155,130,51,42,63,255,147,1,121,1,242,0,5,0,28,130,177,48,17,14, |
| 6703 | 1,21,20,19,17,54,55,21,6,7,21,35,53,46,1,90,19,6,8,62,22,23,21,38,243,50,58,146,57,39,45,51,38,78,102,100,80,38,61,35,40,49,1,38,6,73,67,134,1,25,254,215,2,25,59,21,3,100,101,6,107, |
| 6704 | 92,95,104,4,97,98,5,20,60,25,0,1,0,40,255,255,1,144,2,16,0,27,130,89,38,51,21,33,53,51,53,35,130,3,81,218,6,32,21,71,122,5,8,39,51,21,35,202,197,254,153,87,73,73,82,79,33,52,9,10,48, |
| 6705 | 42,50,50,136,136,59,59,59,161,50,82,88,88,10,5,5,64,30,53,63,88,50,0,131,223,38,55,0,63,1,128,1,125,130,223,35,31,0,0,54,82,67,6,8,41,54,20,7,23,7,39,6,34,39,7,39,55,38,52,55,39,55, |
| 6706 | 23,54,50,23,55,23,7,187,65,46,46,65,46,204,22,60,34,62,31,73,31,62,34,60,22,137,10,49,148,44,61,43,43,61,67,73,30,57,35,60,19,19,60,35,57,30,137,10,75,219,10,36,24,0,0,1,7,130,160, |
| 6707 | 33,7,21,88,161,9,32,39,130,194,8,37,39,51,23,55,1,178,120,91,115,33,148,148,75,148,148,33,115,91,119,79,135,134,2,6,194,39,53,11,39,182,182,39,11,53,39,194,228,228,130,178,41,0,2,0, |
| 6708 | 188,255,206,0,252,2,57,83,195,5,36,23,35,17,51,53,67,9,5,40,64,64,50,1,8,92,1,7,0,130,35,59,64,255,188,1,119,2,16,0,15,0,75,0,0,37,62,1,53,52,38,39,38,39,14,1,21,20,22,23,69,167,11, |
| 6709 | 33,53,22,85,40,5,130,28,35,46,4,53,52,89,5,5,32,54,86,84,10,133,47,8,53,4,21,20,6,1,10,21,28,48,46,25,22,22,27,48,45,25,61,25,21,69,72,25,57,16,16,58,51,36,42,37,47,8,3,28,25,39,17, |
| 6710 | 14,38,33,25,21,68,74,24,54,14,14,51,51,37,40,36,130,22,33,29,24,131,22,42,142,12,35,15,26,44,25,14,13,12,36,132,7,63,37,18,34,23,44,66,10,5,5,57,26,32,25,20,30,26,4,2,16,14,28,23,34, |
| 6711 | 19,28,50,16,18,34,24,43,59,131,25,33,27,26,133,25,39,15,15,28,23,33,20,28,50,133,251,42,109,1,212,1,75,2,27,0,11,0,23,73,51,13,33,43,1,73,63,9,39,1,66,58,9,9,58,9,155,131,5,37,8,1, |
| 6712 | 213,9,52,9,136,2,48,0,0,3,255,248,0,40,1,192,1,218,0,7,0,15,0,36,65,245,9,33,18,50,92,21,5,33,22,52,130,255,35,23,21,38,35,75,119,11,8,53,142,156,111,111,156,111,95,188,133,133,188, |
| 6713 | 134,92,78,62,57,30,43,34,47,52,52,47,46,31,36,51,61,79,105,147,105,105,147,1,34,127,179,127,127,179,152,126,66,15,38,21,48,49,49,47,18,36,17,131,179,8,41,3,0,92,0,162,1,91,2,18,0,3, |
| 6714 | 0,18,0,53,0,0,37,35,53,51,39,34,35,34,14,4,21,20,22,51,50,54,7,52,62,2,23,60,1,46,2,88,232,5,8,122,62,6,51,50,22,29,1,35,39,6,35,34,38,1,91,247,247,55,5,8,25,24,37,19,20,8,36,22,49, |
| 6715 | 41,201,37,58,70,33,8,15,32,22,26,50,11,12,2,18,7,17,12,17,18,9,57,73,45,8,39,54,47,59,163,43,178,1,3,6,11,18,13,24,24,61,16,33,43,14,7,4,8,10,22,14,11,11,6,6,44,1,6,2,6,2,3,1,57,64, |
| 6716 | 159,38,45,44,0,2,0,50,0,49,1,134,1,112,0,6,0,13,0,0,1,21,7,23,21,39,53,55,133,5,50,1,134,112,112,174,7,111,111,173,173,1,112,67,93,93,66,145,28,79,132,5,35,146,0,0,4,65,59,8,56,9,0, |
| 6717 | 27,0,35,0,43,0,0,19,22,62,2,53,52,38,43,1,23,30,1,23,35,38,39,130,9,32,21,130,224,36,50,21,20,14,1,67,78,6,65,88,7,54,175,21,36,27,15,29,21,49,86,14,25,46,52,30,17,21,24,27,47,92,103, |
| 6718 | 34,147,65,89,10,53,1,13,1,2,6,18,15,19,20,102,5,33,72,44,26,33,103,242,74,21,32,172,65,94,11,130,172,41,0,109,1,183,1,75,1,235,0,3,130,12,130,106,38,1,74,220,220,1,183,51,66,31,5,45, |
| 6719 | 101,1,50,1,82,2,16,0,7,0,15,0,0,18,93,253,14,56,190,59,42,42,59,41,22,98,69,69,98,69,1,94,39,55,39,39,55,138,65,91,65,65,91,133,59,40,24,255,255,1,159,1,151,0,11,131,59,92,65,11,56, |
| 6720 | 19,33,53,33,251,164,164,62,165,165,62,164,254,121,1,135,1,36,59,115,115,59,114,254,105,87,43,5,40,115,1,133,1,69,2,173,0,24,130,143,130,245,37,7,51,21,35,53,54,85,161,5,8,47,34,6,15, |
| 6721 | 1,53,54,51,50,22,1,66,17,62,70,152,210,77,32,42,37,28,17,42,12,13,39,51,57,58,2,94,20,33,64,61,39,38,72,29,40,36,18,25,11,6,6,41,20,130,197,32,1,130,223,38,130,1,75,2,176,0,39,131, |
| 6722 | 79,32,6,88,180,10,91,20,23,8,51,7,22,1,75,68,55,21,49,15,14,50,42,26,48,43,31,31,31,29,36,30,27,21,44,12,12,47,44,49,63,33,30,71,1,214,37,47,7,4,4,42,18,26,25,25,27,38,22,21,18,22, |
| 6723 | 8,130,13,38,13,42,33,28,29,7,13,130,252,39,1,0,131,1,181,1,53,2,79,123,5,41,51,7,35,235,73,120,56,2,57,131,130,26,51,0,1,0,37,255,107,1,146,1,132,0,36,0,0,37,50,54,63,1,21,133,147, |
| 6724 | 33,14,4,130,154,36,39,21,35,17,51,66,199,5,8,63,53,55,51,16,21,20,1,120,7,12,4,3,27,29,19,26,4,3,1,4,16,22,42,27,26,47,11,60,64,45,37,43,59,3,65,49,4,2,2,52,15,26,13,13,2,7,18,14,11, |
| 6725 | 28,26,192,2,24,241,48,53,53,38,251,254,226,24,29,130,108,42,1,0,48,255,185,1,136,2,7,0,16,76,95,7,47,16,21,6,34,47,1,17,34,38,52,54,216,175,52,70,1,130,60,8,34,69,99,99,2,6,253,182, |
| 6726 | 2,32,253,229,5,2,1,1,1,39,85,121,85,0,0,1,0,159,0,198,1,25,1,63,0,7,0,0,66,114,7,39,195,50,35,35,50,35,1,63,130,4,33,35,50,131,35,36,143,255,119,1,41,130,43,130,95,35,33,22,21,20,65, |
| 6727 | 92,8,52,39,48,58,1,1,0,40,91,14,31,8,8,24,27,91,73,21,22,41,37,59,130,173,34,46,11,94,132,151,40,114,1,132,1,70,2,167,0,10,131,151,37,21,35,53,51,53,7,130,239,56,250,75,204,76,83,85, |
| 6728 | 51,1,171,38,38,212,14,40,13,0,3,0,83,0,162,1,101,2,16,130,9,37,13,0,21,0,0,37,130,41,8,47,2,34,6,21,20,22,50,54,53,52,22,32,53,52,54,50,22,21,1,86,249,249,88,69,46,45,71,45,56,254, |
| 6729 | 239,73,127,73,163,43,1,25,47,54,54,49,49,54,54,197,143,71,130,0,130,114,67,163,15,33,55,21,130,112,35,39,53,51,23,132,7,48,223,173,111,111,166,174,174,112,112,222,28,145,66,93,93,67, |
| 6730 | 146,132,6,41,0,4,0,19,255,162,1,165,2,64,130,127,36,6,0,17,0,28,130,242,38,23,5,39,23,51,53,55,70,111,8,33,55,3,130,72,32,51,131,14,8,44,53,51,1,155,9,254,120,9,198,102,51,43,43,50, |
| 6731 | 144,134,187,82,87,48,75,203,75,1,47,37,91,37,203,144,43,188,37,65,65,42,183,1,86,14,39,13,252,39,39,130,81,137,91,34,28,0,39,133,89,32,5,66,236,15,34,39,54,51,130,224,34,20,6,1,143, |
| 6732 | 100,34,1,73,86,66,254,7,42,41,13,12,1,39,51,57,59,28,254,252,138,113,52,190,77,39,39,71,30,39,36,19,25,12,6,6,42,19,51,27,23,45,1,226,134,123,34,4,0,18,132,215,32,70,134,215,32,56, |
| 6733 | 133,125,34,23,51,39,138,215,33,39,20,67,43,10,67,42,26,132,243,34,202,102,1,130,244,8,32,49,145,134,45,72,55,21,48,13,13,41,46,36,42,38,34,33,30,31,37,33,25,24,45,10,10,46,44,50,62, |
| 6734 | 33,30,72,65,11,13,8,68,168,36,47,7,4,4,41,18,29,47,28,37,23,21,20,20,8,4,4,42,12,41,32,29,29,8,14,0,0,2,0,73,255,247,1,111,2,27,0,30,0,38,0,0,55,50,54,63,1,21,14,2,35,34,38,53,52,62, |
| 6735 | 4,61,1,51,21,20,14,3,21,20,22,73,68,7,8,56,235,29,66,18,19,7,24,69,34,82,78,19,29,34,29,19,71,26,37,38,26,47,71,44,32,32,44,32,48,24,11,12,65,5,12,21,65,54,24,43,30,30,24,31,17,69, |
| 6736 | 61,30,48,34,31,39,21,31,36,1,129,91,1,6,45,3,0,5,0,0,1,179,2,131,0,3,0,6,0,130,128,36,1,35,39,51,3,90,85,9,37,1,9,56,84,68,52,90,90,9,46,2,38,92,254,61,1,10,61,253,250,135,135,2,6, |
| 6737 | 0,130,53,143,63,34,7,35,55,139,63,36,59,84,56,72,106,132,63,39,40,193,41,77,169,2,130,92,140,64,36,3,0,5,255,255,132,127,32,6,79,77,5,32,19,130,63,34,51,23,35,138,66,38,220,61,51,78, |
| 6738 | 69,78,51,90,223,5,133,68,33,101,62,130,69,32,151,138,134,131,135,33,255,254,130,71,61,123,0,20,0,23,0,31,0,0,19,34,6,21,35,52,54,51,50,22,51,50,54,53,55,51,20,6,35,34,38,138,85,49, |
| 6739 | 169,12,12,47,36,34,26,62,15,11,13,1,46,34,36,28,58,45,138,164,45,81,19,16,33,43,34,17,9,8,25,51,35,254,109,139,103,32,4,136,175,38,2,0,10,0,22,0,34,91,131,12,81,53,11,72,74,11,138, |
| 6740 | 187,32,147,72,84,9,33,9,190,136,89,32,56,72,93,13,32,0,136,207,38,149,0,2,0,14,0,30,132,101,52,39,20,22,23,51,62,1,53,52,38,34,6,23,19,35,39,35,7,35,19,38,68,11,5,32,20,130,97,52,56, |
| 6741 | 18,16,44,16,19,33,47,34,112,159,77,40,193,41,77,159,47,60,84,60,130,98,55,110,17,26,6,6,26,17,21,31,31,101,254,25,135,135,1,231,28,51,40,55,55,40,51,130,89,38,2,255,255,1,182,2,7,130, |
| 6742 | 109,32,19,130,97,40,17,35,3,55,21,51,21,35,53,131,88,8,40,37,7,35,23,55,7,235,37,75,186,128,202,127,37,68,150,1,23,1,122,1,111,1,190,1,13,254,244,55,188,59,134,133,2,5,2,61,153,1,60, |
| 6743 | 0,78,87,5,38,119,1,137,2,16,0,40,130,12,91,224,8,49,55,21,6,7,22,21,20,6,35,34,39,53,22,51,50,53,52,39,88,3,6,8,66,23,21,38,1,8,38,57,32,14,25,66,50,77,51,37,56,33,45,38,45,25,24,31, |
| 6744 | 46,26,54,81,48,23,112,104,77,51,51,1,213,32,60,74,46,62,91,59,46,73,21,5,36,32,31,30,9,45,11,31,22,32,3,42,74,93,56,117,151,32,71,45,130,187,38,52,0,3,1,132,2,135,71,103,5,8,41,55, |
| 6745 | 33,21,33,17,33,21,35,31,1,21,35,19,35,39,51,127,1,4,254,178,1,71,253,1,241,242,142,57,84,68,63,59,2,6,59,153,1,59,1,48,93,130,175,36,2,0,52,0,4,150,59,34,7,35,55,138,59,36,173,84,56, |
| 6746 | 72,64,135,59,33,140,93,130,60,135,59,32,136,130,119,34,18,0,0,140,119,66,185,5,138,62,38,86,61,52,78,70,78,52,136,65,33,110,62,131,66,33,0,3,130,127,32,0,130,127,32,133,130,67,34,23, |
| 6747 | 0,35,74,129,25,32,3,134,213,35,23,51,21,35,74,141,11,33,9,58,137,222,39,2,63,8,52,9,9,52,8,133,5,33,253,252,132,173,42,59,0,2,0,66,255,254,1,118,2,131,65,31,5,8,49,1,35,17,23,21,33, |
| 6748 | 53,51,17,35,53,33,39,35,39,51,1,117,115,115,254,206,116,116,1,50,106,56,84,68,1,202,254,111,1,57,59,1,144,59,33,92,0,0,0,2,0,66,0,3,130,59,65,91,6,130,59,32,51,132,59,32,39,130,59, |
| 6749 | 130,227,56,1,117,116,116,254,206,115,115,1,50,60,84,56,72,1,207,254,112,59,57,1,145,1,59,125,65,31,5,133,59,65,31,6,143,59,34,51,23,35,137,62,32,148,65,30,5,137,65,32,95,65,31,7,137, |
| 6750 | 187,65,31,28,34,23,35,17,131,153,32,55,131,213,65,31,12,32,188,135,161,33,2,61,67,88,11,32,115,132,170,34,1,145,59,131,227,45,17,0,4,1,167,2,11,0,18,0,37,0,0,55,92,29,5,8,79,43,1,21, |
| 6751 | 51,21,35,21,50,19,50,30,3,20,14,3,43,1,53,35,53,51,53,50,200,19,36,42,30,20,20,30,42,36,19,62,99,99,62,1,31,56,61,45,29,29,45,61,56,30,139,46,46,138,62,9,27,42,75,98,75,42,27,8,162, |
| 6752 | 53,188,1,205,12,35,55,95,125,96,54,35,11,245,53,220,131,103,42,42,0,0,1,142,2,130,0,20,0,30,68,149,22,36,23,51,17,35,3,130,2,33,51,19,68,148,16,41,140,72,95,186,71,4,98,186,2,88,68, |
| 6753 | 145,10,32,82,92,232,5,37,2,6,254,90,0,3,92,235,6,38,135,0,5,0,9,0,29,92,237,7,35,55,35,39,51,92,241,16,37,238,57,84,68,3,33,92,245,5,34,29,28,34,133,8,42,31,2,17,253,234,2,22,25,93, |
| 6754 | 253,175,92,247,19,135,95,32,136,130,95,32,12,92,157,5,36,16,35,34,16,55,66,235,5,32,2,93,84,15,32,184,65,210,5,32,77,150,101,37,88,62,93,93,254,11,151,103,42,251,1,149,2,129,0,20,0, |
| 6755 | 26,0,46,65,41,14,33,55,53,69,191,5,33,23,50,93,202,16,38,169,11,13,47,36,35,25,69,199,6,39,35,29,58,34,184,184,184,168,145,127,32,87,65,64,10,32,70,131,241,44,254,37,8,26,44,78,105, |
| 6756 | 78,44,27,7,7,27,132,8,36,26,0,0,0,4,65,79,6,131,239,36,17,0,29,0,49,65,81,7,32,37,87,16,10,69,218,11,65,101,16,33,1,30,69,225,10,32,19,145,136,32,17,131,124,32,49,66,150,11,33,253, |
| 6757 | 244,65,17,17,8,32,1,0,46,0,65,1,137,1,137,0,11,0,0,1,7,23,7,39,7,39,55,39,55,23,55,1,137,129,129,45,128,129,45,130,5,38,129,128,1,94,121,121,42,135,2,47,0,3,0,1,255,234,1,183,2,34, |
| 6758 | 0,10,0,21,0,39,103,247,10,46,39,20,23,55,38,35,34,14,3,37,7,22,21,16,35,80,146,5,51,53,16,51,50,23,55,220,17,27,30,20,13,7,184,26,49,7,185,26,59,132,12,40,1,70,65,30,184,83,46,54,36, |
| 6759 | 133,6,32,54,131,157,54,53,56,42,248,58,208,56,42,249,58,8,26,44,78,205,88,65,105,254,245,56,72,25,130,7,48,1,11,56,72,0,0,2,0,46,255,246,1,138,2,131,0,17,130,123,40,0,1,51,17,20,35, |
| 6760 | 34,53,17,130,6,8,44,22,51,50,62,2,53,3,35,39,51,1,62,75,170,176,75,39,61,30,40,19,7,43,57,84,69,2,6,254,160,176,189,1,83,254,160,67,52,18,33,36,25,1,135,92,161,71,34,7,35,55,139,71, |
| 6761 | 35,12,84,57,72,144,71,35,227,92,92,0,130,0,139,147,33,24,0,146,147,66,196,5,139,78,32,98,66,191,5,139,81,33,17,34,130,153,33,198,62,130,82,34,3,0,47,136,227,34,29,0,41,146,81,32,19, |
| 6762 | 66,36,22,44,1,62,76,171,176,75,40,61,30,39,19,7,5,66,30,10,144,103,32,158,72,7,15,32,2,72,111,6,35,130,0,8,0,86,29,5,38,21,35,55,3,51,23,19,130,187,44,1,98,80,177,75,1,177,79,135,90, |
| 6763 | 84,57,73,130,74,39,227,233,234,1,28,229,1,97,130,170,41,0,2,0,42,255,255,1,142,2,6,130,55,32,21,99,245,10,8,41,55,50,22,21,20,43,1,21,35,17,51,21,50,210,49,61,63,47,93,103,83,95,178, |
| 6764 | 103,75,75,103,186,43,48,47,42,180,240,75,74,150,127,2,6,92,0,130,222,130,67,32,242,130,67,8,127,28,0,48,0,0,19,20,30,3,21,20,14,1,38,39,53,22,51,50,54,53,52,46,3,53,52,62,2,63,1,38, |
| 6765 | 54,46,2,35,34,6,21,17,35,17,52,54,51,50,21,34,6,234,34,48,48,33,51,78,88,38,49,51,41,45,33,47,47,33,24,35,34,12,12,1,3,10,14,38,27,46,41,68,73,82,155,47,72,1,50,20,33,27,32,53,35,43, |
| 6766 | 57,20,5,16,56,21,36,29,24,37,25,27,45,30,28,44,24,15,2,2,1,15,23,22,16,48,50,254,123,1,133,77,74,152,44,130,138,41,0,3,0,38,255,245,1,146,2,69,130,9,34,18,0,61,130,156,49,35,39,51, |
| 6767 | 19,50,62,2,39,48,42,1,35,14,1,21,20,22,55,130,3,50,31,1,35,38,39,14,1,35,34,38,53,52,54,59,1,60,2,46,5,81,15,9,8,99,1,12,57,118,72,24,36,52,26,10,1,36,47,11,60,52,51,225,10,5,5,68, |
| 6768 | 9,7,21,76,38,65,80,91,91,92,2,6,8,15,20,30,18,38,71,16,17,3,25,11,24,17,24,26,13,168,1,194,131,253,230,29,47,50,26,2,32,44,38,36,183,116,25,55,15,15,22,37,32,37,64,60,62,70,1,15,9, |
| 6769 | 18,13,16,11,10,5,18,10,9,63,1,9,3,8,3,4,2,149,171,35,7,35,55,3,131,171,33,42,2,167,170,37,84,118,57,103,80,37,131,170,33,1,35,167,171,34,2,69,131,176,172,65,87,9,39,6,0,21,0,64,0,0, |
| 6770 | 19,130,171,34,51,23,35,132,174,65,90,41,39,220,66,52,90,56,90,52,97,65,92,45,38,2,26,88,131,131,254,105,65,94,20,33,63,69,65,94,20,135,175,46,51,0,24,0,39,0,82,0,0,1,34,46,2,35,34, |
| 6771 | 75,234,5,42,30,1,51,50,54,61,1,51,20,14,2,174,191,53,1,13,21,31,16,23,11,26,45,36,37,21,34,30,13,12,13,46,5,13,30,101,173,205,50,1,209,17,20,17,54,43,55,27,26,26,13,14,15,29,33,21, |
| 6772 | 254,90,148,217,66,56,24,32,4,66,227,6,40,29,0,11,0,23,0,38,0,81,74,25,25,32,19,66,77,45,32,63,68,115,10,32,6,66,85,46,33,1,214,68,147,11,33,254,85,181,211,52,114,0,7,0,15,0,58,0,73, |
| 6773 | 0,0,18,34,6,20,22,50,54,52,6,34,88,7,5,32,19,67,183,31,67,58,12,44,240,46,33,33,46,33,14,84,60,60,84,60,63,67,191,33,32,194,139,237,46,2,70,31,44,31,31,44,118,56,80,56,56,80,254,249, |
| 6774 | 67,204,32,33,254,155,136,236,67,215,5,55,5,255,245,1,179,1,143,0,8,0,19,0,89,0,0,1,34,6,23,51,54,39,46,1,130,161,33,1,39,85,233,5,40,37,21,35,28,2,30,5,51,22,79,184,7,34,46,2,47,96, |
| 6775 | 42,8,32,59,113,200,6,83,206,5,8,164,30,2,31,1,62,4,51,50,22,23,30,1,21,1,56,31,31,3,121,1,2,3,27,217,26,26,14,1,28,53,44,37,1,75,182,2,4,6,10,14,21,12,34,52,9,10,5,15,48,25,25,42,22, |
| 6776 | 16,2,3,1,4,16,21,36,22,57,60,70,68,50,42,30,19,46,13,14,44,65,19,30,18,12,2,2,1,3,14,19,36,22,58,48,8,2,1,1,90,54,64,23,22,35,38,254,209,18,59,59,32,38,35,31,136,1,1,28,10,28,13,23, |
| 6777 | 11,14,6,1,17,9,10,60,3,10,16,11,17,16,6,5,2,7,19,15,12,60,56,57,65,28,50,39,14,8,7,58,24,9,13,13,4,5,2,6,15,11,10,59,76,18,42,12,130,248,42,1,0,59,255,119,1,125,1,142,0,37,132,243, |
| 6778 | 42,21,20,22,51,50,55,21,14,1,15,1,77,223,14,130,222,34,54,51,50,98,88,10,35,14,43,15,15,77,222,8,33,82,106,98,99,5,56,88,74,76,76,74,43,65,11,15,2,2,36,32,31,30,8,46,12,32,22,31,3, |
| 6779 | 105,96,98,98,114,5,41,0,3,0,37,255,247,1,147,2,69,130,9,34,9,0,30,69,235,5,32,23,98,25,22,42,21,23,32,1,19,57,118,72,55,46,70,98,30,12,40,92,89,1,254,217,1,194,131,236,98,33,17,145, |
| 6780 | 95,35,7,35,55,7,154,95,36,93,119,56,102,49,147,95,34,2,69,131,147,96,33,0,0,138,195,36,6,0,12,0,33,69,87,8,154,102,39,225,67,52,90,57,90,52,64,148,104,36,26,88,131,131,105,145,202, |
| 6781 | 33,0,4,65,43,6,68,51,5,34,29,0,50,68,51,25,65,65,27,44,69,57,9,9,57,9,155,58,9,9,58,9,39,147,128,68,5,13,32,125,146,137,8,58,0,0,2,0,51,255,252,1,117,2,59,0,13,0,17,0,0,37,51,21,34, |
| 6782 | 35,34,38,61,1,35,53,51,21,20,17,35,39,51,1,37,80,24,71,54,65,90,158,57,119,73,51,54,78,63,201,50,251,86,1,132,131,0,130,0,34,2,0,68,130,59,32,116,149,59,48,19,7,35,55,1,37,79,23,72, |
| 6783 | 53,66,90,158,106,119,57,103,135,60,34,2,7,131,130,61,135,59,36,69,0,6,0,20,65,105,8,32,19,140,126,39,186,66,52,90,56,90,51,40,134,68,70,121,5,32,113,134,131,130,127,32,3,134,127,38, |
| 6784 | 26,0,11,0,23,0,37,65,69,25,141,86,33,1,44,65,56,5,132,5,32,130,134,92,33,1,212,69,49,12,32,95,135,101,54,2,0,42,255,244,1,142,2,27,0,14,0,47,0,0,55,50,54,53,52,38,47,1,90,34,6,38,19, |
| 6785 | 20,30,6,21,20,6,72,186,5,8,96,23,46,1,47,1,7,39,55,39,51,23,55,23,7,22,220,45,60,20,10,10,18,50,43,59,60,145,20,6,19,8,13,6,5,89,88,88,89,107,100,5,27,10,11,103,12,88,67,81,47,106, |
| 6786 | 13,93,36,42,70,71,38,67,15,14,9,69,73,73,69,1,89,1,27,10,29,19,33,29,38,19,86,107,107,94,93,102,8,8,31,12,11,31,34,27,69,49,32,34,28,34,65,115,5,32,62,130,231,44,122,2,32,0,18,0,43, |
| 6787 | 0,0,19,50,22,21,100,121,12,34,23,54,55,71,88,17,54,35,34,46,2,253,53,72,68,39,38,47,56,68,64,4,37,3,26,45,36,37,20,35,71,51,5,40,14,29,21,21,31,17,22,1,145,100,165,9,51,1,132,47,60, |
| 6788 | 99,54,44,54,27,26,26,14,13,15,29,33,21,17,20,17,130,124,40,3,0,43,255,244,1,141,2,69,86,227,7,36,1,35,39,51,18,102,253,8,99,73,7,37,1,15,56,119,73,5,99,78,9,37,1,194,131,253,229,71, |
| 6789 | 99,82,9,35,204,204,102,0,130,65,143,75,35,7,35,55,2,145,75,36,86,118,57,103,96,137,75,34,2,69,131,145,76,137,151,36,6,0,16,0,24,66,77,8,145,78,72,242,6,32,112,138,80,37,26,88,131,131, |
| 6790 | 254,104,143,158,136,159,32,32,130,79,34,34,0,42,72,179,24,145,99,53,1,15,20,32,16,22,12,25,46,36,38,20,35,29,14,12,13,46,5,14,30,118,137,113,36,1,190,17,20,17,65,92,11,33,254,108,142, |
| 6791 | 125,32,4,65,103,6,66,215,5,34,33,0,41,66,217,25,146,126,93,1,10,33,9,11,138,118,66,224,13,32,86,142,115,32,3,130,231,36,49,1,159,1,136,130,249,42,19,0,35,0,0,37,33,53,33,39,35,96,108, |
| 6792 | 13,32,3,142,15,48,1,159,254,121,1,135,161,70,4,7,7,4,70,5,6,6,5,136,9,37,192,59,56,6,5,63,131,18,130,4,33,254,255,130,11,131,35,130,11,32,0,130,0,44,3,0,12,255,222,1,172,1,166,0,7, |
| 6793 | 0,15,131,107,39,55,50,54,53,52,39,7,22,78,242,6,37,6,37,7,22,21,20,78,241,7,8,65,52,54,51,50,23,55,22,222,47,57,10,169,27,56,9,168,27,46,45,59,1,54,61,33,178,75,44,57,34,62,29,94,83, |
| 6794 | 71,46,55,34,43,72,80,42,32,189,37,152,42,31,189,33,70,121,68,52,81,204,40,63,26,70,50,81,102,102,39,63,27,67,55,5,51,61,255,246,1,123,2,59,0,3,0,26,0,0,1,35,39,51,23,51,17,105,15,6, |
| 6795 | 38,61,1,51,21,20,22,51,130,133,8,41,1,13,57,119,73,144,68,63,6,2,5,20,23,38,21,77,61,67,38,43,44,53,1,184,131,182,254,124,57,2,10,23,18,14,72,82,244,240,52,52,59,50,130,84,33,2,0,141, |
| 6796 | 83,34,7,35,55,148,83,36,83,119,56,102,44,143,83,34,2,59,131,147,84,135,83,36,69,0,6,0,29,66,201,8,32,23,145,169,32,55,66,203,6,32,92,139,171,41,42,45,53,2,2,26,88,131,131,61,143,174, |
| 6797 | 32,235,130,175,32,3,134,175,95,67,5,32,46,66,85,25,148,197,35,63,58,8,8,95,89,6,33,9,128,140,205,130,117,95,106,13,32,80,143,125,42,0,0,2,0,26,255,107,1,158,2,59,80,107,7,34,2,7,14, |
| 6798 | 99,148,6,8,49,55,3,51,27,1,7,35,55,1,86,72,140,39,14,32,36,25,18,54,46,30,32,22,160,72,123,105,119,56,102,1,133,254,175,98,35,44,18,5,54,46,54,1,127,254,208,1,230,131,131,130,203,34, |
| 6799 | 2,0,50,130,79,39,134,2,32,0,9,0,23,0,107,131,10,33,19,50,66,59,5,53,21,35,17,51,21,54,174,89,55,57,86,56,99,80,91,171,67,32,68,68,31,42,66,245,11,37,65,202,2,180,208,61,130,75,32,3, |
| 6800 | 134,155,32,17,130,155,38,29,0,41,0,0,1,51,142,157,80,34,23,144,177,32,100,71,147,10,144,185,32,118,80,40,14,42,1,0,30,255,249,1,153,2,20,0,43,130,115,40,34,7,51,7,35,6,21,20,21,130, |
| 6801 | 6,35,30,3,51,50,107,75,6,38,39,35,55,51,38,52,55,130,5,8,76,62,1,51,50,23,21,46,1,1,44,110,20,178,18,163,1,132,17,111,6,27,38,37,23,20,61,27,47,61,88,103,14,65,18,44,2,2,62,18,47,14, |
| 6802 | 103,83,65,48,28,61,1,220,144,36,30,4,17,15,37,44,60,29,10,19,24,71,28,104,95,37,29,9,28,36,95,105,29,72,24,21,130,246,130,2,36,14,0,174,0,1,130,7,131,2,34,1,0,4,134,11,32,1,130,7,32, |
| 6803 | 10,134,11,32,2,130,7,32,16,134,11,36,3,0,29,0,78,134,11,131,43,32,112,134,11,36,5,0,9,0,134,134,11,32,6,130,7,44,148,0,3,0,1,4,9,0,0,0,2,0,0,134,11,32,1,130,11,32,6,134,11,32,2,130, |
| 6804 | 11,32,12,134,11,36,3,0,58,0,18,134,11,32,4,130,23,32,108,134,11,32,5,130,21,32,114,134,11,32,6,130,23,35,144,0,46,0,143,2,39,70,0,111,0,110,0,116,0,131,7,40,114,0,103,0,101,0,32,0, |
| 6805 | 50,130,36,32,48,130,7,32,58,130,3,32,46,134,7,36,49,0,49,0,45,130,25,131,3,32,48,130,7,51,54,0,0,70,111,110,116,70,111,114,103,101,32,50,46,48,32,58,32,46,130,3,39,49,49,45,50,45,50, |
| 6806 | 48,50,130,30,133,107,32,86,130,81,36,114,0,115,0,105,132,103,32,32,130,89,40,0,86,101,114,115,105,111,110,32,136,140,33,2,0,139,0,65,75,7,137,19,32,192,130,10,131,251,60,3,0,4,0,5, |
| 6807 | 0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15,0,16,0,17,130,235,8,50,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,0,27,0,28,0,29,0,30,0,31,0,32,0,33,0,34,0,35,0,36,0,37,0,38,0,39,0,40,0,41, |
| 6808 | 0,42,0,43,0,44,130,211,36,46,0,47,0,48,130,221,9,48,50,0,51,0,52,0,53,0,54,0,55,0,56,0,57,0,58,0,59,0,60,0,61,0,62,0,63,0,64,0,65,0,66,0,67,0,68,0,69,0,70,0,71,0,72,0,73,0,74,0,75, |
| 6809 | 0,76,0,77,0,78,0,79,0,80,0,81,0,82,0,83,0,84,0,85,0,86,0,87,0,88,0,89,0,90,0,91,0,92,0,93,0,94,1,2,0,96,0,97,1,3,0,163,0,132,0,133,0,189,0,150,0,232,0,134,0,142,0,139,0,157,0,169,0, |
| 6810 | 138,1,4,0,131,0,147,0,242,0,243,0,141,0,151,0,136,0,195,0,222,0,241,0,158,0,170,0,245,0,244,0,246,0,162,0,173,0,201,0,199,0,174,0,98,0,99,0,144,0,100,0,203,0,101,0,200,0,202,0,207, |
| 6811 | 0,204,0,205,0,206,0,233,0,102,0,211,0,209,0,175,0,103,0,240,0,145,0,214,0,212,0,213,0,104,0,235,0,237,0,137,0,106,0,105,0,107,0,109,0,108,0,110,0,160,0,111,0,113,0,112,0,114,0,115, |
| 6812 | 0,117,0,116,0,118,0,119,0,234,0,120,0,122,0,121,0,123,0,125,0,124,0,184,0,161,0,127,0,126,0,128,0,129,0,236,0,238,0,186,1,5,11,118,101,114,116,105,99,97,108,98,97,114,7,117,110,105, |
| 6813 | 48,48,56,53,9,111,130,20,42,115,99,111,114,101,4,69,117,114,111,0,132,0,38,1,255,255,0,2,0,1,130,11,32,12,130,3,32,22,130,3,131,13,32,98,130,183,34,1,0,4,132,13,130,4,130,2,32,1,130, |
| 6814 | 3,36,0,229,13,183,147,132,7,42,175,187,66,0,0,0,0,229,178,59,232,5,250,48,120,202,241, |
| 6815 | }; |
| 6816 | |
| 6817 | static const char* GetDefaultCompressedFontDataProggyForever(int* out_size) |
| 6818 | { |
| 6819 | *out_size = proggy_forever_minimal_ttf_compressed_size; |
| 6820 | return (const char*)proggy_forever_minimal_ttf_compressed_data; |
| 6821 | } |
| 6822 | #endif |
| 6823 | |
| 6824 | #endif |