// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/classes/gui/widgets/basic/progressbar.cpp
// Function: smooth::GUI::Progressbar::CreateGradient(smooth::GUI::Size const&)
S::Void S::GUI::Progressbar::CreateGradient(const Size &gSize)
{
	gradient.CreateBitmap(gSize - Size(2, 2));
	gradientDirection = IsRightToLeft();

	Color	 startColor = IsRightToLeft() ? Setup::GradientEndColor : Setup::GradientStartColor;
	Color	 endColor   = IsRightToLeft() ? Setup::GradientStartColor : Setup::GradientEndColor;

	Int	 rs	    = startColor.GetRed();
	Int	 gs	    = startColor.GetGreen();
	Int	 bs	    = startColor.GetBlue();
	Float	 rp	    = ((Float) (endColor.GetRed() - rs)) / ((subtype == OR_HORZ) ? (gSize.cx - 2) : (gSize.cy - 2));
	Float	 gp	    = ((Float) (endColor.GetGreen() - gs)) / ((subtype == OR_HORZ) ? (gSize.cx - 2) : (gSize.cy - 2));
	Float	 bp	    = ((Float) (endColor.GetBlue() - bs)) / ((subtype == OR_HORZ) ? (gSize.cx - 2) : (gSize.cy - 2));

	if (subtype == OR_HORZ)
	{
		for (Int x = 0; x < gSize.cx - 2; x++)
		{
			for (Int y = 0; y < gSize.cy - 2; y++) gradient.SetPixel(Point(x, y), Color((Int) (rs + rp * x), (Int) (gs + gp * x), (Int) (bs + bp * x)));
		}
	}
	else
	{
		for (Int y = 0; y < gSize.cy - 2; y++)
		{
			for (Int x = 0; x < gSize.cx - 2; x++) gradient.SetPixel(Point(x, gSize.cy - 3 - y), Color((Int) (rs + rp * y), (Int) (gs + gp * y), (Int) (bs + bp * y)));
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x5b8(%rdi), %r14
movl (%rsi), %eax
movl 0x4(%rsi), %ecx
addl $-0x2, %eax
addl $-0x2, %ecx
shlq $0x20, %rcx
orq %rcx, %rax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
pushq $-0x1
popq %rdx
movq %r14, %rdi
callq 0x58ea0
movq (%r15), %rax
movq %r15, %rdi
callq *0x160(%rax)
movb %al, 0x5c0(%r15)
movq (%r15), %rax
movq %r15, %rdi
callq *0x160(%rax)
movq 0xe8bd8(%rip), %r12     # 0x161f20
addq $0x8, %r12
movq 0xe8c65(%rip), %r13     # 0x161fb8
addq $0x8, %r13
movq (%r15), %rcx
testb %al, %al
movq %r13, %rax
cmovneq %r12, %rax
movl (%rax), %ebp
movq %r15, %rdi
callq *0x160(%rcx)
movl $0xff, %edi
movl %ebp, %edx
andl %edi, %edx
movl %ebp, %esi
shrl $0x8, %esi
andl %edi, %esi
shrl $0x10, %ebp
andl %edi, %ebp
testb %al, %al
cmoveq %r12, %r13
movl (%r13), %r9d
movl %r9d, %r10d
andl %edi, %r10d
subl %edx, %r10d
movzwl 0x1a0(%r15), %r8d
cmpw $0x1, %r8w
movl (%rbx), %eax
movl 0x4(%rbx), %ecx
movl %ecx, %r11d
cmovel %eax, %r11d
addl $-0x2, %r11d
movl %r9d, %r15d
shrl $0x8, %r15d
andl %edi, %r15d
subl %esi, %r15d
shrl $0x10, %r9d
andl %edi, %r9d
subl %ebp, %r9d
cvtsi2sd %r10d, %xmm1
cvtsi2sd %r11d, %xmm0
cvtsi2sd %r15d, %xmm2
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
divsd %xmm0, %xmm2
movsd %xmm2, 0x38(%rsp)
cvtsi2sd %r9d, %xmm1
cvtsi2sd %edx, %xmm2
movsd %xmm2, 0x28(%rsp)
cvtsi2sd %esi, %xmm2
movsd %xmm2, 0x20(%rsp)
divsd %xmm0, %xmm1
movsd %xmm1, 0x30(%rsp)
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x18(%rsp)
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
cmpw $0x1, %r8w
jne 0x794bc
addl $-0x2, %eax
cmpl %eax, %ebp
jge 0x79554
cvtsi2sd %ebp, %xmm0
movsd 0x40(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x28(%rsp), %xmm1
cvttsd2si %xmm1, %eax
movsd 0x38(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x20(%rsp), %xmm1
cvttsd2si %xmm1, %edx
mulsd 0x30(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
cvttsd2si %xmm0, %esi
shll $0x10, %esi
shll $0x8, %edx
orl %eax, %edx
orl %esi, %edx
movslq %edx, %r13
xorl %r15d, %r15d
leal -0x2(%rcx), %eax
cmpl %eax, %r15d
jge 0x794b3
movl %ebp, (%rsp)
movl %r15d, 0x4(%rsp)
movq %r13, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
movq %r14, %rdi
movq %rsp, %rsi
movq %r12, %rdx
callq 0x57160
incl %r15d
movl 0x4(%rbx), %ecx
jmp 0x79483
incl %ebp
movl (%rbx), %eax
jmp 0x7942c
addl $-0x2, %ecx
cmpl %ecx, %ebp
jge 0x79554
cvtsi2sd %ebp, %xmm0
movsd 0x40(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x28(%rsp), %xmm1
cvttsd2si %xmm1, %ecx
movsd 0x38(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x20(%rsp), %xmm1
cvttsd2si %xmm1, %edx
mulsd 0x30(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
cvttsd2si %xmm0, %esi
shll $0x10, %esi
shll $0x8, %edx
orl %ecx, %edx
orl %esi, %edx
movslq %edx, %r13
xorl %r15d, %r15d
leal -0x2(%rax), %ecx
cmpl %ecx, %r15d
jge 0x7954a
movl 0x4(%rbx), %eax
subl %ebp, %eax
addl $-0x3, %eax
movl %r15d, (%rsp)
movl %eax, 0x4(%rsp)
movq %r13, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
movq %r14, %rdi
movq %rsp, %rsi
movq %r12, %rdx
callq 0x57160
incl %r15d
movl (%rbx), %eax
jmp 0x79513
incl %ebp
movl 0x4(%rbx), %ecx
jmp 0x794bc
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop