// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/graphics/backends/fontbackend.cpp
// Function: smooth::GUI::FontBackend::GetTextSize(smooth::String const&, bool) const
S::GUI::Size S::GUI::FontBackend::GetTextSize(const String &text, Bool scaled) const
{
	if (text == NIL) return Size();

	/* Check for existing cache entry.
	 */
	ExtentsCacheEntry	 entry(text, fontName, fontSize, fontWeight, fontStyle);

	Float			 dpi = Surface().GetSurfaceDPI();
	Int			 crc = entry.GetCRC32();

	if (ExtentsCacheEntry *cacheEntry = extentsCache.Get(crc))
	{
		if (scaled || Math::Abs(dpi - 96.0) < 0.1) return cacheEntry->GetExtents();
		else					   return cacheEntry->GetExtents() * 96.0 / dpi;
	}

	/* Compute scaled text size.
	 */
	Size	 size = GetTextSize(text);

	entry.SetExtents(size);

	/* Save at most 2048 cache entries.
	 */
	if (extentsCache.Length() >= 2048)
	{
		for (Int i = 0; i < 1024; i++)
		{
			delete extentsCache.GetFirst();

			extentsCache.RemoveNth(0);
		}
	}

	extentsCache.Add(new ExtentsCacheEntry(entry), crc);

	/* Return computed text size.
	 */
	if (scaled || Math::Abs(dpi - 96.0) < 0.1) return size;
	else					   return size * 96.0 / dpi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x59320
testb $0x1, %al
jne 0x6da26
jmp 0x6da34
leaq -0x8(%rbp), %rdi
callq 0x59230
jmp 0x6dc9d
movq -0x88(%rbp), %rax
movq -0x18(%rbp), %rsi
movq %rax, %rdx
addq $0x10, %rdx
movswl 0xa(%rax), %ecx
movswl 0x38(%rax), %r8d
movswl 0x3a(%rax), %r9d
leaq -0x28(%rbp), %rdi
callq 0x6df00
leaq -0x40(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x59230
movq -0xa0(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x5b7d0
movq -0x98(%rbp), %rdi
callq 0x5d470
movw %ax, -0x8a(%rbp)
jmp 0x6da9d
movw -0x8a(%rbp), %ax
cwtl
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0xa8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x5c380
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x6e000
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %esi
leaq 0x19e6fb(%rip), %rdi    # 0x20c1d8
callq 0x6e010
movq (%rax), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x6db84
testb $0x1, -0x19(%rbp)
jne 0x6db21
movsd -0x30(%rbp), %xmm0
movsd 0x1199b9(%rip), %xmm1   # 0x1874c0
subsd %xmm1, %xmm0
callq 0x597d0
movaps %xmm0, %xmm1
movsd 0x11999d(%rip), %xmm0   # 0x1874b8
ucomisd %xmm1, %xmm0
jbe 0x6db50
movq -0x58(%rbp), %rdi
callq 0x6e040
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x6dc9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x5c380
jmp 0x6dcaa
movq -0x58(%rbp), %rdi
callq 0x6e040
movq %rax, %rdi
movsd 0x11995c(%rip), %xmm0   # 0x1874c0
callq 0x5a7b0
movq %rax, -0x60(%rbp)
movsd -0x30(%rbp), %xmm0
leaq -0x60(%rbp), %rdi
callq 0x5c6b0
movq %rax, -0x8(%rbp)
jmp 0x6dc9d
movq -0x88(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
callq *0x10(%rax)
movq %rax, -0x68(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x6e120
leaq 0x19e62b(%rip), %rdi    # 0x20c1d8
callq 0x5c990
cmpl $0x800, %eax            # imm = 0x800
jl 0x6dc11
movl $0x0, -0x6c(%rbp)
cmpl $0x400, -0x6c(%rbp)     # imm = 0x400
jge 0x6dc0f
leaq 0x19e608(%rip), %rdi    # 0x20c1d8
callq 0x6e140
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
cmpq $0x0, %rax
je 0x6dbf6
movq -0xb0(%rbp), %rdi
movl $0xc, %esi
callq 0x595b0
leaq 0x19e5db(%rip), %rdi    # 0x20c1d8
xorl %esi, %esi
callq 0x61860
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x6dbc0
jmp 0x6dc11
movl $0xc, %edi
callq 0x59820
movq -0x28(%rbp), %rcx
movq %rcx, (%rax)
movl -0x20(%rbp), %ecx
movl %ecx, 0x8(%rax)
movq %rax, -0x78(%rbp)
movl -0x50(%rbp), %edx
leaq 0x19e5a2(%rip), %rdi    # 0x20c1d8
leaq -0x78(%rbp), %rsi
callq 0x6e160
testb $0x1, -0x19(%rbp)
jne 0x6dc6c
movsd -0x30(%rbp), %xmm0
movsd 0x11986e(%rip), %xmm1   # 0x1874c0
subsd %xmm1, %xmm0
callq 0x597d0
movaps %xmm0, %xmm1
movsd 0x119852(%rip), %xmm0   # 0x1874b8
ucomisd %xmm1, %xmm0
jbe 0x6dc76
movq -0x68(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6dc9d
leaq -0x68(%rbp), %rdi
movsd 0x11983e(%rip), %xmm0   # 0x1874c0
callq 0x5a7b0
movq %rax, -0x80(%rbp)
movsd -0x30(%rbp), %xmm0
leaq -0x80(%rbp), %rdi
callq 0x5c6b0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x5b6b0
nopw %cs:(%rax,%rax)