MCPcopy Create free account
hub / github.com/ZDoom/Raze / LayoutInlineBlock

Method LayoutInlineBlock

libraries/ZWidget/src/core/span_layout.cpp:513–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

511}
512
513void SpanLayout::LayoutInlineBlock(CurrentLine& current_line, double max_width, std::vector<TextBlock>& blocks, std::vector<TextBlock>::size_type block_index)
514{
515 Size size;
516 LineSegment segment;
517 if (objects[current_line.object_index].type == object_image)
518 {
519 size = Size(objects[current_line.object_index].image->GetWidth(), objects[current_line.object_index].image->GetHeight());
520 segment.type = object_image;
521 segment.image = objects[current_line.object_index].image;
522 }
523 else if (objects[current_line.object_index].type == object_component)
524 {
525 size = objects[current_line.object_index].component->GetSize();
526 segment.type = object_component;
527 segment.component = objects[current_line.object_index].component;
528 }
529
530 if (current_line.x_position + size.width > max_width)
531 NextLine(current_line);
532
533 segment.x_position = current_line.x_position;
534 segment.width = size.width;
535 segment.start = blocks[block_index].start;
536 segment.end = blocks[block_index].end;
537 segment.id = objects[current_line.object_index].id;
538 segment.ascender = size.height - objects[current_line.object_index].baseline_offset;
539 current_line.cur_line.segments.push_back(segment);
540 current_line.cur_line.height = std::max(current_line.cur_line.height, size.height + objects[current_line.object_index].baseline_offset);
541 current_line.cur_line.ascender = std::max(current_line.cur_line.ascender, segment.ascender);
542 current_line.x_position += size.width;
543}
544
545void SpanLayout::LayoutFloatBlock(CurrentLine& current_line, double max_width)
546{

Callers

nothing calls this directly

Calls 5

SizeClass · 0.85
GetWidthMethod · 0.45
GetHeightMethod · 0.45
GetSizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected