| 2357 | } |
| 2358 | |
| 2359 | static void TextGroupWidget_DrawAdvanced(struct TextGroupWidget* w, struct Texture* tex, struct DrawTextArgs* args, int index, const cc_string* text) { |
| 2360 | char chars[GUI_MAX_CHATLINES * TEXTGROUPWIDGET_LEN]; |
| 2361 | struct Portion portions[2 * (TEXTGROUPWIDGET_LEN / TEXTGROUPWIDGET_HTTP_LEN)]; |
| 2362 | struct Portion bit; |
| 2363 | int width, height; |
| 2364 | int partWidths[Array_Elems(portions)]; |
| 2365 | struct Context2D ctx; |
| 2366 | int portionsCount; |
| 2367 | int i, x, ul; |
| 2368 | |
| 2369 | width = 0; |
| 2370 | height = Drawer2D_TextHeight(args); |
| 2371 | portionsCount = TextGroupWidget_Reduce(w, chars, index, portions); |
| 2372 | |
| 2373 | for (i = 0; i < portionsCount; i++) { |
| 2374 | bit = portions[i]; |
| 2375 | args->text = String_UNSAFE_Substring(text, bit.LineBeg, bit.LineLen); |
| 2376 | |
| 2377 | partWidths[i] = Drawer2D_TextWidth(args); |
| 2378 | width += partWidths[i]; |
| 2379 | } |
| 2380 | |
| 2381 | Context2D_Alloc(&ctx, width, height); |
| 2382 | { |
| 2383 | x = 0; |
| 2384 | for (i = 0; i < portionsCount; i++) { |
| 2385 | bit = portions[i]; |
| 2386 | ul = (bit.Len & TEXTGROUPWIDGET_URL); |
| 2387 | args->text = String_UNSAFE_Substring(text, bit.LineBeg, bit.LineLen); |
| 2388 | |
| 2389 | if (ul) args->font->flags |= FONT_FLAGS_UNDERLINE; |
| 2390 | Context2D_DrawText(&ctx, args, x, 0); |
| 2391 | if (ul) args->font->flags &= ~FONT_FLAGS_UNDERLINE; |
| 2392 | |
| 2393 | x += partWidths[i]; |
| 2394 | } |
| 2395 | Context2D_MakeTexture(tex, &ctx); |
| 2396 | } |
| 2397 | Context2D_Free(&ctx); |
| 2398 | } |
| 2399 | |
| 2400 | void TextGroupWidget_RedrawAll(struct TextGroupWidget* w) { |
| 2401 | int i; |
no test coverage detected