// File: /workspace/github_c_makefile_star2_O2/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, %ebx
movq %rdi, %r15
movq (%rdi), %rax
callq *0x88(%rax)
testb %al, %al
je 0x71e9f
movq (%r15), %rax
movq %r15, %rdi
callq *0x90(%rax)
xorl %ebp, %ebp
testb %al, %al
je 0x71ea2
movq (%r15), %rax
movq %r15, %rdi
callq *0x40(%rax)
movq %rax, 0x20(%rsp)
movq (%r15), %rax
movq %r15, %rdi
callq *0x48(%rax)
movq %rax, %r12
movq %rax, %r14
shrq $0x20, %r14
movq (%r15), %rax
movq %r15, %rdi
callq *0x50(%rax)
leal (%rax,%r12), %ecx
shrq $0x20, %rax
movl %r12d, (%rsp)
movl %r14d, 0x4(%rsp)
movl %ecx, 0x8(%rsp)
addl %r14d, %eax
movl %eax, 0xc(%rsp)
movq 0xefd31(%rip), %rax     # 0x1619e8
movq 0x8(%rax), %r13
movq (%r15), %rax
movq %r15, %rdi
callq *0x98(%rax)
testb %al, %al
jne 0x71cd6
movq 0xefc7e(%rip), %rax     # 0x161950
movq 0x8(%rax), %r13
testl %ebx, %ebx
jne 0x71ea2
movq %rsp, %r12
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x56160
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x58ad0
movzwl 0x1a0(%r15), %eax
cmpl $0x2, %eax
je 0x71f59
cmpl $0x1, %eax
jne 0x721ae
movl 0x8(%rsp), %eax
addl (%rsp), %eax
movl 0x4(%rsp), %ecx
pushq $0x2
popq %rsi
cltd
idivl %esi
decl %eax
incl %ecx
leaq 0x18(%rsp), %r14
movl %eax, (%r14)
movl %ecx, 0x4(%r14)
movl 0xc(%rsp), %ecx
decl %ecx
leaq 0x10(%rsp), %r15
movl %eax, (%r15)
movl %ecx, 0x4(%r15)
movq 0xefb36(%rip), %rcx     # 0x161888
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x595b0
movl (%r14), %eax
movl 0x4(%r14), %ecx
incl %eax
shlq $0x20, %rcx
orq %rcx, %rax
leaq 0x30(%rsp), %rsi
movq %rax, (%rsi)
movl (%r15), %eax
movl 0x4(%r15), %ecx
incl %eax
shlq $0x20, %rcx
orq %rcx, %rax
leaq 0x50(%rsp), %rdx
movq %rax, (%rdx)
movq 0xefadc(%rip), %rcx     # 0x161878
movq %rbx, %rdi
callq 0x595b0
movq %rbx, %rdi
callq 0x59c60
cwtl
leal (%rax,%rax,2), %eax
cvtsi2sd %eax, %xmm0
divsd 0x71754(%rip), %xmm0    # 0xe3510
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x71ba0(%rip), %rcx     # 0xe3970
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rsi
movl %esi, %ecx
andl $0x1, %ecx
movl 0xc(%rsp), %r15d
subl 0x4(%rsp), %r15d
movq %r15, 0x48(%rsp)
orl $-0x2, %r15d
leal 0x1(%r15), %r12d
pushq $-0x2
popq %rdi
movl %esi, %eax
cltd
idivl %edi
movl %eax, %ebp
movslq %r13d, %rax
movq %rax, 0x28(%rsp)
xorl %r13d, %r13d
testl %esi, %esi
movq %rsi, 0x40(%rsp)
cmovgl %esi, %r13d
addl $0x2, %r15d
subl %ecx, %ebp
pushq $0x4
popq %rbx
movl %r13d, %r14d
subl $0x1, %r14d
jb 0x71eb3
movl 0x8(%rsp), %eax
movl (%rsp), %ecx
movl 0x4(%rsp), %esi
subl %ecx, %eax
cltd
idivl %ebx
addl %ebp, %ecx
addl %eax, %ecx
movl 0xc(%rsp), %eax
subl %esi, %eax
cltd
pushq $0x2
popq %rdi
idivl %edi
addl %esi, %eax
leal (%r12,%rax), %edx
shlq $0x20, %rdx
orq %rcx, %rdx
movq %rdx, 0x18(%rsp)
addl %r15d, %eax
shlq $0x20, %rax
orq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x38(%rsp)
andl $0x0, 0x30(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x30(%rsp), %rcx
callq 0x595b0
incl %r15d
decl %r12d
incl %ebp
jmp 0x71e22
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x40(%rsp), %rcx
leal 0x1(%rcx), %eax
cltd
pushq $-0x2
popq %rsi
idivl %esi
movl %eax, %ebp
movq 0x48(%rsp), %rax
andl $0x1, %eax
movl %eax, %ebx
subl %ecx, %ebx
leal (%rax,%rcx), %r15d
decl %r15d
pushq $-0x4
popq %r14
leaq 0x30(%rsp), %r12
subl $0x1, %r13d
jb 0x721ac
movl 0x4(%rsp), %esi
movl 0x8(%rsp), %ecx
movl %ecx, %eax
subl (%rsp), %eax
cltd
idivl %r14d
addl %ebp, %ecx
addl %eax, %ecx
movl 0xc(%rsp), %eax
subl %esi, %eax
cltd
pushq $0x2
popq %rdi
idivl %edi
addl %esi, %eax
leal (%rbx,%rax), %edx
shlq $0x20, %rdx
orq %rcx, %rdx
movq %rdx, 0x18(%rsp)
addl %r15d, %eax
shlq $0x20, %rax
orq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x38(%rsp)
andl $0x0, 0x30(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %r12, %rcx
callq 0x595b0
decl %r15d
incl %ebx
incl %ebp
jmp 0x71edf
movq $0x0, 0x28(%rsp)
movl (%rsp), %ecx
movl 0x8(%rsp), %esi
incl %ecx
movl 0xc(%rsp), %eax
addl 0x4(%rsp), %eax
pushq $0x2
popq %rdi
cltd
idivl %edi
decl %eax
leaq 0x18(%rsp), %r14
movl %ecx, (%r14)
movl %eax, 0x4(%r14)
decl %esi
leaq 0x10(%rsp), %r12
movl %esi, (%r12)
movl %eax, 0x4(%r12)
movq 0xef8ea(%rip), %rcx     # 0x161888
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x595b0
movl (%r14), %eax
movl 0x4(%r14), %ecx
incl %ecx
shlq $0x20, %rcx
orq %rax, %rcx
leaq 0x30(%rsp), %rsi
movq %rcx, (%rsi)
movl (%r12), %eax
movl 0x4(%r12), %ecx
incl %ecx
shlq $0x20, %rcx
orq %rax, %rcx
leaq 0x50(%rsp), %rdx
movq %rcx, (%rdx)
movq 0xef88e(%rip), %rcx     # 0x161878
movq %rbx, %rdi
callq 0x595b0
movq %rbx, %rdi
callq 0x59c60
cwtl
leal (%rax,%rax,2), %eax
cvtsi2sd %eax, %xmm0
divsd 0x71506(%rip), %xmm0    # 0xe3510
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x71952(%rip), %rcx     # 0xe3970
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %r12
pushq $-0x2
popq %rcx
movl %r12d, %eax
cltd
idivl %ecx
movq %rax, 0x48(%rsp)
testl %r12d, %r12d
movl $0x0, %r14d
cmovgl %r12d, %r14d
movslq %r13d, %rax
movq %rax, 0x40(%rsp)
xorl %r13d, %r13d
cmpl %r13d, %r14d
je 0x720f1
movl (%rsp), %ebx
movl 0x8(%rsp), %eax
subl %ebx, %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %ebp
movq (%r15), %rax
movq %r15, %rdi
callq *0x160(%rax)
movzbl %al, %ecx
addl %ebx, %ecx
addl %ebp, %ecx
movq 0x28(%rsp), %rbx
leal (%rbx,%rcx), %esi
movl 0x4(%rsp), %edi
movl 0xc(%rsp), %eax
subl %edi, %eax
cltd
pushq $0x4
popq %r8
idivl %r8d
addl %edi, %eax
movq 0x48(%rsp), %rdx
addl %r13d, %edx
addl %edx, %eax
shlq $0x20, %rax
orq %rax, %rsi
movq %rsi, 0x18(%rsp)
addl %r13d, %ecx
incl %ecx
orq %rax, %rcx
movq %rcx, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x38(%rsp)
andl $0x0, 0x30(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x30(%rsp), %rcx
callq 0x595b0
incl %r13d
decl %ebx
movq %rbx, 0x28(%rsp)
jmp 0x7204e
movq %r15, 0x28(%rsp)
leal 0x1(%r12), %eax
cltd
pushq $-0x2
popq %rcx
idivl %ecx
movl %eax, %r15d
pushq $0x1
popq %r13
subl %r12d, %r13d
subl $0x1, %r14d
jb 0x721ac
movq %r12, %rbx
movl (%rsp), %r12d
movl 0x8(%rsp), %eax
subl %r12d, %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %ebp
movq 0x28(%rsp), %rdi
movq (%rdi), %rax
callq *0x160(%rax)
movzbl %al, %ecx
addl %r12d, %ecx
movq %rbx, %r12
addl %ebp, %ecx
leal (%rcx,%r13), %esi
movl 0xc(%rsp), %edi
movl %edi, %eax
subl 0x4(%rsp), %eax
cltd
pushq $-0x4
popq %r8
idivl %r8d
addl %r15d, %edi
addl %eax, %edi
shlq $0x20, %rdi
orq %rdi, %rsi
movq %rsi, 0x18(%rsp)
addl %r12d, %ecx
orq %rdi, %rcx
movq %rcx, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x38(%rsp)
andl $0x0, 0x30(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x30(%rsp), %rcx
callq 0x595b0
decl %r12d
incl %r13d
incl %r15d
jmp 0x7210b
xorl %ebp, %ebp
movq 0x20(%rsp), %rdi
callq 0x59a80
jmp 0x71ea2
nop