// File: /workspace/github_c_makefile_star2_O3/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 $0x58, %rsp
movl %esi, %ebp
movq %rdi, %r15
movq (%rdi), %rax
callq *0x88(%rax)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testb %al, %al
je 0x725da
movq (%r15), %rax
movq %r15, %rdi
callq *0x90(%rax)
xorl %r14d, %r14d
testb %al, %al
je 0x725da
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, (%rsp)
movl %ebx, 0x4(%rsp)
movl %ecx, 0x8(%rsp)
addl %ebx, %eax
movl %eax, 0xc(%rsp)
movq 0xf9914(%rip), %rax     # 0x16b9e8
movq 0x8(%rax), %rbx
movq (%r15), %rax
movq %r15, %rdi
callq *0x98(%rax)
testb %al, %al
jne 0x720f3
movq 0xf9861(%rip), %rax     # 0x16b950
movq 0x8(%rax), %rbx
testl %ebp, %ebp
jne 0x725da
movq %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 0x72386
cmpl $0x1, %eax
jne 0x725d2
movl 0x4(%rsp), %eax
movl 0x8(%rsp), %ecx
addl (%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 0xc(%rsp), %eax
decl %eax
leaq 0x10(%rsp), %r12
movl %edx, (%r12)
movl %eax, 0x4(%r12)
movq 0xf9719(%rip), %rcx     # 0x16b888
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 0x28(%rsp), %rsi
movq %rax, (%rsi)
movl (%r12), %eax
movl 0x4(%r12), %ecx
incl %eax
shlq $0x20, %rcx
orq %rcx, %rax
leaq 0x50(%rsp), %rdx
movq %rax, (%rdx)
movq 0xf96c2(%rip), %rcx     # 0x16b878
movq %r13, %rdi
callq 0x58300
movq %r13, %rdi
callq 0x58930
cwtl
leal (%rax,%rax,2), %eax
cvtsi2sd %eax, %xmm0
divsd 0x814e2(%rip), %xmm0    # 0xf36b8
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x8394e(%rip), %rcx     # 0xf5b38
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rcx
testl %ecx, %ecx
movq %r13, %rdi
jle 0x7237e
movl 0xc(%rsp), %ebp
subl 0x4(%rsp), %ebp
movq %rbp, 0x38(%rsp)
orl $-0x2, %ebp
leal 0x1(%rbp), %r15d
movl %ecx, %eax
andl $0x1, %eax
movl %ecx, %r12d
shrl %r12d
addl %eax, %r12d
movq %rbx, 0x40(%rsp)
movslq %ebx, %rax
movq %rax, 0x20(%rsp)
addl $0x2, %ebp
negl %r12d
movq %rcx, 0x48(%rsp)
movl %ecx, %ebx
movl 0x8(%rsp), %ecx
movl (%rsp), %eax
movl 0x4(%rsp), %edx
subl %eax, %ecx
leal 0x3(%rcx), %esi
testl %ecx, %ecx
cmovnsl %ecx, %esi
sarl $0x2, %esi
addl %r12d, %eax
addl %esi, %eax
movl 0xc(%rsp), %ecx
subl %edx, %ecx
movl %ecx, %esi
shrl $0x1f, %esi
addl %ecx, %esi
sarl %esi
addl %edx, %esi
leal (%r15,%rsi), %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, 0x18(%rsp)
addl %ebp, %esi
shlq $0x20, %rsi
orq %rax, %rsi
movq %rsi, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x30(%rsp)
movl $0x0, 0x28(%rsp)
movq %rdi, %r13
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0x58300
movq %r13, %rdi
incl %ebp
decl %r15d
incl %r12d
decl %ebx
jne 0x7223b
movq 0x48(%rsp), %rcx
testl %ecx, %ecx
movq 0x40(%rsp), %rax
movq 0x38(%rsp), %r15
jle 0x7237e
leal 0x1(%rcx), %ebp
shrl %ebp
andl $0x1, %r15d
cltq
movq %rax, 0x20(%rsp)
negl %ebp
movl %ecx, %r12d
negl %r12d
leal (%r15,%rcx), %ebx
decl %ebx
movl 0x4(%rsp), %ecx
movl 0x8(%rsp), %eax
movl %eax, %edx
subl (%rsp), %edx
leal 0x3(%rdx), %esi
testl %edx, %edx
cmovnsl %edx, %esi
sarl $0x2, %esi
subl %esi, %eax
addl %ebp, %eax
movl 0xc(%rsp), %edx
subl %ecx, %edx
movl %edx, %esi
shrl $0x1f, %esi
addl %edx, %esi
sarl %esi
addl %ecx, %esi
leal (%r15,%r12), %ecx
addl %esi, %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, 0x18(%rsp)
addl %ebx, %esi
shlq $0x20, %rsi
orq %rax, %rsi
movq %rsi, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x30(%rsp)
movl $0x0, 0x28(%rsp)
movq %r13, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0x58300
movq %r13, %rdi
incl %ebp
decl %ebx
incl %r12d
jne 0x722f8
movq %rdi, %r13
jmp 0x725d2
movl (%rsp), %eax
movl 0x8(%rsp), %ecx
incl %eax
movl 0xc(%rsp), %edx
addl 0x4(%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, %r14
leaq 0x10(%rsp), %r13
movl %ecx, (%r13)
movl %esi, 0x4(%r13)
movq 0xf94bf(%rip), %rcx     # 0x16b888
movq %r14, %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 0x28(%rsp), %rsi
movq %rcx, (%rsi)
movl (%r13), %eax
movl 0x4(%r13), %ecx
incl %ecx
shlq $0x20, %rcx
orq %rax, %rcx
leaq 0x50(%rsp), %rdx
movq %rcx, (%rdx)
movq 0xf9467(%rip), %rcx     # 0x16b878
movq %r14, %rdi
callq 0x58300
movq %r14, 0x20(%rsp)
movq %r14, %rdi
callq 0x58930
cwtl
leal (%rax,%rax,2), %eax
cvtsi2sd %eax, %xmm0
divsd 0x81282(%rip), %xmm0    # 0xf36b8
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x836ee(%rip), %rcx     # 0xf5b38
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %r12
testl %r12d, %r12d
jle 0x725ca
movl %r12d, %r13d
shrl %r13d
movq %rbx, 0x40(%rsp)
movslq %ebx, %rax
movq %rax, 0x38(%rsp)
xorl %ebp, %ebp
movl (%rsp), %r14d
movl 0x8(%rsp), %eax
subl %r14d, %eax
movl %eax, %ebx
shrl $0x1f, %ebx
addl %eax, %ebx
sarl %ebx
movq (%r15), %rax
movq %r15, %rdi
callq *0x160(%rax)
movzbl %al, %eax
subl %ebp, %r14d
addl %ebx, %r14d
addl %eax, %r14d
movl 0x4(%rsp), %eax
movl 0xc(%rsp), %ecx
subl %eax, %ecx
leal 0x3(%rcx), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
sarl $0x2, %edx
movl %ebp, %ecx
subl %r13d, %ecx
addl %eax, %ecx
addl %edx, %ecx
shlq $0x20, %rcx
leaq (%r14,%rcx), %rax
movq %rax, 0x18(%rsp)
leal (%r14,%rbp,2), %eax
incl %eax
orq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x30(%rsp)
movl $0x0, 0x28(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0x58300
incl %ebp
cmpl %r12d, %ebp
jne 0x72472
testl %r12d, %r12d
movq 0x40(%rsp), %rax
jle 0x725ca
leal 0x1(%r12), %r13d
shrl %r13d
cltq
movq %rax, 0x38(%rsp)
negl %r13d
movl $0x1, %ebp
subl %r12d, %ebp
movl (%rsp), %r14d
movl 0x8(%rsp), %eax
subl %r14d, %eax
movl %eax, %ebx
shrl $0x1f, %ebx
addl %eax, %ebx
sarl %ebx
movq (%r15), %rax
movq %r15, %rdi
callq *0x160(%rax)
movzbl %al, %eax
addl %r14d, %ebx
addl %eax, %ebx
movl 0xc(%rsp), %eax
movl %eax, %ecx
subl 0x4(%rsp), %ecx
leal 0x3(%rcx), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
leal (%rbx,%rbp), %ecx
sarl $0x2, %edx
subl %edx, %eax
addl %r13d, %eax
shlq $0x20, %rax
orq %rax, %rcx
movq %rcx, 0x18(%rsp)
addl %r12d, %ebx
orq %rax, %rbx
movq %rbx, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x30(%rsp)
movl $0x0, 0x28(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0x58300
incl %r13d
incl %ebp
decl %r12d
jne 0x72535
xorl %r14d, %r14d
movq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0x58780
movl %r14d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq