// File: /workspace/github_c_makefile_star2_O3/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 0x60ba0
leaq 0xa6670(%rip), %rax     # 0x169d48
movq %rax, (%rbx)
movq %r14, 0x34(%rbx)
leaq 0x60(%rbx), %r14
movq %r14, %rdi
callq 0x55d90
leaq 0xa67be(%rip), %rax     # 0x169eb0
movq %rax, 0xa0(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0xa8(%rbx)
leaq 0xa6706(%rip), %rax     # 0x169e10
movq %rax, 0x60(%rbx)
movw $0x3, 0x8(%rbx)
movq %r12, 0x50(%rbx)
movq $0x0, 0x58(%rbx)
callq 0xbcfc0
movq %rax, %r12
movq %rax, 0x40(%rbx)
testq %rax, %rax
je 0xc3745
movq %r12, %rdi
callq 0x57dd0
movq %r12, %rdi
movl %eax, %esi
callq 0x57360
jmp 0xc3747
xorl %eax, %eax
movq %rax, 0x48(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0xb8(%rbx)
movups %xmm0, 0xc8(%rbx)
cmpq $0x0, 0x50(%rbx)
je 0xc3872
movq (%r15), %rax
movq %rax, 0xc(%rbx)
movl 0x4(%r15), %eax
orl (%r15), %eax
jne 0xc37af
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 0x630c4
leaq 0xc(%rbx), %rsi
leaq 0x28(%rbx), %rdi
callq 0x632fa
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)
movq 0xc(%rbx), %rax
movq %rax, 0x8(%rsi)
movq %r14, %rdi
callq 0xc6536
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 0xc388a
movq %rax, %r15
jmp 0xc3895
jmp 0xc388a
movq %rax, %r15
movq %r14, %rdi
callq 0xc6236
movq %rbx, %rdi
callq 0x60c0a
movq %r15, %rdi
callq 0x57090
nop