// File: /workspace/github_c_makefile_star2_O1/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
xorl %r14d, %r14d
leaq 0x10(%rsp), %rdx
movq %r14, (%rdx)
xorl %esi, %esi
callq 0x60b48
leaq 0xa64f4(%rip), %rax     # 0x16ad48
movq %rax, (%rbx)
movq %r14, 0x34(%rbx)
leaq 0x60(%rbx), %r14
movq %r14, %rdi
callq 0x55d90
leaq 0xa6642(%rip), %rax     # 0x16aeb0
movq %rax, 0xa0(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0xa8(%rbx)
leaq 0xa658a(%rip), %rax     # 0x16ae10
movq %rax, 0x60(%rbx)
movw $0x3, 0x8(%rbx)
movq %r12, 0x50(%rbx)
movq $0x0, 0x58(%rbx)
callq 0xbdf4e
movq %rax, %r12
movq %rax, 0x40(%rbx)
testq %rax, %rax
je 0xc48c1
movq %r12, %rdi
callq 0x57dd0
movq %r12, %rdi
movl %eax, %esi
callq 0x57360
jmp 0xc48c3
xorl %eax, %eax
movq %rax, 0x48(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0xb8(%rbx)
movups %xmm0, 0xc8(%rbx)
cmpq $0x0, 0x50(%rbx)
je 0xc49f2
movq (%r15), %rax
movq %rax, 0xc(%rbx)
movl 0x4(%r15), %eax
orl (%r15), %eax
jne 0xc492b
movq 0x40(%rbx), %r15
movq %r15, %rdi
callq 0x57dd0
movq %r15, %rdi
movl %eax, %esi
callq 0x586a0
addl $0x2, %eax
movl %eax, 0xc(%rbx)
movq 0x40(%rbx), %r15
movq %r15, %rdi
callq 0x57dd0
movq %r15, %rdi
movl %eax, %esi
callq 0x55d10
addl $0x2, %eax
movl %eax, 0x10(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
leaq 0x24(%rbx), %rdi
movswl %ax, %esi
callq 0x6307a
leaq 0xc(%rbx), %rsi
leaq 0x28(%rbx), %rdi
callq 0x632c6
movq 0x40(%rbx), %rdi
movq 0x50(%rbx), %rsi
leaq 0x10(%rsp), %rdx
callq 0x56fd0
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 0x56340
movq %rax, 0x58(%rbx)
movq 0x40(%rbx), %rdi
movq 0x48(%rbx), %rdx
movl 0xc(%rbx), %ecx
movl 0x10(%rbx), %r8d
movq %rax, %rsi
callq 0x57860
movq %rax, 0xc8(%rbx)
movq %rax, %rdi
callq 0x58060
movq %rax, 0xd0(%rbx)
movq %rsp, %rsi
movq $0x0, (%rsi)
movl 0xc(%rbx), %eax
movl %eax, 0x8(%rsi)
movl 0x10(%rbx), %eax
movl %eax, 0xc(%rsi)
movq %r14, %rdi
callq 0xc74a4
movq 0xd0(%rbx), %rdi
movl $0x1, %esi
callq 0x56410
movq 0xc(%rbx), %rax
movq %rax, 0x34(%rbx)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0xc4a0a
movq %rax, %r15
jmp 0xc4a15
jmp 0xc4a0a
movq %rax, %r15
movq %r14, %rdi
callq 0xc7192
movq %rbx, %rdi
callq 0x60bb2
movq %r15, %rdi
callq 0x57090
nop