2012-04-27 1 views
2

메소드 CGShadingGetBounds()의 서명을 얻으려고합니까?CGShadingGetBounds() 서명이 필요합니까?

시도했는데, CG_EXTERN CGRect CGShadingGetBounds(CGShadingRef); 시도해 보았습니다.

누군가가 서명을 알아낼 수 있습니까? 다음은 해체입니다.

__text:000000000016BB76     public _CGShadingGetBounds 
__text:000000000016BB76 _CGShadingGetBounds proc near   ; CODE XREF: _log_LogShading+1B8p 
__text:000000000016BB76           ; _dlr_DrawShading+1FEp ... 
__text:000000000016BB76     push rbp 
__text:000000000016BB77     mov  rbp, rsp 
__text:000000000016BB7A     mov  rax, rdi 
__text:000000000016BB7D     cmp  byte ptr [rsi+28h], 0 
__text:000000000016BB81     jz  short loc_16BBAC 
__text:000000000016BB83     movsd xmm0, qword ptr [rsi+30h] 
__text:000000000016BB88     movsd qword ptr [rdi], xmm0 
__text:000000000016BB8C     movsd xmm0, qword ptr [rsi+38h] 
__text:000000000016BB91     movsd qword ptr [rdi+8], xmm0 
__text:000000000016BB96     movsd xmm0, qword ptr [rsi+40h] 
__text:000000000016BB9B     movsd qword ptr [rdi+10h], xmm0 
__text:000000000016BBA0     movsd xmm0, qword ptr [rsi+48h] 
__text:000000000016BBA5 
__text:000000000016BBA5 loc_16BBA5:        ; CODE XREF: _CGShadingGetBounds+5Ej 
__text:000000000016BBA5     movsd qword ptr [rdi+18h], xmm0 
__text:000000000016BBAA     pop  rbp 
__text:000000000016BBAB     retn 
__text:000000000016BBAC ; --------------------------------------------------------------------------- 
__text:000000000016BBAC 
__text:000000000016BBAC loc_16BBAC:        ; CODE XREF: _CGShadingGetBounds+Bj 
__text:000000000016BBAC     lea  rcx, _CGRectInfinite 
__text:000000000016BBB3     movsd xmm0, qword ptr [rcx] 
__text:000000000016BBB7     movsd xmm1, qword ptr [rcx+8] 
__text:000000000016BBBC     movsd qword ptr [rdi], xmm0 
__text:000000000016BBC0     movsd qword ptr [rdi+8], xmm1 
__text:000000000016BBC5     movsd xmm0, qword ptr [rcx+10h] 
__text:000000000016BBCA     movsd qword ptr [rdi+10h], xmm0 
__text:000000000016BBCF     movsd xmm0, qword ptr [rcx+18h] 
__text:000000000016BBD4     jmp  short loc_16BBA5 
__text:000000000016BBD4 _CGShadingGetBounds endp 

내 목표는 음영이 발생할 경계를 식별하는 것입니다.

답변

1

나는 서명 당신이

CG_EXTERN CGRect CGShadingGetBounds(CGShadingRef); 

가 올바른지 언급 생각합니다. 예를 들어이 같은 사용자 정의 개체와 같은 기능을 재구성하려고하면 : 물론

typedef struct 
{ 
    long a1, a2, a3, a4, a5; 
    char b6; 
    CGRect r; 
} MyObj; 

CGRect ReconstructFunc(MyObj *o) 
{ 
    if (o->b6) return o->r; 
    return CGRectNull; 
} 

이 뭔가 다른 않지만, (B6 제로가 아닌) "빠른"경로는 매우 매우 유사하다 조립 및 동작 모두 원래 함수에 적용됩니다.

pushq %rbp 
movq %rsp, %rbp 
movq %rdi, %rax 
cmpb $0, 40(%rsi) 
je LBB0_2 
movq 72(%rsi), %rcx 
movq %rcx, 24(%rax) 
movq 64(%rsi), %rcx 
movq %rcx, 16(%rax) 
movq 48(%rsi), %rcx 
movq 56(%rsi), %rdx 
movq %rdx, 8(%rax) 
movq %rcx, (%rax) 
popq %rbp 
ret 
    ... (continues) 

게시 한 어셈블리에서 기본적으로 동일합니다. 또한 "컨벤션"obj-c와 Mac GCC가 CGRect 구조체로 메서드를 컴파일하는 데 사용한다는 것을 의미합니다. x64 ABI에 따르면 매개 변수는 RDI, RSI, RDX 등의 레지스터에 전달됩니다. 처음 두 개의 RDI와 RSI를 살펴보면 인수가 명확하게 포함되어 있습니다. 첫 번째는 출력 구조체 (CGRect)에 대한 포인터이고 두 번째 것은 불투명 한 구조체 (CGShadingReg)입니다.

따라서 나는 Mac에서 GCC이 변환 있다고 생각이에

CGRect myrect = MyFuncReturningRect(param); 

:

어쨌든
CGRect myrect; 
MyFuncReturningRect(&myrect, param); 

이 모든 것을 요약하면, 나는 강력하게 추측 서명이 없다는 것을 확신한다. 함수가 예상 한 값을 반환하지 않으면 일부 다른 요인에 의해 발생합니다 (아마도 값에 의해 발생합니다. 더미가 아닌 정보를 얻으려면 null이 아니어야합니다).