// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/classes/gui/widgets/basic/text.cpp
// Function: smooth::GUI::Text::SetFont(smooth::GUI::Font const&)
S::Int S::GUI::Text::SetFont(const Font &nFont)
{
	if (font == nFont) return Success();

	Surface	*surface    = GetDrawSurface();

	Bool	 registered = IsRegistered();
	Bool	 visible    = IsVisible();

	if (registered && visible)
	{
		Rect	 oldRect = Rect(GetRealPosition(), GetRealSize());
		Rect	 newRect = Rect(oldRect.GetPosition(), Size(nFont.GetScaledTextSizeX(text), nFont.GetScaledTextSizeY(text)));

		surface->StartPaint(Rect::EncloseRect(oldRect, newRect));
	}

	Widget::SetFont(nFont);

	SetSize(scaledTextSize * 96.0 / Surface().GetSurfaceDPI() + Size(0, 2));

	Paint(SP_PAINT);

	if (registered && visible) surface->EndPaint();

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r15
movq %rdi, %rbx
addq $0x140, %rdi            # imm = 0x140
callq 0x58dc0
testb %al, %al
jne 0x7f9a3
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
movq %rax, %r13
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x88(%rax)
movl %eax, %r12d
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x90(%rax)
movl %eax, %ebp
andb %r12b, %bpl
cmpb $0x1, %bpl
jne 0x7f881
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq %rax, %r12
movb %bpl, 0xf(%rsp)
movq %rax, %rbp
shrq $0x20, %rbp
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
leal (%rax,%r12), %ecx
shrq $0x20, %rax
leaq 0x38(%rsp), %rdx
movq %r12, (%rdx)
movl %ecx, 0x8(%rdx)
addl %ebp, %eax
movl %eax, 0xc(%rdx)
leaq 0xf0(%rbx), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x56730
movq %r13, 0x10(%rsp)
movl %eax, %r13d
movq %r15, %rdi
movq %r14, %rsi
callq 0x57680
leaq 0x28(%rsp), %rsi
movl %r12d, (%rsi)
movl %ebp, 0x4(%rsi)
addl %r12d, %r13d
movl %r13d, 0x8(%rsi)
movq 0x10(%rsp), %r13
addl %ebp, %eax
movb 0xf(%rsp), %bpl
movl %eax, 0xc(%rsi)
leaq 0x38(%rsp), %rdi
callq 0x57450
leaq 0x48(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq %r13, %rdi
callq 0x55160
movq %rbx, %rdi
movq %r15, %rsi
callq 0x55eb0
movsd 0x188(%rbx), %xmm0
movapd %xmm0, 0x10(%rsp)
leaq 0x48(%rsp), %rdx
movq $0x0, (%rdx)
leaq 0x28(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x57150
movq %r14, %rdi
callq 0x58930
cvtdq2pd 0x10(%rsp), %xmm0
cwtl
cvtsi2sd %eax, %xmm1
mulpd 0x73c50(%rip), %xmm0    # 0xf3520
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm3
cmpltpd %xmm2, %xmm3
movapd 0x73c4b(%rip), %xmm4    # 0xf3530
movapd 0x73c53(%rip), %xmm5    # 0xf3540
movapd %xmm5, %xmm6
andpd %xmm3, %xmm6
andnpd %xmm4, %xmm3
orpd %xmm6, %xmm3
addpd %xmm0, %xmm3
cvttsd2si %xmm3, %rax
movq %rax, %xmm0
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
cvttsd2si %xmm3, %rax
movq %rax, %xmm3
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
cvtdq2pd %xmm0, %xmm0
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
divpd %xmm1, %xmm0
movapd %xmm0, %xmm1
cmpltpd %xmm2, %xmm1
andpd %xmm1, %xmm5
andnpd %xmm4, %xmm1
orpd %xmm5, %xmm1
addpd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
cvttsd2si %xmm1, %rcx
shlq $0x20, %rcx
movl %eax, %eax
orq %rcx, %rax
movabsq $0x200000000, %rcx      # imm = 0x200000000
addq %rax, %rcx
leaq 0x38(%rsp), %rdx
movq %rcx, (%rdx)
leaq 0xa8(%rbx), %rsi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x150(%rax)
leaq 0x28(%rsp), %rdi
callq 0x57b20
movq (%rbx), %rax
movq %rbx, %rdi
xorl %esi, %esi
callq *0x78(%rax)
testb %bpl, %bpl
je 0x7f9a3
movq %r13, %rdi
callq 0x58780
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7f9b6
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x57b20
movq %rbx, %rdi
callq 0x57090
nop