// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x148(%rbp)
movq (%rdi), %rax
callq *0x88(%rax)
testb $0x1, %al
jne 0xa7764
leaq -0x28(%rbp), %rdi
movq %rdi, -0x158(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
movq -0x158(%rbp), %rdi
callq 0x59680
movl %eax, -0x14c(%rbp)
jmp 0xa7733
movl -0x14c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5b5b0
jmp 0xa7e24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5b5b0
jmp 0xa7e30
movq -0x148(%rbp), %rdi
movq (%rdi), %rax
callq *0x90(%rax)
testb $0x1, %al
jne 0xa77cd
leaq -0x48(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x5ca80
movq -0x168(%rbp), %rdi
callq 0x59680
movl %eax, -0x15c(%rbp)
jmp 0xa779c
movl -0x15c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5a410
jmp 0xa7e24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5a410
jmp 0xa7e30
movl -0x14(%rbp), %eax
testl %eax, %eax
jne 0xa7dcc
jmp 0xa77da
movq -0x148(%rbp), %rdi
addq $0xf0, %rdi
xorl %esi, %esi
callq 0x5b110
testb $0x1, %al
jne 0xa77f8
jmp 0xa7dca
movq -0x148(%rbp), %rsi
addq $0x140, %rsi            # imm = 0x140
leaq -0x88(%rbp), %rdi
callq 0x59da0
movq -0x148(%rbp), %rdi
movq (%rdi), %rax
movq 0x98(%rax), %rax
callq *%rax
movb %al, -0x169(%rbp)
jmp 0xa782d
movb -0x169(%rbp), %al
testb $0x1, %al
jne 0xa786d
jmp 0xa7839
movq 0x1610f0(%rip), %rsi    # 0x208930
leaq -0x88(%rbp), %rdi
callq 0x5d110
jmp 0xa784e
jmp 0xa786d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x5abf0
jmp 0xa7e30
movq -0x148(%rbp), %rdi
movq (%rdi), %rax
movq 0x48(%rax), %rax
callq *%rax
movq %rax, -0x178(%rbp)
jmp 0xa7886
movq -0x148(%rbp), %rdi
movq -0x178(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq (%rdi), %rax
movq 0x50(%rax), %rax
callq *%rax
movq %rax, -0x180(%rbp)
jmp 0xa78ad
movq -0x180(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq -0xa8(%rbp), %rdx
callq 0x59ff0
jmp 0xa78d7
movq -0x148(%rbp), %rdi
movq (%rdi), %rax
movq 0x40(%rax), %rax
callq *%rax
movq %rax, -0x188(%rbp)
jmp 0xa78f0
movq -0x148(%rbp), %rdi
movq -0x188(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl 0x5b8(%rdi), %eax
movl %eax, -0x190(%rbp)
addq $0x140, %rdi            # imm = 0x140
callq 0x5d970
movw %ax, -0x18a(%rbp)
jmp 0xa7926
movw -0x18a(%rbp), %ax
cwtl
movq 0x16155b(%rip), %rcx    # 0x208e90
movswl (%rcx), %ecx
cmpl %ecx, %eax
jne 0xa7959
movq -0x148(%rbp), %rax
cmpl $0x0, 0x5bc(%rax)
jne 0xa7959
movl $0xd, %eax
movl %eax, -0x194(%rbp)
jmp 0xa796c
movq -0x148(%rbp), %rax
movl 0x5bc(%rax), %eax
movl %eax, -0x194(%rbp)
movl -0x190(%rbp), %esi
movl -0x194(%rbp), %edx
leaq -0xb8(%rbp), %rdi
callq 0x59260
jmp 0xa7986
cmpl $0x0, -0xb8(%rbp)
jne 0xa799d
xorl %eax, %eax
movq %rax, -0x1a0(%rbp)
jmp 0xa7a55
cvtsi2sdl -0xb8(%rbp), %xmm0
movsd %xmm0, -0x1b0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5d470
movw %ax, -0x1a2(%rbp)
jmp 0xa79c2
movq -0x148(%rbp), %rsi
movsd -0x1b0(%rbp), %xmm0
movw -0x1a2(%rbp), %ax
cwtl
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
movsd 0xdfad7(%rip), %xmm1    # 0x1874c0
divsd %xmm1, %xmm0
movsd %xmm0, -0x1c0(%rbp)
movq %rsi, %rdi
addq $0x140, %rdi            # imm = 0x140
addq $0xf0, %rsi
callq 0x5ac00
movl %eax, -0x1b4(%rbp)
jmp 0xa7a13
movsd -0x1c0(%rbp), %xmm0
movl -0x1b4(%rbp), %eax
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
movsd 0xdf957(%rip), %xmm1    # 0x187388
mulsd %xmm1, %xmm0
callq 0x5b240
movq %rax, -0x1c8(%rbp)
jmp 0xa7a43
movq -0x1c8(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rax
movl %eax, -0x1cc(%rbp)
cmpl $0x0, -0xb4(%rbp)
jne 0xa7a79
xorl %eax, %eax
movq %rax, -0x1d8(%rbp)
jmp 0xa7b2e
cvtsi2sdl -0xb4(%rbp), %xmm0
movsd %xmm0, -0x1e8(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5d470
movw %ax, -0x1da(%rbp)
jmp 0xa7a9e
movq -0x148(%rbp), %rdi
movsd -0x1e8(%rbp), %xmm0
movw -0x1da(%rbp), %ax
cwtl
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
movsd 0xdf9fb(%rip), %xmm1    # 0x1874c0
divsd %xmm1, %xmm0
movsd %xmm0, -0x1f8(%rbp)
addq $0x140, %rdi            # imm = 0x140
movq 0x1612c9(%rip), %rsi    # 0x208da8
callq 0x5bde0
movl %eax, -0x1ec(%rbp)
jmp 0xa7aec
movsd -0x1f8(%rbp), %xmm0
movl -0x1ec(%rbp), %eax
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
movsd 0xdf87e(%rip), %xmm1    # 0x187388
mulsd %xmm1, %xmm0
callq 0x5b240
movq %rax, -0x200(%rbp)
jmp 0xa7b1c
movq -0x200(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x1d8(%rbp)
movl -0x1cc(%rbp), %esi
movq -0x1d8(%rbp), %rax
movl %eax, %edx
leaq -0xc0(%rbp), %rdi
callq 0x5c2c0
jmp 0xa7b4b
movq -0xb0(%rbp), %rax
movq %rax, -0x218(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x5be80
movq %rdx, -0x210(%rbp)
movq %rax, -0x208(%rbp)
jmp 0xa7b7c
movq -0x148(%rbp), %rdi
movq -0x210(%rbp), %rax
movq -0x208(%rbp), %rcx
movq %rcx, -0xd0(%rbp)
movq %rax, -0xc8(%rbp)
movq (%rdi), %rax
movq 0x140(%rax), %rax
callq *%rax
movq %rax, -0x220(%rbp)
jmp 0xa7bb4
movq 0x1613e5(%rip), %rax    # 0x208fa0
movl (%rax), %eax
movl %eax, -0x224(%rbp)
leaq -0xd8(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x59260
jmp 0xa7bd5
movl -0x224(%rbp), %ecx
movq -0x220(%rbp), %rdx
movq -0x218(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0xd8(%rbp), %r8
callq 0x5c110
jmp 0xa7bfe
movq -0x148(%rbp), %rax
movq -0xb0(%rbp), %rcx
movq %rcx, -0x240(%rbp)
addq $0xf0, %rax
movq %rax, -0x238(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x5d510
movq %rax, -0x230(%rbp)
jmp 0xa7c35
movq -0x230(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0x108(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x5ca20
movq %rax, -0x248(%rbp)
jmp 0xa7c5f
movq -0x148(%rbp), %rax
movq -0x248(%rbp), %rcx
movq %rcx, -0x100(%rbp)
movl 0x188(%rax), %ecx
movl %ecx, -0x254(%rbp)
cvtsi2sdl 0x18c(%rax), %xmm0
movsd 0xe1e50(%rip), %xmm1    # 0x189ae0
mulsd %xmm1, %xmm0
callq 0x5a970
movq %rax, -0x250(%rbp)
jmp 0xa7ca2
movl -0x254(%rbp), %esi
movq -0x250(%rbp), %rax
movl %eax, %edx
leaq -0x110(%rbp), %rdi
callq 0x59260
jmp 0xa7cbf
leaq -0xf8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
leaq -0x110(%rbp), %rdx
callq 0x59ff0
jmp 0xa7cdb
movq -0x148(%rbp), %rdi
movq (%rdi), %rax
movq 0x130(%rax), %rax
callq *%rax
movq %rdx, -0x268(%rbp)
movq %rax, -0x260(%rbp)
jmp 0xa7cfe
movq -0x268(%rbp), %rax
movq -0x260(%rbp), %rcx
movq %rcx, -0x130(%rbp)
movq %rax, -0x128(%rbp)
leaq -0x130(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x5be80
movq %rdx, -0x278(%rbp)
movq %rax, -0x270(%rbp)
jmp 0xa7d3d
movq -0x278(%rbp), %rax
movq -0x270(%rbp), %rcx
movq %rcx, -0x120(%rbp)
movq %rax, -0x118(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x5d6a0
movq %rdx, -0x288(%rbp)
movq %rax, -0x280(%rbp)
jmp 0xa7d7c
movq -0x238(%rbp), %rsi
movq -0x240(%rbp), %rdi
movq -0x288(%rbp), %rax
movq -0x280(%rbp), %rcx
movq %rcx, -0xe8(%rbp)
movq %rax, -0xe0(%rbp)
leaq -0xe8(%rbp), %rdx
leaq -0x88(%rbp), %rcx
xorl %r8d, %r8d
callq 0x5c3f0
jmp 0xa7dbe
leaq -0x88(%rbp), %rdi
callq 0x5abf0
jmp 0xa7dcc
leaq -0x140(%rbp), %rdi
movq %rdi, -0x298(%rbp)
callq 0x5ca80
movq -0x298(%rbp), %rdi
callq 0x59680
movl %eax, -0x28c(%rbp)
jmp 0xa7df3
movl -0x28c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x5a410
jmp 0xa7e24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x5a410
jmp 0xa7e30
movl -0x4(%rbp), %eax
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x5b6b0
nopl (%rax)