// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/classes/gui/widgets/multi/menu/micromenu.cpp
// Function: smooth::GUI::MicroMenu::Paint(int)
S::Int S::GUI::MicroMenu::Paint(Int message)
{
	if (!IsRegistered()) return Error();
	if (!IsVisible())    return Success();

	Surface	*surface = GetDrawSurface();
	Rect	 frame	 = Rect(GetRealPosition(), GetRealSize());

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

			if (IsBackgroundColorSet()) surface->Box(frame, GetBackgroundColor(), Rect::Filled);

			surface->Frame(frame, FRAME_UP);

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

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

					if (IsActive())	surface->Line(lineStart, lineEnd, Setup::TextColor);
					else		surface->Line(lineStart, lineEnd, Setup::InactiveTextColor);
				}
			}
			else if (subtype == OR_VERT)
			{
				Int	 size = Math::Round(3 * surface->GetSurfaceDPI() / 96.0);

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

					if (IsActive())	surface->Line(lineStart, lineEnd, Setup::TextColor);
					else		surface->Line(lineStart, lineEnd, Setup::InactiveTextColor);
				}
			}

			surface->EndPaint();

			break;
		case SP_MOUSEOUT:
			if (hotspot->IsActive()) surface->Frame(frame, FRAME_UP);

			break;
	}

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebp
movq %rdi, %r14
movq (%rdi), %rax
callq *0x88(%rax)
testb %al, %al
je 0x885df
movq (%r14), %rax
movq %r14, %rdi
callq *0x90(%rax)
xorl %r15d, %r15d
testb %al, %al
je 0x885e3
movq (%r14), %rax
movq %r14, %rdi
callq *0x40(%rax)
movq %rax, %r13
movq (%r14), %rax
movq %r14, %rdi
callq *0x48(%rax)
movq %rax, %r12
movq %rax, %rbx
shrq $0x20, %rbx
movq (%r14), %rax
movq %r14, %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)
cmpl $0x3, %ebp
je 0x885f5
testl %ebp, %ebp
jne 0x885e3
leaq 0x8(%rsp), %rsi
movq %r13, %rdi
callq 0x56160
movq (%r14), %rax
movq %r14, %rdi
callq *0x148(%rax)
testb %al, %al
je 0x884d6
movq (%r14), %rax
movq %r14, %rdi
callq *0x140(%rax)
movq 0xd9aed(%rip), %rcx     # 0x161fa8
movl (%rcx), %ecx
leaq 0x18(%rsp), %r8
andq $0x0, (%r8)
leaq 0x8(%rsp), %rsi
movq %r13, %rdi
movq %rax, %rdx
callq 0x58b80
leaq 0x8(%rsp), %rsi
xorl %r12d, %r12d
movq %r13, %rdi
xorl %edx, %edx
callq 0x58ad0
movzwl 0x1a0(%r14), %eax
cmpl $0x2, %eax
movq %r13, 0x20(%rsp)
je 0x8861a
cmpl $0x1, %eax
jne 0x8871b
movq 0x20(%rsp), %rdi
callq 0x59c60
cwtl
leal (%rax,%rax,2), %eax
cvtsi2sd %eax, %xmm0
divsd 0x5afef(%rip), %xmm0    # 0xe3510
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x5b43b(%rip), %rcx     # 0xe3970
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rbx
xorl %r15d, %r15d
testl %ebx, %ebx
movl $0x0, %ebp
cmovgl %ebx, %ebp
pushq $0x1
popq %r12
subl %ebx, %r12d
movl %ebx, %r13d
cmpl %r15d, %ebp
je 0x8871b
movl 0x10(%rsp), %eax
movl 0x8(%rsp), %ecx
movl 0xc(%rsp), %esi
subl %ecx, %eax
subl %ebx, %eax
cltd
pushq $0x2
popq %rdi
idivl %edi
addl %r15d, %ecx
addl %eax, %ecx
movl 0x14(%rsp), %eax
subl %esi, %eax
cltd
idivl %edi
addl %esi, %eax
leal (%r12,%r15), %edx
addl %eax, %edx
movl %ecx, 0x18(%rsp)
movl %edx, 0x1c(%rsp)
addl %r13d, %eax
shlq $0x20, %rax
orq %rax, %rcx
movq %rcx, 0x28(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x98(%rax)
movq 0xd939b(%rip), %rcx     # 0x161950
testb %al, %al
je 0x885c0
movq 0xd9428(%rip), %rcx     # 0x1619e8
movq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x595b0
incl %r15d
decl %r13d
jmp 0x88556
pushq $-0x1
popq %r15
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x688(%r14), %rdi
movq (%rdi), %rax
callq *0x98(%rax)
testb %al, %al
je 0x885e3
leaq 0x8(%rsp), %rsi
movq %r13, %rdi
xorl %edx, %edx
callq 0x58ad0
jmp 0x885e3
movq %r13, %rdi
callq 0x59c60
cwtl
leal (%rax,%rax,2), %eax
cvtsi2sd %eax, %xmm0
divsd 0x5aede(%rip), %xmm0    # 0xe3510
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x5b32a(%rip), %rcx     # 0xe3970
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rcx
testl %ecx, %ecx
movl $0x0, %eax
cmovgl %ecx, %eax
movl %eax, 0x34(%rsp)
pushq $0x1
popq %rax
subl %ecx, %eax
movq %rax, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movl %ecx, %r15d
pushq $0x2
popq %r13
cmpl %r12d, 0x34(%rsp)
je 0x8871b
movl 0x8(%rsp), %ebx
movl 0x10(%rsp), %eax
subl %ebx, %eax
cltd
idivl %r13d
movl %eax, %ebp
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
movzbl %al, %ecx
addl %ebx, %ecx
addl %ebp, %ecx
movq 0x40(%rsp), %rax
leal (%rax,%r12), %esi
addl %ecx, %esi
movl 0xc(%rsp), %edi
movl 0x14(%rsp), %eax
movq 0x38(%rsp), %rdx
addl %edi, %edx
subl %edx, %eax
cltd
idivl %r13d
addl %r12d, %edi
addl %eax, %edi
movl %esi, 0x18(%rsp)
movl %edi, 0x1c(%rsp)
addl %r15d, %ecx
shlq $0x20, %rdi
orq %rdi, %rcx
movq %rcx, 0x28(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x98(%rax)
movq 0xd925f(%rip), %rcx     # 0x161950
testb %al, %al
je 0x886fc
movq 0xd92ec(%rip), %rcx     # 0x1619e8
movq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x595b0
incl %r12d
decl %r15d
jmp 0x88674
movq 0x20(%rsp), %rdi
callq 0x59a80
xorl %r15d, %r15d
jmp 0x885e3
nop