Aktív témák

  • P.H.

    senior tag

    válasz P.H. #39 üzenetére

    Line algoritmus nagy mennyiségű vonalhoz, új megfogalmazásban:

    bemenő paraméterek:
    EAX: X0 coordinate
    EDX: Y0 coordinate
    ECX: X1 coordinate
    EBP: Y1 coordinate
    ESI: BITS array
    EDI: _ADDER array
    MM7: [$0000][$0000][width][ 1] // image width + 1 (UINTs)
    XMM5 [ CHS][ CHS][ CHS][ CHS] // sign change constants
    XMM6: [bttom][right][ top][ left] // image boundaries
    XMM7: [-----][-----][-----][ 1.0]

    cvtsi2ss xmm2,eax
    sub ecx,eax
    sub ebp,edx
    push ebx
    mov eax,ecx
    mov ebx,ecx
    sar eax,1Fh
    cvtsi2ss xmm3,edx
    xor ebx,eax
    mov edx,ebp
    sub ebx,eax
    mov eax,ebp
    sar eax,1Fh
    xor edx,eax
    sub edx,eax
    cmp edx,ebx
    jae @movement
    xchg ebp,ecx
    @movement:
    cvtsi2ss xmm1,ebp
    shufps xmm2,xmm3,01000100b
    test ebp,ebp
    jz @return
    cvtsi2ss xmm0,ecx
    rcpss xmm1,xmm1
    shufps xmm2,xmm2,10001000b
    mulss xmm0,xmm1
    shufps xmm0,xmm7,00000000b
    jns @direction
    neg ebp
    xorps xmm0,xmm5
    @direction:
    cmp edx,ebx
    mov ebx,[edi+_PENWIDTH]
    jae @inlineCOORDINATES
    shufps xmm0,xmm0,11000110b
    @inlineCOORDINATES:
    mov al,[edi+_DRAWCOLOR]
    sub edi,ebx
    shufps xmm0,xmm0,10001000b
    @setpixel:
    cvtps2pi mm0,xmm2
    movaps xmm4,xmm6
    cmpltps xmm6,xmm2
    pshufw mm0,mm0,11111000b
    addps xmm2,xmm0
    movmskps edx,xmm6
    movaps xmm6,xmm4
    pmaddwd mm0,mm7
    cmp edx,03h
    jnz @continueLINE
    movd edx,mm0
    mov ecx,ebx
    @rounds:
    add edx,[edi+ecx]
    add ecx,04h
    mov [esi+edx],al
    js @rounds
    @continueLINE:
    sub ebp,01h
    jge @setpixel
    add edi,ebx
    @return:
    pop ebx

    [ Szerkesztve ]

    Arguing on the Internet is like running in the Special Olympics. Even if you win, you are still ... ˙˙˙ Real Eyes Realize Real Lies ˙˙˙

Aktív témák