// File: /workspace/github_cpp_makefile_star2_O2/EstherJin[P]TetrisRemake/graphicsDisplay.cc
// Function: GraphicsDisplay::notify(Subject&)
void GraphicsDisplay::notify (Subject &whoNotified) {
    State st = whoNotified.getState();

    if (st.add) {
        if (st.type == 'T') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 2);
        } else if (st.type == 'L') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 3);
        } else if (st.type == 'Z') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 4);
        } else if (st.type == 'O') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 5);
        } else if (st.type == 'S') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 6);
        } else if (st.type == 'J') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 7);
        } else if (st.type == 'I') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 8);
        } else if (st.type == '*') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 11);
        }
    } else {
        window->fillRectangle(xmar + st.coords.col * cellLength,
                              ymar + st.coords.row * cellLength,
                              cellLength, cellLength, 0);

    }
    for (int i = 1; i < row; i++) {

        window->fillRectangle(xmar,ymar+i*34,375,1,10);
    }
    for (int j = 1; j < col; j++) {
        window->fillRectangle(xmar+j*34,ymar,1,612,10);
    }


}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq %rsi, %rdi
callq 0xf2d2
xorl %r9d, %r9d
btq $0x20, %rdx
jae 0x10196
movzbl %al, %ecx
leal -0x49(%rcx), %esi
cmpl $0xb, %esi
ja 0x10170
leaq 0x16fd(%rip), %rcx      # 0x11860
movslq (%rcx,%rsi,4), %rsi
addq %rcx, %rsi
jmpq *%rsi
pushq $0x8
jmp 0x10194
cmpl $0x2a, %ecx
je 0x10192
cmpl $0x5a, %ecx
jne 0x101b9
pushq $0x4
jmp 0x10194
pushq $0x5
jmp 0x10194
pushq $0x7
jmp 0x10194
pushq $0x6
jmp 0x10194
pushq $0x3
jmp 0x10194
pushq $0x2
jmp 0x10194
pushq $0xb
popq %r9
movq 0x20(%rbx), %rdi
movl 0x8(%rbx), %ecx
imull %ecx, %edx
addl 0x14(%rbx), %edx
shrq $0x20, %rax
imull %ecx, %eax
addl 0x18(%rbx), %eax
movl %edx, %esi
movl %eax, %edx
movl %ecx, %r8d
callq 0x108f0
pushq $0x1
popq %rbp
pushq $0x22
popq %r15
pushq $0xa
popq %r14
movl %ebp, %r12d
cmpl 0xc(%rbx), %r12d
jge 0x101f3
movq 0x20(%rbx), %rdi
movl 0x14(%rbx), %esi
movl 0x18(%rbx), %edx
addl %r15d, %edx
movl $0x177, %ecx            # imm = 0x177
movl %ebp, %r8d
movl %r14d, %r9d
callq 0x108f0
incl %r12d
addl $0x22, %r15d
jmp 0x101c7
pushq $0x1
popq %rbp
pushq $0x22
popq %r15
pushq $0xa
popq %r14
movl %ebp, %r12d
cmpl 0x10(%rbx), %r12d
jge 0x1022d
movq 0x20(%rbx), %rdi
movl 0x14(%rbx), %esi
addl %r15d, %esi
movl 0x18(%rbx), %edx
movl %ebp, %ecx
movl $0x264, %r8d            # imm = 0x264
movl %r14d, %r9d
callq 0x108f0
incl %r12d
addl $0x22, %r15d
jmp 0x10201
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq