// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/classes/gui/widgets/basic/scrollbar.cpp
// Function: smooth::GUI::Scrollbar::OnValueChange()
S::Void S::GUI::Scrollbar::OnValueChange()
{
	UpdateHotspotPositions();

	if (!IsRegistered() || !IsVisible()) return;

	Surface	*surface	= GetDrawSurface();
	Point	 realPos	= GetRealPosition();
	Size	 realSize	= GetRealSize();

	Bool	 smallHotspots	= (subtype == OR_HORZ && (GetWidth() <= 55)) || (subtype == OR_VERT && (GetHeight() <= 55));
	Int	 hotspotSize	= Math::Round((smallHotspots ? 10 : (subtype == OR_HORZ ? GetHeight() : GetWidth())) * surface->GetSurfaceDPI() / 96.0) - 4;

	Rect	 backFrame	= Rect(realPos + (subtype == OR_HORZ ? Point(hotspotSize + 4, 0) : Point(0, hotspotSize + 4)), realSize - (subtype == OR_HORZ ? Size(2 * (hotspotSize + 4), 0) : Size(0, 2 * (hotspotSize + 4))));
	Rect	 sliderFrame	= Rect(realPos + (subtype == OR_HORZ ? Point(hotspotSize + 4 + (Int) (((Float) realSize.cx - 3 * (hotspotSize + 4)) / ((Float) (endValue - startValue)) * ((Float) (*variable - startValue))), 0) : Point(0, hotspotSize + 4 + (Int) (((Float) realSize.cy - 3 * (hotspotSize + 4)) / ((Float) (endValue - startValue)) * ((Float) (*variable - startValue))))), subtype == OR_HORZ ? Size(hotspotSize + 4, realSize.cy) : Size(realSize.cx, hotspotSize + 4));

	surface->StartPaint(backFrame);

	surface->Box(backFrame, Setup::LightGrayColor, Rect::Filled);

	if (!dragging) surface->Box(sliderFrame, Setup::BackgroundColor, Rect::Filled);

	surface->Frame(sliderFrame, FRAME_UP);

	surface->EndPaint();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
callq 0x58280
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x88(%rax)
testb %al, %al
je 0x7b93f
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x90(%rax)
testb %al, %al
je 0x7b93f
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq %rax, 0x28(%rsp)
movq %rax, %r13
shrq $0x20, %r13
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
movq %rax, %r12
movq %rax, %rbp
shrq $0x20, %rbp
movzwl 0x1a0(%rbx), %eax
movl $0xa, %r15d
cmpw $0x1, %ax
jne 0x7b77c
cmpl $0x38, 0xb0(%rbx)
jl 0x7b7a1
cmpw $0x2, %ax
jne 0x7b78b
cmpl $0x38, 0xb4(%rbx)
jl 0x7b7a1
cmpw $0x1, %ax
jne 0x7b79a
movl 0xb4(%rbx), %r15d
jmp 0x7b7a1
movl 0xb0(%rbx), %r15d
movq %r14, %rdi
callq 0x58930
cwtl
imull %r15d, %eax
cvtsi2sd %eax, %xmm0
divsd 0x78d36(%rip), %xmm0    # 0xf44f0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x78fc2(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rcx
movzwl 0x1a0(%rbx), %edx
leal (%rcx,%rcx), %esi
xorl %eax, %eax
cmpw $0x1, %dx
movl $0x0, %edi
cmovel %esi, %edi
negl %esi
cmpw $0x1, %dx
movl %ecx, %r8d
cmovel %eax, %r8d
movl $0x0, %r9d
cmovel %ecx, %r9d
cmovel %eax, %esi
movq 0x28(%rsp), %r11
addl %r11d, %r9d
addl %r13d, %r8d
movl %r12d, %r10d
subl %edi, %r10d
movl %r9d, 0x18(%rsp)
movl %r8d, 0x1c(%rsp)
addl %r9d, %r10d
movl %r10d, 0x20(%rsp)
addl %ebp, %r8d
addl %esi, %r8d
movl %r8d, 0x24(%rsp)
movl 0x5dc(%rbx), %esi
movl 0x5d8(%rbx), %edi
subl %edi, %esi
movq 0x5d0(%rbx), %r8
movl (%r8), %r8d
leal (%rcx,%rcx,2), %r9d
cvtsi2sd %r9d, %xmm2
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
subl %edi, %r8d
xorps %xmm0, %xmm0
cvtsi2sd %r8d, %xmm0
cmpw $0x1, %dx
jne 0x7b88f
cvtsi2sd %r12d, %xmm3
subsd %xmm2, %xmm3
divsd %xmm1, %xmm3
mulsd %xmm0, %xmm3
cvttsd2si %xmm3, %eax
addl %ecx, %eax
xorl %edx, %edx
movl %ecx, %r12d
jmp 0x7b8a7
cvtsi2sd %ebp, %xmm3
subsd %xmm2, %xmm3
divsd %xmm1, %xmm3
mulsd %xmm0, %xmm3
cvttsd2si %xmm3, %edx
addl %ecx, %edx
movl %ecx, %ebp
addl %r11d, %eax
addl %r13d, %edx
movl %eax, 0x8(%rsp)
movl %edx, 0xc(%rsp)
addl %r12d, %eax
movl %eax, 0x10(%rsp)
addl %ebp, %edx
movl %edx, 0x14(%rsp)
leaq 0x18(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x55160
movq 0xf16cf(%rip), %r12     # 0x16cfa8
movl (%r12), %ecx
leaq 0x30(%rsp), %r8
movq $0x0, (%r8)
movq 0xf0eb8(%rip), %rdx     # 0x16c7a8
movq %r14, %rdi
movq %r15, %rsi
callq 0x57930
cmpb $0x0, 0x638(%rbx)
jne 0x7b928
movl (%r12), %ecx
leaq 0x30(%rsp), %r8
movq $0x0, (%r8)
movq 0xf0bb5(%rip), %rdx     # 0x16c4d0
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x57930
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x57890
movq %r14, %rdi
callq 0x58780
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq