// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/classes/gui/widgets/basic/text.cpp
// Function: smooth::GUI::Text::Paint(int)
S::Int S::GUI::Text::Paint(Int message)
{
	if (!IsRegistered()) return Error();
	if (!IsVisible())    return Success();

	switch (message)
	{
		case SP_PAINT:
			if (text != NIL)
			{
				Font	 nFont	    = font;

				if (!IsActive()) nFont.SetColor(Setup::InactiveTextColor);

				Rect	 rect	    = Rect(GetRealPosition(), GetRealSize());
				Surface	*surface    = GetDrawSurface();

				Size	 alignToUse = Size(align.cx, (font.GetSize() == Font::DefaultSize && align.cy == 0) ? 13 : align.cy);
				Point	 alignment  = Point(alignToUse.cx == 0 ? 0 : Math::Ceil(Float(Float(alignToUse.cx) * surface->GetSurfaceDPI() / 96.0 - font.GetScaledTextSizeX(text)) / 2) - 1,
							    alignToUse.cy == 0 ? 0 : Math::Ceil(Float(Float(alignToUse.cy) * surface->GetSurfaceDPI() / 96.0 - font.GetScaledTextSizeY())     / 2) - 1);

				surface->Box(rect + alignment, GetBackgroundColor(), Rect::Filled);
				surface->SetText(text, Rect::OverlapRect(Rect(rect.GetPosition() + alignment, Size(scaledTextSize.cx, Math::Round(scaledTextSize.cy * 1.2))), GetVisibleArea() + alignment), nFont);
			}

			break;
	}

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %esi, %ebp
movq %rdi, %r14
movq (%rdi), %rax
callq *0x88(%rax)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb %al, %al
je 0x7f506
movq (%r14), %rax
movq %r14, %rdi
callq *0x90(%rax)
xorl %ebx, %ebx
testl %ebp, %ebp
jne 0x7f506
testb %al, %al
je 0x7f506
leaq 0xf0(%r14), %r12
xorl %ebx, %ebx
movq %r12, %rdi
xorl %esi, %esi
callq 0x56bd0
testb %al, %al
je 0x7f506
leaq 0x140(%r14), %r15
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x55b70
movq (%r14), %rax
movq %r14, %rdi
callq *0x98(%rax)
testb %al, %al
jne 0x7f2a6
movq 0xec6b4(%rip), %rsi     # 0x16b950
leaq 0x48(%rsp), %rdi
callq 0x58650
movq (%r14), %rax
movq %r14, %rdi
callq *0x48(%rax)
movq %rax, %rbx
movq (%r14), %rax
movq %r14, %rdi
callq *0x50(%rax)
movq %rax, %r13
movq (%r14), %rax
movq %r14, %rdi
callq *0x40(%rax)
movq %rax, 0x8(%rsp)
movq %r13, 0x28(%rsp)
movq %rbx, 0x30(%rsp)
movq %r12, 0x10(%rsp)
movl 0x5b8(%r14), %ebp
movq %r15, %rdi
callq 0x58d40
movq 0xecba7(%rip), %rcx     # 0x16be98
movl 0x5bc(%r14), %edx
testl %edx, %edx
movl $0xd, %ebx
cmovnel %edx, %ebx
cmpw (%rcx), %ax
cmovnel %edx, %ebx
xorl %r12d, %r12d
movl $0x0, %r13d
testl %ebp, %ebp
je 0x7f365
movq 0x8(%rsp), %rdi
callq 0x58930
movl %eax, %r13d
movq %r15, %rdi
movq 0x10(%rsp), %rsi
callq 0x56730
cvtsi2sd %ebp, %xmm1
movswl %r13w, %ecx
cvtsi2sd %ecx, %xmm0
mulsd %xmm1, %xmm0
divsd 0x74371(%rip), %xmm0    # 0xf36b8
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
mulsd 0x7403e(%rip), %xmm0    # 0xf3398
callq 0x56cb0
movq %rax, %r13
decl %r13d
testl %ebx, %ebx
je 0x7f3c1
movq 0x8(%rsp), %rdi
callq 0x58930
movl %eax, %r12d
movq 0xeca3b(%rip), %rsi     # 0x16bdb8
movq %r15, %rdi
callq 0x57680
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
movswl %r12w, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
mulsd %xmm1, %xmm0
divsd 0x74315(%rip), %xmm0    # 0xf36b8
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
mulsd 0x73fe2(%rip), %xmm0    # 0xf3398
callq 0x56cb0
movq %rax, %r12
decl %r12d
movq 0x30(%rsp), %rdx
movq %rdx, %rbx
shrq $0x20, %rbx
movq 0x28(%rsp), %rcx
movq %rcx, %rax
shrq $0x20, %rax
addl %edx, %ecx
addl %ebx, %eax
leal (%rdx,%r13), %r15d
addl %r12d, %ebx
movq %rbx, %rdx
shlq $0x20, %rdx
addl %r13d, %ecx
addl %r12d, %eax
addq %r15, %rdx
shlq $0x20, %rax
orq %rax, %rcx
movq %rdx, 0x38(%rsp)
movq %rcx, 0x40(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x140(%rax)
movq 0xecb90(%rip), %rcx     # 0x16bfa8
movl (%rcx), %ecx
leaq 0x18(%rsp), %r8
movq $0x0, (%r8)
leaq 0x38(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq %rax, %rdx
callq 0x57930
xorps %xmm0, %xmm0
cvtsi2sdl 0x18c(%r14), %xmm0
mulsd 0x7679c(%rip), %xmm0    # 0xf5be8
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x74390(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movl 0x188(%r14), %ecx
addl %r15d, %ecx
movl %r15d, 0x18(%rsp)
movl %ebx, 0x1c(%rsp)
movl %ecx, 0x20(%rsp)
addl %ebx, %eax
movl %eax, 0x24(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x130(%rax)
movq %rax, %rcx
shrq $0x20, %rcx
addl %r13d, %eax
addl %r12d, %ecx
shlq $0x20, %rcx
movq %rdx, %rsi
shrq $0x20, %rsi
addl %r13d, %edx
addl %r12d, %esi
orq %rcx, %rax
shlq $0x20, %rsi
orq %rsi, %rdx
leaq 0x88(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
leaq 0x18(%rsp), %rdi
callq 0x58af0
leaq 0x38(%rsp), %r8
movq %rax, (%r8)
movq %rdx, 0x8(%r8)
leaq 0x48(%rsp), %rcx
xorl %ebx, %ebx
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r8, %rdx
xorl %r8d, %r8d
callq 0x57b80
leaq 0x48(%rsp), %rdi
callq 0x56720
movl %ebx, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7f52a
jmp 0x7f52a
jmp 0x7f52a
jmp 0x7f52a
jmp 0x7f52a
jmp 0x7f52a
jmp 0x7f52a
jmp 0x7f52a
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x56720
movq %rbx, %rdi
callq 0x57090
nop