// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0x20(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x59230
movq -0xe8(%rbp), %rdx
movq -0xe0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x6e460
movq -0xe0(%rbp), %rdi
leaq 0xdc6a1(%rip), %rax     # 0x206cd8
movq %rax, (%rdi)
addq $0x34, %rdi
callq 0x59230
jmp 0x12a645
movq -0xe0(%rbp), %rdi
addq $0x60, %rdi
movq %rdi, -0xf0(%rbp)
callq 0x12f150
jmp 0x12a65e
movq -0xe0(%rbp), %rax
movw $0x3, 0x8(%rax)
movq -0x10(%rbp), %rcx
movq %rcx, 0x50(%rax)
movq $0x0, 0x58(%rax)
callq 0x11ef70
movq %rax, -0xf8(%rbp)
jmp 0x12a689
movq -0xe0(%rbp), %rax
movq -0xf8(%rbp), %rcx
movq %rcx, 0x40(%rax)
cmpq $0x0, 0x40(%rax)
je 0x12a71e
movq -0xe0(%rbp), %rax
movq 0x40(%rax), %rdi
movq %rdi, -0x108(%rbp)
callq 0x5c6c0
movl %eax, -0xfc(%rbp)
jmp 0x12a6c1
movl -0xfc(%rbp), %esi
movq -0x108(%rbp), %rdi
callq 0x5b9f0
movq %rax, -0x110(%rbp)
jmp 0x12a6dc
movq -0xe0(%rbp), %rax
movq -0x110(%rbp), %rcx
movq %rcx, 0x48(%rax)
jmp 0x12a72d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x12a9f3
movq -0xf0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x12f1c0
jmp 0x12a9f3
movq -0xe0(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0xe0(%rbp), %rax
movq $0x0, 0xc0(%rax)
movq $0x0, 0xb8(%rax)
movq $0x0, 0xc8(%rax)
movq $0x0, 0xd0(%rax)
cmpq $0x0, 0x50(%rax)
je 0x12a9ea
movq -0xe0(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, 0xc(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq -0x34(%rbp), %rdi
callq 0x59230
jmp 0x12a793
movq -0x118(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0x59830
movb %al, -0x119(%rbp)
jmp 0x12a7ab
movb -0x119(%rbp), %al
testb $0x1, %al
jne 0x12a7ba
jmp 0x12a84b
movq -0xe0(%rbp), %rax
movq 0x40(%rax), %rdi
movq %rdi, -0x128(%rbp)
callq 0x5c6c0
movl %eax, -0x120(%rbp)
jmp 0x12a7d9
movl -0x120(%rbp), %esi
movq -0x128(%rbp), %rdi
callq 0x5d170
movl %eax, -0x12c(%rbp)
jmp 0x12a7f3
movq -0xe0(%rbp), %rax
movl -0x12c(%rbp), %ecx
addl $0x2, %ecx
movl %ecx, 0xc(%rax)
movq 0x40(%rax), %rdi
movq %rdi, -0x138(%rbp)
callq 0x5c6c0
movl %eax, -0x130(%rbp)
jmp 0x12a81e
movl -0x130(%rbp), %esi
movq -0x138(%rbp), %rdi
callq 0x59fa0
movl %eax, -0x13c(%rbp)
jmp 0x12a838
movq -0xe0(%rbp), %rax
movl -0x13c(%rbp), %ecx
addl $0x2, %ecx
movl %ecx, 0x10(%rax)
movq -0xe0(%rbp), %rdi
movq %rdi, %rax
addq $0x24, %rax
movq %rax, -0x148(%rbp)
movq (%rdi), %rax
movq 0x50(%rax), %rax
callq *%rax
movw %ax, -0x13e(%rbp)
jmp 0x12a872
movq -0x148(%rbp), %rdi
movw -0x13e(%rbp), %ax
movswl %ax, %esi
callq 0x73070
jmp 0x12a88a
movq -0xe0(%rbp), %rsi
movq %rsi, %rdi
addq $0x28, %rdi
addq $0xc, %rsi
callq 0x73430
jmp 0x12a8a3
movq -0xe0(%rbp), %rax
movq 0x40(%rax), %rdi
movq 0x50(%rax), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x5b5c0
jmp 0x12a8c0
movq -0xe0(%rbp), %rax
movq 0x40(%rax), %rdi
movq 0xe8(%rdi), %rcx
movslq 0xe0(%rdi), %rdx
shlq $0x7, %rdx
movq 0x10(%rcx,%rdx), %rsi
movl 0xc(%rax), %edx
movl 0x10(%rax), %ecx
movl -0xac(%rbp), %r8d
callq 0x5a760
movq %rax, -0x150(%rbp)
jmp 0x12a8fd
movq -0xe0(%rbp), %rax
movq -0x150(%rbp), %rcx
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, -0x158(%rbp)
jmp 0x12a930
movq -0xe0(%rbp), %rax
movq -0x158(%rbp), %rcx
movq %rcx, 0xc8(%rax)
movq 0xc8(%rax), %rdi
callq 0x5c9e0
movq %rax, -0x160(%rbp)
jmp 0x12a95a
movq -0xe0(%rbp), %rax
movq -0x160(%rbp), %rcx
movq %rcx, 0xd0(%rax)
addq $0x60, %rax
movq %rax, -0x168(%rbp)
leaq -0xd8(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x5c2c0
jmp 0x12a98c
movq -0xe0(%rbp), %rdx
addq $0xc, %rdx
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x59ff0
jmp 0x12a9ac
movq -0x168(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x12f190
jmp 0x12a9c1
movq -0xe0(%rbp), %rax
movq 0xd0(%rax), %rdi
movl $0x1, %esi
callq 0x5a850
jmp 0x12a9db
movq -0xe0(%rbp), %rax
movq 0xc(%rax), %rcx
movq %rcx, 0x34(%rax)
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq -0xe0(%rbp), %rdi
callq 0x6e520
movq -0x28(%rbp), %rdi
callq 0x5b6b0
nopl (%rax,%rax)