// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/graphics/backends/cairo/surfacecairo.cpp
// Function: smooth::GUI::SurfaceCairo::SetSize(smooth::GUI::Size const&)
S::Int S::GUI::SurfaceCairo::SetSize(const Size &nSize)
{
	size = nSize;

	rightToLeft.SetSurfaceSize(size);

	if (allocSize.cx >= nSize.cx && allocSize.cy >= nSize.cy) return Success();

	if (window != NIL && !painting)
	{
		cairo_destroy(paintContextCairo);
		cairo_surface_destroy(paintSurfaceCairo);

		XFreePixmap(display, paintBitmap);

		paintRects.RemoveAll();

		XWindowAttributes	 windowAttributes;

		XGetWindowAttributes(display, window, &windowAttributes);

		paintBitmap	  = XCreatePixmap(display, DefaultRootWindow(display), size.cx, size.cy, windowAttributes.depth);
		paintSurfaceCairo = cairo_xlib_surface_create(display, paintBitmap, visual, size.cx, size.cy);
		paintContextCairo = cairo_create(paintSurfaceCairo);

		paintRects.Add(Rect(Point(0, 0), size));

		cairo_set_antialias(paintContextCairo, CAIRO_ANTIALIAS_NONE);
	}

	allocSize = nSize;

	return Success();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rsi
movq %rsi, -0xf0(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, 0xc(%rsi)
movq %rsi, %rdi
addq $0x28, %rdi
addq $0xc, %rsi
callq 0x73430
movq -0xf0(%rbp), %rax
movl 0x34(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jl 0x12ab83
movq -0xf0(%rbp), %rax
movl 0x38(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jl 0x12ab83
leaq -0x28(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x5ca80
movq -0x100(%rbp), %rdi
callq 0x59680
movl %eax, -0xf4(%rbp)
jmp 0x12ab52
movl -0xf4(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5a410
jmp 0x12ad6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5a410
jmp 0x12ad78
movq -0xf0(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x12ad02
movq -0xf0(%rbp), %rax
cmpw $0x0, 0xa(%rax)
jne 0x12ad02
movq -0xf0(%rbp), %rax
movq 0xd0(%rax), %rdi
callq 0x5d750
movq -0xf0(%rbp), %rax
movq 0xc8(%rax), %rdi
callq 0x5bd80
movq -0xf0(%rbp), %rax
movq 0x40(%rax), %rdi
movq 0x58(%rax), %rsi
callq 0x5a780
movq -0xf0(%rbp), %rdi
addq $0x60, %rdi
callq 0x12f1e0
movq -0xf0(%rbp), %rax
movq 0x40(%rax), %rdi
movq 0x50(%rax), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x5b5c0
movq -0xf0(%rbp), %rax
movq 0x40(%rax), %rdi
movq 0x40(%rax), %rcx
movq 0xe8(%rcx), %rcx
movq 0x40(%rax), %rdx
movslq 0xe0(%rdx), %rdx
shlq $0x7, %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rsi
movl 0xc(%rax), %edx
movl 0x10(%rax), %ecx
movl -0xac(%rbp), %r8d
callq 0x5a760
movq %rax, %rcx
movq -0xf0(%rbp), %rax
movq %rcx, 0x58(%rax)
movq 0x40(%rax), %rdi
movq 0x58(%rax), %rsi
movq 0x48(%rax), %rdx
movl 0xc(%rax), %ecx
movl 0x10(%rax), %r8d
callq 0x5c000
movq %rax, %rcx
movq -0xf0(%rbp), %rax
movq %rcx, 0xc8(%rax)
movq 0xc8(%rax), %rdi
callq 0x5c9e0
movq %rax, %rcx
movq -0xf0(%rbp), %rax
movq %rcx, 0xd0(%rax)
addq $0x60, %rax
movq %rax, -0x108(%rbp)
leaq -0xd8(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x5c2c0
movq -0xf0(%rbp), %rdx
addq $0xc, %rdx
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x59ff0
movq -0x108(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x12f190
movq -0xf0(%rbp), %rax
movq 0xd0(%rax), %rdi
movl $0x1, %esi
callq 0x5a850
movq -0xf0(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, 0x34(%rax)
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x5ca80
movq -0x118(%rbp), %rdi
callq 0x59680
movl %eax, -0x10c(%rbp)
jmp 0x12ad3b
movl -0x10c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x5a410
jmp 0x12ad6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x5a410
jmp 0x12ad78
movl -0x4(%rbp), %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x5b6b0
nopw %cs:(%rax,%rax)