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

	Surface	*surface    = GetDrawSurface();
	Rect	 frame	    = Rect(GetRealPosition(), GetRealSize());
	Int	 arrowColor = Setup::TextColor;

	if (!IsActive()) arrowColor = Setup::InactiveTextColor;

	switch (message)
	{
		case SP_PAINT:
			surface->StartPaint(frame);

			surface->Frame(frame, FRAME_UP);

			if (subtype == OR_HORZ)
			{
				Point	 lineStart	= Point((frame.left + frame.right) / 2 - 1, frame.top + 1);
				Point	 lineEnd	= Point(lineStart.x, frame.bottom - 1);

				surface->Line(lineStart, lineEnd, Setup::DividerDarkColor);
				surface->Line(lineStart + Point(1, 0), lineEnd + Point(1, 0), Setup::DividerLightColor);

				Int	 size		= Math::Round(3 * surface->GetSurfaceDPI() / 96.0);
				Point	 offset		= Point((size % 2) ? 1 : 0, (frame.GetHeight() % 2) ? 0 : 1);

				for (Int i = 0; i < size; i++)
				{
					lineStart	= Point((frame.left + frame.GetWidth() / 4) - size / 2 + i - offset.x, frame.top + frame.GetHeight() / 2 - i - offset.y);
					lineEnd		= lineStart + Point(0, 2 * i + 1);

					surface->Line(lineStart, lineEnd, arrowColor);
				}

				for (Int j = 0; j < size; j++)
				{
					lineStart	= Point((frame.right - frame.GetWidth() / 4) - (size + 1) / 2 + j, frame.top + frame.GetHeight() / 2 - size + 1 + j - offset.y);
					lineEnd		= lineStart + Point(0, 2 * (size - j) - 1);

					surface->Line(lineStart, lineEnd, arrowColor);
				}
			}
			else if (subtype == OR_VERT)
			{
				Point	 lineStart	= Point(frame.left + 1, (frame.top + frame.bottom) / 2 - 1);
				Point	 lineEnd	= Point(frame.right - 1, lineStart.y);

				surface->Line(lineStart, lineEnd, Setup::DividerDarkColor);
				surface->Line(lineStart + Point(0, 1), lineEnd + Point(0, 1), Setup::DividerLightColor);

				Int	 size		= Math::Round(3 * surface->GetSurfaceDPI() / 96.0);

				for (Int i = 0; i < size; i++)
				{
					lineStart	= Point(frame.left + frame.GetWidth() / 2 + (IsRightToLeft() ? 1 : 0) - i, (frame.top + frame.GetHeight() / 4) - size / 2 + i);
					lineEnd		= lineStart + Point(2 * i + 1, 0);

					surface->Line(lineStart, lineEnd, arrowColor);
				}

				for (Int j = 0; j < size; j++)
				{
					lineStart	= Point(frame.left + frame.GetWidth() / 2 + (IsRightToLeft() ? 1 : 0) - size + 1 + j, (frame.bottom - frame.GetHeight() / 4) - (size + 1) / 2 + j);
					lineEnd		= lineStart + Point(2 * (size - j) - 1, 0);

					surface->Line(lineStart, lineEnd, arrowColor);
				}
			}

			surface->EndPaint();

			break;
	}

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %esi, %ebp
movq %rdi, %r15
movq (%rdi), %rax
callq *0x88(%rax)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testb %al, %al
je 0x72944
movq (%r15), %rax
movq %r15, %rdi
callq *0x90(%rax)
xorl %r14d, %r14d
testb %al, %al
je 0x72944
movq (%r15), %rax
movq %r15, %rdi
callq *0x40(%rax)
movq %rax, %r13
movq (%r15), %rax
movq %r15, %rdi
callq *0x48(%rax)
movq %rax, %r12
movq %rax, %rbx
shrq $0x20, %rbx
movq (%r15), %rax
movq %r15, %rdi
callq *0x50(%rax)
leal (%rax,%r12), %ecx
shrq $0x20, %rax
movl %r12d, 0x8(%rsp)
movl %ebx, 0xc(%rsp)
movl %ecx, 0x10(%rsp)
addl %ebx, %eax
movl %eax, 0x14(%rsp)
movq 0xfa5f3(%rip), %rax     # 0x16c9e8
movq 0x8(%rax), %rbx
movq (%r15), %rax
movq %r15, %rdi
callq *0x98(%rax)
testb %al, %al
jne 0x72414
movq 0xfa540(%rip), %rax     # 0x16c950
movq 0x8(%rax), %rbx
testl %ebp, %ebp
jne 0x72944
leaq 0x8(%rsp), %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x55160
movq %r13, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x57890
movzwl 0x1a0(%r15), %eax
cmpl $0x2, %eax
je 0x726ad
cmpl $0x1, %eax
jne 0x7293c
movq %rbx, 0x48(%rsp)
movl 0xc(%rsp), %eax
movl 0x10(%rsp), %ecx
addl 0x8(%rsp), %ecx
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
decl %edx
incl %eax
leaq 0x18(%rsp), %r15
movl %edx, (%r15)
movl %eax, 0x4(%r15)
movl 0x14(%rsp), %eax
decl %eax
leaq 0x20(%rsp), %r12
movl %edx, (%r12)
movl %eax, 0x4(%r12)
movq 0xfa3f0(%rip), %rcx     # 0x16c888
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x58300
movl (%r15), %eax
movl 0x4(%r15), %ecx
incl %eax
shlq $0x20, %rcx
orq %rcx, %rax
leaq 0x38(%rsp), %rsi
movq %rax, (%rsi)
movl (%r12), %eax
movl 0x4(%r12), %ecx
incl %eax
shlq $0x20, %rcx
orq %rcx, %rax
leaq 0x60(%rsp), %rdx
movq %rax, (%rdx)
movq 0xfa399(%rip), %rcx     # 0x16c878
movq %r13, %rdi
callq 0x58300
movq %r13, %rdi
callq 0x58930
cwtl
leal (%rax,%rax,2), %eax
cvtsi2sd %eax, %xmm0
divsd 0x81ff1(%rip), %xmm0    # 0xf44f0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x8227d(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rcx
movl 0x14(%rsp), %eax
subl 0xc(%rsp), %eax
movq %rax, 0x28(%rsp)
movq %rcx, 0x30(%rsp)
testl %ecx, %ecx
jle 0x725f1
movq 0x28(%rsp), %rax
movl %eax, %r15d
orl $-0x2, %r15d
incl %r15d
movq 0x30(%rsp), %rcx
movl %ecx, %eax
andl $0x1, %eax
movl %ecx, %r12d
shrl %r12d
addl %eax, %r12d
movslq 0x48(%rsp), %rbp
negl %r12d
movl $0x1, %ebx
movl %ecx, %r14d
movl 0x10(%rsp), %edx
movl 0x8(%rsp), %eax
movl 0xc(%rsp), %ecx
subl %eax, %edx
leal 0x3(%rdx), %esi
testl %edx, %edx
cmovnsl %edx, %esi
sarl $0x2, %esi
addl %r12d, %eax
addl %esi, %eax
movl 0x14(%rsp), %edx
subl %ecx, %edx
movl %edx, %esi
shrl $0x1f, %esi
addl %edx, %esi
sarl %esi
addl %r15d, %ecx
addl %esi, %ecx
shlq $0x20, %rcx
orq %rcx, %rax
movq %rax, 0x18(%rsp)
movl %eax, %eax
movl 0x1c(%rsp), %ecx
addl %ebx, %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, 0x20(%rsp)
movq %rbp, 0x40(%rsp)
movl $0x0, 0x38(%rsp)
movq %r13, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x20(%rsp), %rdx
leaq 0x38(%rsp), %rcx
callq 0x58300
decl %r15d
incl %r12d
addl $0x2, %ebx
decl %r14d
jne 0x72569
movq 0x30(%rsp), %rax
testl %eax, %eax
movq 0x28(%rsp), %rbp
jle 0x72939
leal 0x1(%rax), %r15d
shrl %r15d
andl $0x1, %ebp
movslq 0x48(%rsp), %r12
negl %r15d
movl %eax, %ebx
negl %ebx
leal -0x1(,%rax,2), %r14d
movl 0x10(%rsp), %eax
movl %eax, %ecx
subl 0x8(%rsp), %ecx
leal 0x3(%rcx), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
movl 0xc(%rsp), %ecx
sarl $0x2, %edx
subl %edx, %eax
addl %r15d, %eax
movl 0x14(%rsp), %edx
subl %ecx, %edx
movl %edx, %esi
shrl $0x1f, %esi
addl %edx, %esi
sarl %esi
addl %ecx, %esi
addl %ebp, %esi
addl %ebx, %esi
shlq $0x20, %rsi
orq %rsi, %rax
movq %rax, 0x18(%rsp)
movl %eax, %eax
movl 0x1c(%rsp), %ecx
addl %r14d, %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, 0x20(%rsp)
movq %r12, 0x40(%rsp)
movl $0x0, 0x38(%rsp)
movq %r13, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x20(%rsp), %rdx
leaq 0x38(%rsp), %rcx
callq 0x58300
incl %r15d
addl $-0x2, %r14d
incl %ebx
jne 0x72621
jmp 0x72939
movq %rbx, 0x48(%rsp)
movl 0x8(%rsp), %eax
movl 0x10(%rsp), %ecx
incl %eax
movl 0x14(%rsp), %edx
addl 0xc(%rsp), %edx
movl %edx, %esi
shrl $0x1f, %esi
addl %edx, %esi
sarl %esi
decl %esi
leaq 0x18(%rsp), %r12
movl %eax, (%r12)
movl %esi, 0x4(%r12)
decl %ecx
movq %r13, 0x28(%rsp)
leaq 0x20(%rsp), %r13
movl %ecx, (%r13)
movl %esi, 0x4(%r13)
movq 0xfa190(%rip), %rcx     # 0x16c888
movq 0x28(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x58300
movl (%r12), %eax
movl 0x4(%r12), %ecx
incl %ecx
shlq $0x20, %rcx
orq %rax, %rcx
leaq 0x38(%rsp), %rsi
movq %rcx, (%rsi)
movl (%r13), %eax
movl 0x4(%r13), %ecx
movq 0x28(%rsp), %r13
incl %ecx
shlq $0x20, %rcx
orq %rax, %rcx
leaq 0x60(%rsp), %rdx
movq %rcx, (%rdx)
movq 0xfa131(%rip), %rcx     # 0x16c878
movq %r13, %rdi
callq 0x58300
movq %r13, %rdi
callq 0x58930
cwtl
leal (%rax,%rax,2), %eax
cvtsi2sd %eax, %xmm0
divsd 0x81d89(%rip), %xmm0    # 0xf44f0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x82015(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, 0x58(%rsp)
testl %eax, %eax
jle 0x72861
movq 0x58(%rsp), %rax
movl %eax, %r12d
shrl %r12d
movslq 0x48(%rsp), %rcx
movq %rcx, 0x30(%rsp)
negl %r12d
negl %eax
movl %eax, 0x54(%rsp)
xorl %ebx, %ebx
movl $0x1, %r14d
movl 0x8(%rsp), %ebp
movl 0x10(%rsp), %eax
subl %ebp, %eax
movl %eax, %r13d
shrl $0x1f, %r13d
addl %eax, %r13d
sarl %r13d
movq (%r15), %rax
movq %r15, %rdi
callq *0x160(%rax)
movzbl %al, %eax
addl %ebp, %r13d
addl %ebx, %r13d
addl %eax, %r13d
movl 0xc(%rsp), %eax
movl 0x14(%rsp), %ecx
subl %eax, %ecx
leal 0x3(%rcx), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
sarl $0x2, %edx
addl %r12d, %eax
addl %edx, %eax
shlq $0x20, %rax
addq %r13, %rax
movq %rax, 0x18(%rsp)
addl %r14d, %r13d
movl 0x1c(%rsp), %eax
shlq $0x20, %rax
orq %rax, %r13
movq %r13, 0x20(%rsp)
movq 0x28(%rsp), %r13
movq 0x30(%rsp), %rax
movq %rax, 0x40(%rsp)
movl $0x0, 0x38(%rsp)
movq %r13, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x20(%rsp), %rdx
leaq 0x38(%rsp), %rcx
callq 0x58300
incl %r12d
decl %ebx
addl $0x2, %r14d
cmpl %ebx, 0x54(%rsp)
jne 0x727b8
movq 0x58(%rsp), %rax
testl %eax, %eax
jle 0x72939
leal 0x1(%rax), %r12d
shrl %r12d
movslq 0x48(%rsp), %rcx
movq %rcx, 0x30(%rsp)
negl %r12d
movl $0x1, %ebp
subl %eax, %ebp
leal -0x1(,%rax,2), %ebx
movl 0x8(%rsp), %r13d
movl 0x10(%rsp), %eax
subl %r13d, %eax
movl %eax, %r14d
shrl $0x1f, %r14d
addl %eax, %r14d
sarl %r14d
movq (%r15), %rax
movq %r15, %rdi
callq *0x160(%rax)
movzbl %al, %eax
addl %r13d, %r14d
movq 0x28(%rsp), %r13
addl %ebp, %r14d
addl %eax, %r14d
movl 0x14(%rsp), %eax
movl %eax, %ecx
subl 0xc(%rsp), %ecx
leal 0x3(%rcx), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
sarl $0x2, %edx
subl %edx, %eax
addl %r12d, %eax
shlq $0x20, %rax
addq %r14, %rax
movq %rax, 0x18(%rsp)
addl %ebx, %r14d
movl 0x1c(%rsp), %eax
shlq $0x20, %rax
orq %rax, %r14
movq %r14, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x40(%rsp)
movl $0x0, 0x38(%rsp)
movq %r13, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x20(%rsp), %rdx
leaq 0x38(%rsp), %rcx
callq 0x58300
incl %r12d
incl %ebp
addl $-0x2, %ebx
cmpl $0x1, %ebp
jne 0x72890
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x58780
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq