// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/classes/graphics/backends/cairo/surfacecairo.cpp
// Function: smooth::GUI::SurfaceCairo::SurfaceCairo(void*, smooth::GUI::Size const&)
S::GUI::SurfaceCairo::SurfaceCairo(Void *iWindow, const Size &maxSize)
{
	type	     = SURFACE_CAIRO;

	window	     = (X11::Window) iWindow;

	paintBitmap  = NIL;

	display	     = Backends::BackendXLib::GetDisplay();

	if (display != NIL) visual = XDefaultVisual(display, XDefaultScreen(display));
	else		    visual = NIL;

	context	     = NIL;
	surface	     = NIL;

	paintSurfaceCairo = NIL;
	paintContextCairo = NIL;

	if (window != NIL)
	{
		size = maxSize;

		if (maxSize == Size())
		{
			size.cx = XDisplayWidth(display, XDefaultScreen(display)) + 2;
			size.cy = XDisplayHeight(display, XDefaultScreen(display)) + 2;
		}

		fontSize.SetFontSize(GetSurfaceDPI());
		rightToLeft.SetSurfaceSize(size);

		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 = size;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x10(%rsp), %rdx
andq $0x0, (%rdx)
xorl %esi, %esi
callq 0x618f6
leaq 0xa27ca(%rip), %rax     # 0x15fd68
movq %rax, (%rbx)
andq $0x0, 0x34(%rbx)
leaq 0x60(%rbx), %r14
movq %r14, %rdi
callq 0xbfdf4
movw $0x3, 0x8(%rbx)
movq %r12, 0x50(%rbx)
andq $0x0, 0x58(%rbx)
callq 0xb7110
movq %rax, %r12
movq %rax, 0x40(%rbx)
testq %rax, %rax
je 0xbd5e6
movq %r12, %rdi
callq 0x59060
movq %r12, %rdi
movl %eax, %esi
callq 0x58550
jmp 0xbd5e8
xorl %eax, %eax
movq %rax, 0x48(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0xb8(%rbx)
movups %xmm0, 0xc8(%rbx)
cmpq $0x0, 0x50(%rbx)
je 0xbd70e
movq (%r15), %rax
movq %rax, 0xc(%rbx)
movl 0x4(%r15), %eax
orl (%r15), %eax
jne 0xbd650
movq 0x40(%rbx), %r15
movq %r15, %rdi
callq 0x59060
movq %r15, %rdi
movl %eax, %esi
callq 0x59990
addl $0x2, %eax
movl %eax, 0xc(%rbx)
movq 0x40(%rbx), %r15
movq %r15, %rdi
callq 0x59060
movq %r15, %rdi
movl %eax, %esi
callq 0x56dc0
addl $0x2, %eax
movl %eax, 0x10(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
leaq 0x24(%rbx), %rdi
movswl %ax, %esi
callq 0x63c30
leaq 0xc(%rbx), %rsi
leaq 0x28(%rbx), %rdi
callq 0x63e50
movq 0x40(%rbx), %rdi
movq 0x50(%rbx), %rsi
leaq 0x10(%rsp), %rdx
callq 0x58190
movq 0x40(%rbx), %rdi
movq 0xe8(%rdi), %rax
movslq 0xe0(%rdi), %rcx
shlq $0x7, %rcx
movq 0x10(%rax,%rcx), %rsi
movl 0xc(%rbx), %edx
movl 0x10(%rbx), %ecx
movl 0x24(%rsp), %r8d
callq 0x57430
movq %rax, 0x58(%rbx)
movq 0x40(%rbx), %rdi
movq 0x48(%rbx), %rdx
movl 0xc(%rbx), %ecx
movl 0x10(%rbx), %r8d
movq %rax, %rsi
callq 0x58aa0
movq %rax, 0xc8(%rbx)
movq %rax, %rdi
callq 0x592f0
movq %rax, 0xd0(%rbx)
movq %rsp, %rsi
andq $0x0, (%rsi)
movq 0xc(%rbx), %rax
movq %rax, 0x8(%rsi)
movq %r14, %rdi
callq 0xc0106
movq 0xd0(%rbx), %rdi
pushq $0x1
popq %rsi
callq 0x57510
movq 0xc(%rbx), %rax
movq %rax, 0x34(%rbx)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0xbd726
movq %rax, %r15
jmp 0xbd731
jmp 0xbd726
movq %rax, %r15
movq %r14, %rdi
callq 0xbfe0a
movq %rbx, %rdi
callq 0x61958
movq %r15, %rdi
callq 0x58260
nop