// File: /workspace/github_c_makefile_star2_O2/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 $0xa8, %rsp
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rax
callq *0x88(%rax)
testb %al, %al
je 0x7d822
movq (%r14), %rax
movq %r14, %rdi
callq *0x90(%rax)
xorl %ebp, %ebp
testl %ebx, %ebx
jne 0x7d825
testb %al, %al
je 0x7d825
leaq 0xf0(%r14), %rbx
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x57d40
testb %al, %al
je 0x7d825
leaq 0x140(%r14), %r12
leaq 0x48(%rsp), %rdi
movq %r12, %rsi
callq 0x56bf0
movq (%r14), %rax
movq %r14, %rdi
callq *0x98(%rax)
testb %al, %al
jne 0x7d5e1
movq 0xe4379(%rip), %rsi     # 0x161950
leaq 0x48(%rsp), %rdi
callq 0x59940
movq (%r14), %rax
movq %r14, %rdi
callq *0x48(%rax)
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
callq *0x50(%rax)
movq %r15, %rcx
shrq $0x20, %rcx
movq %rax, %rdx
shrq $0x20, %rdx
movl %r15d, 0x18(%rsp)
movl %ecx, 0x1c(%rsp)
addl %r15d, %eax
movl %eax, 0x20(%rsp)
addl %ecx, %edx
movl %edx, 0x24(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x40(%rax)
movq %rax, (%rsp)
movq %rbx, 0x10(%rsp)
movl 0x5b8(%r14), %ebx
movq %r12, %rdi
callq 0x5a090
movq 0xe4856(%rip), %rcx     # 0x161e98
movl 0x5bc(%r14), %edx
testl %edx, %edx
pushq $0xd
popq %r15
cmovnel %edx, %r15d
cmpw (%rcx), %ax
cmovnel %edx, %r15d
xorl %r13d, %r13d
movl $0x0, %ebp
testl %ebx, %ebx
je 0x7d6af
movq (%rsp), %rdi
callq 0x59c60
movl %eax, %ebp
movq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x57870
cvtsi2sd %ebx, %xmm1
movswl %bp, %ecx
cvtsi2sd %ecx, %xmm0
mulsd %xmm1, %xmm0
divsd 0x65e7b(%rip), %xmm0    # 0xe3510
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
mulsd 0x65cdb(%rip), %xmm0    # 0xe3380
callq 0x57e30
movq %rax, %rbp
decl %ebp
testl %r15d, %r15d
je 0x7d703
movq (%rsp), %rdi
callq 0x59c60
movl %eax, %r13d
movq 0xe46f1(%rip), %rsi     # 0x161db8
movq %r12, %rdi
callq 0x588a0
cvtsi2sd %r15d, %xmm1
movswl %r13w, %ecx
cvtsi2sd %ecx, %xmm0
mulsd %xmm1, %xmm0
divsd 0x65e28(%rip), %xmm0    # 0xe3510
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
mulsd 0x65c88(%rip), %xmm0    # 0xe3380
callq 0x57e30
movq %rax, %r13
decl %r13d
leaq 0x8(%rsp), %rsi
movl %ebp, (%rsi)
movl %r13d, 0x4(%rsi)
leaq 0x18(%rsp), %rdi
callq 0x58930
movq %rax, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x140(%rax)
movq 0xe4873(%rip), %rcx     # 0x161fa8
movl (%rcx), %ecx
leaq 0x28(%rsp), %r8
andq $0x0, (%r8)
leaq 0x38(%rsp), %rsi
movq (%rsp), %rdi
movq %rax, %rdx
callq 0x58b80
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %rax
movl 0x8(%rsp), %ecx
addl %eax, %ecx
shrq $0x20, %rax
addl 0xc(%rsp), %eax
cvtsi2sdl 0x18c(%r14), %xmm0
mulsd 0x68436(%rip), %xmm0    # 0xe5bb0
xorpd %xmm1, %xmm1
xorl %edx, %edx
ucomisd %xmm0, %xmm1
seta %dl
leaq 0x661e2(%rip), %rsi     # 0xe3970
addsd (%rsi,%rdx,8), %xmm0
cvttsd2si %xmm0, %rdx
movl 0x188(%r14), %esi
addl %ecx, %esi
movl %ecx, 0x28(%rsp)
movl %eax, 0x2c(%rsp)
movl %esi, 0x30(%rsp)
addl %eax, %edx
movl %edx, 0x34(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x130(%rax)
leaq 0x88(%rsp), %rdi
movq %rax, (%rdi)
movq %rdx, 0x8(%rdi)
leaq 0x8(%rsp), %rsi
callq 0x58930
leaq 0x98(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
leaq 0x28(%rsp), %rdi
callq 0x59e30
leaq 0x38(%rsp), %r8
movq %rax, (%r8)
movq %rdx, 0x8(%r8)
leaq 0x48(%rsp), %rcx
xorl %ebp, %ebp
movq (%rsp), %rdi
movq %rbx, %rsi
movq %r8, %rdx
xorl %r8d, %r8d
callq 0x58df0
leaq 0x48(%rsp), %rdi
callq 0x57860
jmp 0x7d825
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7d849
jmp 0x7d849
jmp 0x7d849
jmp 0x7d849
jmp 0x7d849
jmp 0x7d849
jmp 0x7d849
jmp 0x7d849
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x57860
movq %rbx, %rdi
callq 0x58260