/Frameworks/AppKit/rhino.platform/CALayer.j
http://github.com/polymar/polish · Unknown · 704 lines · 704 code · 0 blank · 0 comment · 0 complexity · 23fac05add84ee82f2cd00e341b47689 MD5 · raw file
- I;21;Foundation/CPObject.jI;23;AppKit/CABackingStore.jI;18;AppKit/CGContext.jI;19;AppKit/CGGeometry.ji;12;CGGeometry.jc;24770;
- CGAffineTransformMake=function(a,b,c,d,tx,ty){
- return {a:a,b:b,c:c,d:d,tx:tx,ty:ty};
- };
- CGAffineTransformMakeIdentity=function(){
- return {a:1,b:0,c:0,d:1,tx:0,ty:0};
- };
- CGAffineTransformMakeCopy=function(_7){
- return {a:_7.a,b:_7.b,c:_7.c,d:_7.d,tx:_7.tx,ty:_7.ty};
- };
- CGAffineTransformMakeScale=function(sx,sy){
- return {a:sx,b:0,c:0,d:sy,tx:0,ty:0};
- };
- CGAffineTransformMakeTranslation=function(tx,ty){
- return {a:1,b:0,c:0,d:1,tx:tx,ty:ty};
- };
- CGAffineTransformTranslate=function(_c,tx,ty){
- return {a:_c.a,b:_c.b,c:_c.c,d:_c.d,tx:_c.tx+_c.a*tx+_c.c*ty,ty:_c.ty+_c.b*tx+_c.d*ty};
- };
- CGAffineTransformScale=function(_f,sx,sy){
- return {a:_f.a*sx,b:_f.b*sx,c:_f.c*sy,d:_f.d*sy,tx:_f.tx,ty:_f.ty};
- };
- CGAffineTransformConcat=function(lhs,rhs){
- return {a:lhs.a*rhs.a+lhs.b*rhs.c,b:lhs.a*rhs.b+lhs.b*rhs.d,c:lhs.c*rhs.a+lhs.d*rhs.c,d:lhs.c*rhs.b+lhs.d*rhs.d,tx:lhs.tx*rhs.a+lhs.ty*rhs.c+rhs.tx,ty:lhs.tx*rhs.b+lhs.ty*rhs.d+rhs.ty};
- };
- CGPointApplyAffineTransform=function(_14,_15){
- return {x:_14.x*_15.a+_14.y*_15.c+_15.tx,y:_14.x*_15.b+_14.y*_15.d+_15.ty};
- };
- CGSizeApplyAffineTransform=function(_16,_17){
- return {width:_16.width*_17.a+_16.height*_17.c,height:_16.width*_17.b+_16.height*_17.d};
- };
- CGAffineTransformIsIdentity=function(_18){
- return (_18.a==1&&_18.b==0&&_18.c==0&&_18.d==1&&_18.tx==0&&_18.ty==0);
- };
- CGAffineTransformEqualToTransform=function(lhs,rhs){
- return (lhs.a==rhs.a&&lhs.b==rhs.b&&lhs.c==rhs.c&&lhs.d==rhs.d&&lhs.tx==rhs.tx&&lhs.ty==rhs.ty);
- };
- CGStringCreateWithCGAffineTransform=function(_1b){
- return (" [[ "+_1b.a+", "+_1b.b+", 0 ], [ "+_1b.c+", "+_1b.d+", 0 ], [ "+_1b.tx+", "+_1b.ty+", 1]]");
- };
- CGAffineTransformCreateCopy=function(_1c){
- return {a:_1c.a,b:_1c.b,c:_1c.c,d:_1c.d,tx:_1c.tx,ty:_1c.ty};
- };
- CGAffineTransformMakeRotation=function(_1d){
- var sin=SIN(_1d),cos=COS(_1d);
- return {a:cos,b:sin,c:-sin,d:cos,tx:0,ty:0};
- };
- CGAffineTransformRotate=function(_20,_21){
- var sin=SIN(_21),cos=COS(_21);
- return {a:_20.a*cos+_20.c*sin,b:_20.b*cos+_20.d*sin,c:_20.c*cos-_20.a*sin,d:_20.d*cos-_20.b*sin,tx:_20.tx,ty:_20.ty};
- };
- CGAffineTransformInvert=function(_24){
- var _25=1/(_24.a*_24.d-_24.b*_24.c);
- return {a:_25*_24.d,b:-_25*_24.b,c:-_25*_24.c,d:_25*_24.a,tx:_25*(_24.c*_24.ty-_24.d*_24.tx),ty:_25*(_24.b*_24.tx-_24.a*_24.ty)};
- };
- CGRectApplyAffineTransform=function(_26,_27){
- var top=(_26.origin.y),_29=(_26.origin.x),_2a=(_26.origin.x+_26.size.width),_2b=(_26.origin.y+_26.size.height),_2c=CGPointApplyAffineTransform({x:_29,y:top},_27),_2d=CGPointApplyAffineTransform({x:_2a,y:top},_27),_2e=CGPointApplyAffineTransform({x:_29,y:_2b},_27),_2f=CGPointApplyAffineTransform({x:_2a,y:_2b},_27),_30=MIN(_2c.x,_2d.x,_2e.x,_2f.x),_31=MAX(_2c.x,_2d.x,_2e.x,_2f.x),_32=MIN(_2c.y,_2d.y,_2e.y,_2f.y),_33=MAX(_2c.y,_2d.y,_2e.y,_2f.y);
- return {origin:{x:_30,y:_32},size:{width:(_31-_30),height:(_33-_32)}};
- };
- CPStringFromCGAffineTransform=function(_34){
- return "{"+_34.a+", "+_34.b+", "+_34.c+", "+_34.d+", "+_34.tx+", "+_34.ty+"}";
- };
- var _35=1,_36=2,_37=4,_38=8,_39=16;
- var _3a=NO;
- var _3b=1,_3c=2,_3d=4,_3e=8,_3f=16,_40=_3d|_3b|_3c;
- var _41=nil;
- var _42=objj_allocateClassPair(CPObject,"CALayer"),_43=_42.isa;
- class_addIvars(_42,[new objj_ivar("_frame"),new objj_ivar("_bounds"),new objj_ivar("_position"),new objj_ivar("_zPosition"),new objj_ivar("_anchorPoint"),new objj_ivar("_affineTransform"),new objj_ivar("_sublayerTransform"),new objj_ivar("_sublayerTransformForSublayers"),new objj_ivar("_backingStoreFrame"),new objj_ivar("_standardBackingStoreFrame"),new objj_ivar("_hasSublayerTransform"),new objj_ivar("_hasCustomBackingStoreFrame"),new objj_ivar("_opacity"),new objj_ivar("_isHidden"),new objj_ivar("_backgroundColor"),new objj_ivar("_superlayer"),new objj_ivar("_sublayers"),new objj_ivar("_runLoopUpdateMask"),new objj_ivar("_needsDisplayOnBoundsChange"),new objj_ivar("_delegate"),new objj_ivar("_delegateRespondsToDisplayLayerSelector"),new objj_ivar("_delegateRespondsToDrawLayerInContextSelector"),new objj_ivar("_DOMElement"),new objj_ivar("_DOMContentsElement"),new objj_ivar("_contents"),new objj_ivar("_context"),new objj_ivar("_owningView"),new objj_ivar("_transformToLayer"),new objj_ivar("_transformFromLayer")]);
- objj_registerClassPair(_42);
- objj_addClassForBundle(_42,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
- class_addMethods(_42,[new objj_method(sel_getUid("init"),function(_44,_45){
- with(_44){
- _44=objj_msgSendSuper({receiver:_44,super_class:objj_getClass("CPObject")},"init");
- if(_44){
- _frame=CGRectMakeZero();
- _backingStoreFrame=CGRectMakeZero();
- _standardBackingStoreFrame=CGRectMakeZero();
- _bounds=CGRectMakeZero();
- _position=CGPointMakeZero();
- _zPosition=0;
- _anchorPoint=CGPointMake(0.5,0.5);
- _affineTransform=CGAffineTransformMakeIdentity();
- _sublayerTransform=CGAffineTransformMakeIdentity();
- _transformToLayer=CGAffineTransformMakeIdentity();
- _transformFromLayer=CGAffineTransformMakeIdentity();
- _opacity=1;
- _isHidden=NO;
- _masksToBounds=NO;
- _sublayers=[];
- _DOMElement=document.createElement("div");
- _DOMElement.style.overflow="visible";
- _DOMElement.style.position="absolute";
- _DOMElement.style.visibility="visible";
- _DOMElement.style.top="0px";
- _DOMElement.style.left="0px";
- _DOMElement.style.zIndex=0;
- _DOMElement.style.width="0px";
- _DOMElement.style.height="0px";
- }
- return _44;
- }
- }),new objj_method(sel_getUid("setBounds:"),function(_46,_47,_48){
- with(_46){
- if(CGRectEqualToRect(_bounds,_48)){
- return;
- }
- var _49=_bounds.origin;
- _bounds={origin:{x:_48.origin.x,y:_48.origin.y},size:{width:_48.size.width,height:_48.size.height}};
- if(_hasSublayerTransform){
- _CALayerUpdateSublayerTransformForSublayers(_46);
- }
- _CALayerRecalculateGeometry(_46,_35);
- }
- }),new objj_method(sel_getUid("bounds"),function(_4a,_4b){
- with(_4a){
- return _bounds;
- }
- }),new objj_method(sel_getUid("setPosition:"),function(_4c,_4d,_4e){
- with(_4c){
- if(CGPointEqualToPoint(_position,_4e)){
- return;
- }
- _position={x:_4e.x,y:_4e.y};
- _CALayerRecalculateGeometry(_4c,_36);
- }
- }),new objj_method(sel_getUid("position"),function(_4f,_50){
- with(_4f){
- return _position;
- }
- }),new objj_method(sel_getUid("setZPosition:"),function(_51,_52,_53){
- with(_51){
- if(_zPosition==_53){
- return;
- }
- _zPosition=_53;
- objj_msgSend(_51,"registerRunLoopUpdateWithMask:",_3d);
- }
- }),new objj_method(sel_getUid("setAnchorPoint:"),function(_54,_55,_56){
- with(_54){
- _56={x:_56.x,y:_56.y};
- _56.x=MIN(1,MAX(0,_56.x));
- _56.y=MIN(1,MAX(0,_56.y));
- if(CGPointEqualToPoint(_anchorPoint,_56)){
- return;
- }
- _anchorPoint=_56;
- if(_hasSublayerTransform){
- _CALayerUpdateSublayerTransformForSublayers(_54);
- }
- if(_owningView){
- _position=CGPointMake((_bounds.size.width)*_anchorPoint.x,(_bounds.size.height)*_anchorPoint.y);
- }
- _CALayerRecalculateGeometry(_54,_37);
- }
- }),new objj_method(sel_getUid("anchorPoint"),function(_57,_58){
- with(_57){
- return _anchorPoint;
- }
- }),new objj_method(sel_getUid("setAffineTransform:"),function(_59,_5a,_5b){
- with(_59){
- if(CGAffineTransformEqualToTransform(_affineTransform,_5b)){
- return;
- }
- _affineTransform={a:_5b.a,b:_5b.b,c:_5b.c,d:_5b.d,tx:_5b.tx,ty:_5b.ty};
- _CALayerRecalculateGeometry(_59,_38);
- }
- }),new objj_method(sel_getUid("affineTransform"),function(_5c,_5d){
- with(_5c){
- return _affineTransform;
- }
- }),new objj_method(sel_getUid("setSublayerTransform:"),function(_5e,_5f,_60){
- with(_5e){
- if(CGAffineTransformEqualToTransform(_sublayerTransform,_60)){
- return;
- }
- var _61=_hasSublayerTransform;
- _sublayerTransform={a:_60.a,b:_60.b,c:_60.c,d:_60.d,tx:_60.tx,ty:_60.ty};
- _hasSublayerTransform=!(_sublayerTransform.a==1&&_sublayerTransform.b==0&&_sublayerTransform.c==0&&_sublayerTransform.d==1&&_sublayerTransform.tx==0&&_sublayerTransform.ty==0);
- if(_hasSublayerTransform){
- _CALayerUpdateSublayerTransformForSublayers(_5e);
- var _62=_sublayers.length;
- while(_62--){
- _CALayerRecalculateGeometry(_sublayers[_62],_39);
- }
- }
- }
- }),new objj_method(sel_getUid("sublayerTransform"),function(_63,_64){
- with(_63){
- return _sublayerTransform;
- }
- }),new objj_method(sel_getUid("transformToLayer"),function(_65,_66){
- with(_65){
- return _transformToLayer;
- }
- }),new objj_method(sel_getUid("setFrame:"),function(_67,_68,_69){
- with(_67){
- alert("FIXME IMPLEMENT");
- }
- }),new objj_method(sel_getUid("frame"),function(_6a,_6b){
- with(_6a){
- if(!_frame){
- _frame=objj_msgSend(_6a,"convertRect:toLayer:",_bounds,_superlayer);
- }
- return _frame;
- }
- }),new objj_method(sel_getUid("backingStoreFrame"),function(_6c,_6d){
- with(_6c){
- return _backingStoreFrame;
- }
- }),new objj_method(sel_getUid("setBackingStoreFrame:"),function(_6e,_6f,_70){
- with(_6e){
- _hasCustomBackingStoreFrame=(_70!=nil);
- if(_70==nil){
- _70=CGRectMakeCopy(_standardBackingStoreFrame);
- }else{
- if(_superlayer){
- _70=objj_msgSend(_superlayer,"convertRect:toLayer:",_70,nil);
- var _71=objj_msgSend(_superlayer,"bounds"),_72=objj_msgSend(_superlayer,"convertRect:toLayer:",_71,nil);
- _70.origin.x-=(_72.origin.x);
- _70.origin.y-=(_72.origin.y);
- }else{
- _70=CGRectMakeCopy(_70);
- }
- }
- if(!CGPointEqualToPoint(_backingStoreFrame.origin,_70.origin)){
- objj_msgSend(_6e,"registerRunLoopUpdateWithMask:",_3b);
- }
- if(!CGSizeEqualToSize(_backingStoreFrame.size,_70.size)){
- objj_msgSend(_6e,"registerRunLoopUpdateWithMask:",_3c);
- }
- _backingStoreFrame=_70;
- }
- }),new objj_method(sel_getUid("contents"),function(_73,_74){
- with(_73){
- return _contents;
- }
- }),new objj_method(sel_getUid("setContents:"),function(_75,_76,_77){
- with(_75){
- if(_contents==_77){
- return;
- }
- _contents=_77;
- objj_msgSend(_75,"composite");
- }
- }),new objj_method(sel_getUid("composite"),function(_78,_79){
- with(_78){
- if(_3a&&!_contents||!_context){
- return;
- }
- CGContextClearRect(_context,{origin:{x:0,y:0},size:{width:(_backingStoreFrame.size.width),height:(_backingStoreFrame.size.height)}});
- var _7a=_transformFromLayer;
- if(_superlayer){
- var _7b=_CALayerGetTransform(_superlayer,nil),_7c=CGPointApplyAffineTransform(_superlayer._bounds.origin,_7b);
- _7a=CGAffineTransformConcat(_7a,_7b);
- _7a.tx-=_7c.x;
- _7a.ty-=_7c.y;
- }
- _7a.tx-=(_backingStoreFrame.origin.x);
- _7a.ty-=(_backingStoreFrame.origin.y);
- CGContextSaveGState(_context);
- CGContextConcatCTM(_context,_7a);
- if(_3a){
- _context.drawImage(_contents.buffer,(_bounds.origin.x),(_bounds.origin.y));
- }else{
- objj_msgSend(_78,"drawInContext:",_context);
- }
- CGContextRestoreGState(_context);
- }
- }),new objj_method(sel_getUid("display"),function(_7d,_7e){
- with(_7d){
- if(!_context){
- _context=CGBitmapGraphicsContextCreate();
- _DOMContentsElement=_context.DOMElement;
- _DOMContentsElement.style.zIndex=-100;
- _DOMContentsElement.style.overflow="hidden";
- _DOMContentsElement.style.position="absolute";
- _DOMContentsElement.style.visibility="visible";
- _DOMContentsElement.width=ROUND((_backingStoreFrame.size.width));
- _DOMContentsElement.height=ROUND((_backingStoreFrame.size.height));
- _DOMContentsElement.style.top="0px";
- _DOMContentsElement.style.left="0px";
- _DOMContentsElement.style.width=ROUND((_backingStoreFrame.size.width))+"px";
- _DOMContentsElement.style.height=ROUND((_backingStoreFrame.size.height))+"px";
- _DOMElement.appendChild(_DOMContentsElement);
- }
- if(_3a){
- if(_delegateRespondsToDisplayLayerSelector){
- return objj_msgSend(_delegate,"displayInLayer:",_7d);
- }
- if((_backingStoreFrame.size.width)==0||(_backingStoreFrame.size.height)==0){
- return;
- }
- if(!_contents){
- _contents=CABackingStoreCreate();
- }
- CABackingStoreSetSize(_contents,_bounds.size);
- objj_msgSend(_7d,"drawInContext:",CABackingStoreGetContext(_contents));
- }
- objj_msgSend(_7d,"composite");
- }
- }),new objj_method(sel_getUid("drawInContext:"),function(_7f,_80,_81){
- with(_7f){
- if(_backgroundColor){
- CGContextSetFillColor(_81,_backgroundColor);
- CGContextFillRect(_81,_bounds);
- }
- if(_delegateRespondsToDrawLayerInContextSelector){
- objj_msgSend(_delegate,"drawLayer:inContext:",_7f,_81);
- }
- }
- }),new objj_method(sel_getUid("opacity"),function(_82,_83){
- with(_82){
- return _opacity;
- }
- }),new objj_method(sel_getUid("setOpacity:"),function(_84,_85,_86){
- with(_84){
- if(_opacity==_86){
- return;
- }
- _opacity=_86;
- _DOMElement.style.opacity=_86;
- _DOMElement.style.filter="alpha(opacity="+_86*100+")";
- }
- }),new objj_method(sel_getUid("setHidden:"),function(_87,_88,_89){
- with(_87){
- _isHidden=_89;
- _DOMElement.style.display=_89?"none":"block";
- }
- }),new objj_method(sel_getUid("hidden"),function(_8a,_8b){
- with(_8a){
- return _isHidden;
- }
- }),new objj_method(sel_getUid("isHidden"),function(_8c,_8d){
- with(_8c){
- return _isHidden;
- }
- }),new objj_method(sel_getUid("setMasksToBounds:"),function(_8e,_8f,_90){
- with(_8e){
- if(_masksToBounds==_90){
- return;
- }
- _masksToBounds=_90;
- _DOMElement.style.overflow=_masksToBounds?"hidden":"visible";
- }
- }),new objj_method(sel_getUid("setBackgroundColor:"),function(_91,_92,_93){
- with(_91){
- _backgroundColor=_93;
- objj_msgSend(_91,"setNeedsDisplay");
- }
- }),new objj_method(sel_getUid("backgroundColor"),function(_94,_95){
- with(_94){
- return _backgroundColor;
- }
- }),new objj_method(sel_getUid("sublayers"),function(_96,_97){
- with(_96){
- return _sublayers;
- }
- }),new objj_method(sel_getUid("superlayer"),function(_98,_99){
- with(_98){
- return _superlayer;
- }
- }),new objj_method(sel_getUid("addSublayer:"),function(_9a,_9b,_9c){
- with(_9a){
- objj_msgSend(_9a,"insertSublayer:atIndex:",_9c,_sublayers.length);
- return;
- if(_DOMContentsElement&&_9c._zPosition>_DOMContentsElement.style.zIndex){
- _DOMContentsElement.style.zIndex-=100;
- }
- objj_msgSend(_sublayers,"addObject:",_9c);
- _DOMElement.appendChild(_9c._DOMElement);
- }
- }),new objj_method(sel_getUid("removeFromSuperlayer"),function(_9d,_9e){
- with(_9d){
- if(_owningView){
- objj_msgSend(_owningView,"setLayer:",nil);
- }
- if(!_superlayer){
- return;
- }
- _superlayer._DOMElement.removeChild(_DOMElement);
- objj_msgSend(_superlayer._sublayers,"removeObject:",_9d);
- _superlayer=nil;
- }
- }),new objj_method(sel_getUid("insertSublayer:atIndex:"),function(_9f,_a0,_a1,_a2){
- with(_9f){
- if(!_a1){
- return;
- }
- var _a3=objj_msgSend(_a1,"superlayer");
- if(_a3==_9f){
- var _a4=objj_msgSend(_sublayers,"indexOfObjectIdenticalTo:",_a1);
- if(_a4==_a2){
- return;
- }
- objj_msgSend(_sublayers,"removeObjectAtIndex:",_a4);
- if(_a4<_a2){
- --_a2;
- }
- }else{
- if(_a3!=nil){
- objj_msgSend(_a1,"removeFromSuperlayer");
- }
- }
- if(_DOMContentsElement&&_a1._zPosition>_DOMContentsElement.style.zIndex){
- _DOMContentsElement.style.zIndex-=100;
- }
- objj_msgSend(_sublayers,"insertObject:atIndex:",_a1,_a2);
- if(_a2>=_sublayers.length-1){
- _DOMElement.appendChild(_a1._DOMElement);
- }else{
- _DOMElement.insertBefore(_a1._DOMElement,_sublayers[_a2+1]._DOMElement);
- }
- _a1._superlayer=_9f;
- if(_9f!=_a3){
- _CALayerRecalculateGeometry(_a1,268435455);
- }
- }
- }),new objj_method(sel_getUid("insertSublayer:below:"),function(_a5,_a6,_a7,_a8){
- with(_a5){
- var _a9=_a8?objj_msgSend(_sublayers,"indexOfObjectIdenticalTo:",_a8):0;
- objj_msgSend(_a5,"insertSublayer:atIndex:",_a7,_a9==CPNotFound?_sublayers.length:_a9);
- }
- }),new objj_method(sel_getUid("insertSublayer:above:"),function(_aa,_ab,_ac,_ad){
- with(_aa){
- var _ae=_ad?objj_msgSend(_sublayers,"indexOfObjectIdenticalTo:",_ad):_sublayers.length;
- if(_ae==CPNotFound){
- objj_msgSend(CPException,"raise:reason:","CALayerNotFoundException","aSublayer is not a sublayer of this layer");
- }
- objj_msgSend(_sublayers,"insertObject:atIndex:",_ac,_ae==CPNotFound?_sublayers.length:_ae+1);
- }
- }),new objj_method(sel_getUid("replaceSublayer:with:"),function(_af,_b0,_b1,_b2){
- with(_af){
- if(_b1==_b2){
- return;
- }
- if(_b1._superlayer!=_af){
- alert("EXCEPTION");
- return;
- }
- if(_DOMContentsElement&&_b2._zPosition>_DOMContentsElement.style.zIndex){
- _DOMContentsElement.style.zIndex-=100;
- }
- objj_msgSend(_sublayers,"replaceObjectAtIndex:withObject:",objj_msgSend(_sublayers,"indexOfObjectIdenticalTo:",_b1),_b2);
- _DOMElement.replaceChild(_b1._DOMElement,_b2._DOMElement);
- }
- }),new objj_method(sel_getUid("registerRunLoopUpdateWithMask:"),function(_b3,_b4,_b5){
- with(_b3){
- if(_41==nil){
- _41={};
- objj_msgSend(objj_msgSend(CPRunLoop,"currentRunLoop"),"performSelector:target:argument:order:modes:",sel_getUid("runLoopUpdateLayers"),CALayer,nil,0,[CPDefaultRunLoopMode]);
- }
- _runLoopUpdateMask|=_b5;
- _41[objj_msgSend(_b3,"hash")]=_b3;
- }
- }),new objj_method(sel_getUid("setNeedsComposite"),function(_b6,_b7){
- with(_b6){
- objj_msgSend(_b6,"registerRunLoopUpdateWithMask:",_3f);
- }
- }),new objj_method(sel_getUid("setNeedsDisplay"),function(_b8,_b9){
- with(_b8){
- objj_msgSend(_b8,"registerRunLoopUpdateWithMask:",_3e);
- }
- }),new objj_method(sel_getUid("setNeedsDisplayOnBoundsChange:"),function(_ba,_bb,_bc){
- with(_ba){
- _needsDisplayOnBoundsChange=_bc;
- }
- }),new objj_method(sel_getUid("needsDisplayOnBoundsChange"),function(_bd,_be){
- with(_bd){
- return _needsDisplayOnBoundsChange;
- }
- }),new objj_method(sel_getUid("setNeedsDisplayInRect:"),function(_bf,_c0,_c1){
- with(_bf){
- _dirtyRect=_c1;
- objj_msgSend(_bf,"display");
- }
- }),new objj_method(sel_getUid("convertPoint:fromLayer:"),function(_c2,_c3,_c4,_c5){
- with(_c2){
- return CGPointApplyAffineTransform(_c4,_CALayerGetTransform(_c5,_c2));
- }
- }),new objj_method(sel_getUid("convertPoint:toLayer:"),function(_c6,_c7,_c8,_c9){
- with(_c6){
- return CGPointApplyAffineTransform(_c8,_CALayerGetTransform(_c6,_c9));
- }
- }),new objj_method(sel_getUid("convertRect:fromLayer:"),function(_ca,_cb,_cc,_cd){
- with(_ca){
- return CGRectApplyAffineTransform(_cc,_CALayerGetTransform(_cd,_ca));
- }
- }),new objj_method(sel_getUid("convertRect:toLayer:"),function(_ce,_cf,_d0,_d1){
- with(_ce){
- return CGRectApplyAffineTransform(_d0,_CALayerGetTransform(_ce,_d1));
- }
- }),new objj_method(sel_getUid("containsPoint:"),function(_d2,_d3,_d4){
- with(_d2){
- return (_d4.x>=(_bounds.origin.x)&&_d4.y>=(_bounds.origin.y)&&_d4.x<(_bounds.origin.x+_bounds.size.width)&&_d4.y<(_bounds.origin.y+_bounds.size.height));
- }
- }),new objj_method(sel_getUid("hitTest:"),function(_d5,_d6,_d7){
- with(_d5){
- if(_isHidden){
- return nil;
- }
- var _d8=CGPointApplyAffineTransform(_d7,_transformToLayer);
- if(!(_d8.x>=(_bounds.origin.x)&&_d8.y>=(_bounds.origin.y)&&_d8.x<(_bounds.origin.x+_bounds.size.width)&&_d8.y<(_bounds.origin.y+_bounds.size.height))){
- return nil;
- }
- var _d9=nil,_da=_sublayers.length;
- while(_da--){
- if(_d9=objj_msgSend(_sublayers[_da],"hitTest:",_d8)){
- return _d9;
- }
- }
- return _d5;
- }
- }),new objj_method(sel_getUid("setDelegate:"),function(_db,_dc,_dd){
- with(_db){
- if(_delegate==_dd){
- return;
- }
- _delegate=_dd;
- _delegateRespondsToDisplayLayerSelector=objj_msgSend(_delegate,"respondsToSelector:",sel_getUid("displayLayer:"));
- _delegateRespondsToDrawLayerInContextSelector=objj_msgSend(_delegate,"respondsToSelector:",sel_getUid("drawLayer:inContext:"));
- if(_delegateRespondsToDisplayLayerSelector||_delegateRespondsToDrawLayerInContextSelector){
- objj_msgSend(_db,"setNeedsDisplay");
- }
- }
- }),new objj_method(sel_getUid("delegate"),function(_de,_df){
- with(_de){
- return _delegate;
- }
- }),new objj_method(sel_getUid("_setOwningView:"),function(_e0,_e1,_e2){
- with(_e0){
- _owningView=_e2;
- if(_owningView){
- _owningView=_e2;
- _bounds.size=CGSizeMakeCopy(objj_msgSend(_owningView,"bounds").size);
- _position=CGPointMake((_bounds.size.width)*_anchorPoint.x,(_bounds.size.height)*_anchorPoint.y);
- }
- _CALayerRecalculateGeometry(_e0,_36|_35);
- }
- }),new objj_method(sel_getUid("_owningViewBoundsChanged"),function(_e3,_e4){
- with(_e3){
- _bounds.size=CGSizeMakeCopy(objj_msgSend(_owningView,"bounds").size);
- _position=CGPointMake((_bounds.size.width)*_anchorPoint.x,(_bounds.size.height)*_anchorPoint.y);
- _CALayerRecalculateGeometry(_e3,_36|_35);
- }
- }),new objj_method(sel_getUid("_update"),function(_e5,_e6){
- with(_e5){
- window.loop=true;
- var _e7=_runLoopUpdateMask;
- if(_e7&_40){
- _CALayerUpdateDOM(_e5,_e7);
- }
- if(_e7&_3e){
- objj_msgSend(_e5,"display");
- }else{
- if(_e7&_3c||_e7&_3f){
- objj_msgSend(_e5,"composite");
- }
- }
- _runLoopUpdateMask=0;
- window.loop=false;
- }
- })]);
- class_addMethods(_43,[new objj_method(sel_getUid("layer"),function(_e8,_e9){
- with(_e8){
- return objj_msgSend(objj_msgSend(objj_msgSend(_e8,"class"),"alloc"),"init");
- }
- }),new objj_method(sel_getUid("runLoopUpdateLayers"),function(_ea,_eb){
- with(_ea){
- if(window.oops){
- alert(window.latest);
- objj_debug_print_backtrace();
- }
- window.loop=true;
- for(hash in _41){
- var _ec=_41[hash],_ed=_ec._runLoopUpdateMask;
- if(_ed&_40){
- _CALayerUpdateDOM(_ec,_ed);
- }
- if(_ed&_3e){
- objj_msgSend(_ec,"display");
- }else{
- if(_ed&_3c||_ed&_3f){
- objj_msgSend(_ec,"composite");
- }
- }
- _ec._runLoopUpdateMask=0;
- }
- window.loop=false;
- _41=nil;
- }
- })]);
- _CALayerUpdateSublayerTransformForSublayers=function(_ee){
- var _ef=_ee._bounds,_f0=_ee._anchorPoint,_f1=(_ef.size.width)*_f0.x,_f2=(_ef.size.height)*_f0.y;
- _ee._sublayerTransformForSublayers=CGAffineTransformConcat(CGAffineTransformMakeTranslation(-_f1,-_f2),CGAffineTransformConcat(_ee._sublayerTransform,CGAffineTransformMakeTranslation(_f1,_f2)));
- };
- _CALayerUpdateDOM=function(_f3,_f4){
- var _f5=_f3._DOMElement.style;
- if(_f4&_3d){
- _f5.zIndex=_f3._zPosition;
- }
- var _f6=_f3._backingStoreFrame;
- if(_f4&_3b){
- _f5.top=ROUND((_f6.origin.y))+"px";
- _f5.left=ROUND((_f6.origin.x))+"px";
- }
- if(_f4&_3c){
- var _f7=MAX(0,ROUND((_f6.size.width))),_f8=MAX(0,ROUND((_f6.size.height))),_f9=_f3._DOMContentsElement;
- _f5.width=_f7+"px";
- _f5.height=_f8+"px";
- if(_f9){
- _f9.width=_f7;
- _f9.height=_f8;
- _f9.style.width=_f7+"px";
- _f9.style.height=_f8+"px";
- }
- }
- };
- _CALayerRecalculateGeometry=function(_fa,_fb){
- var _fc=_fa._bounds,_fd=_fa._superlayer,_fe=(_fc.size.width),_ff=(_fc.size.height),_100=_fa._position,_101=_fa._anchorPoint,_102=_fa._affineTransform,_103={width:_fa._backingStoreFrame.width,height:_fa._backingStoreFrame.height},_104=_fa._hasCustomBackingStoreFrame;
- _fa._transformFromLayer=CGAffineTransformConcat(CGAffineTransformMakeTranslation(-_fe*_101.x-(_fa._bounds.origin.x),-_ff*_101.y-(_fa._bounds.origin.y)),CGAffineTransformConcat(_102,CGAffineTransformMakeTranslation(_100.x,_100.y)));
- if(_fd&&_fd._hasSublayerTransform){
- var tx=_fa._transformFromLayer.tx*_fd._sublayerTransformForSublayers.a+_fa._transformFromLayer.ty*_fd._sublayerTransformForSublayers.c+_fd._sublayerTransformForSublayers.tx;
- _fa._transformFromLayer.ty=_fa._transformFromLayer.tx*_fd._sublayerTransformForSublayers.b+_fa._transformFromLayer.ty*_fd._sublayerTransformForSublayers.d+_fd._sublayerTransformForSublayers.ty;
- _fa._transformFromLayer.tx=tx;
- var a=_fa._transformFromLayer.a*_fd._sublayerTransformForSublayers.a+_fa._transformFromLayer.b*_fd._sublayerTransformForSublayers.c,b=_fa._transformFromLayer.a*_fd._sublayerTransformForSublayers.b+_fa._transformFromLayer.b*_fd._sublayerTransformForSublayers.d,c=_fa._transformFromLayer.c*_fd._sublayerTransformForSublayers.a+_fa._transformFromLayer.d*_fd._sublayerTransformForSublayers.c;
- _fa._transformFromLayer.d=_fa._transformFromLayer.c*_fd._sublayerTransformForSublayers.b+_fa._transformFromLayer.d*_fd._sublayerTransformForSublayers.d;
- _fa._transformFromLayer.a=a;
- _fa._transformFromLayer.b=b;
- _fa._transformFromLayer.c=c;
- }
- _fa._transformToLayer=CGAffineTransformInvert(_fa._transformFromLayer);
- _fa._frame=nil;
- _fa._standardBackingStoreFrame=objj_msgSend(_fa,"convertRect:toLayer:",_fc,nil);
- if(_fd){
- var _fc=objj_msgSend(_fd,"bounds"),_109=objj_msgSend(_fd,"convertRect:toLayer:",_fc,nil);
- _fa._standardBackingStoreFrame.origin.x-=(_109.origin.x);
- _fa._standardBackingStoreFrame.origin.y-=(_109.origin.y);
- }
- var _10a=_fa._standardBackingStoreFrame.origin,size=_fa._standardBackingStoreFrame.size;
- _10a.x=FLOOR(_10a.x);
- _10a.y=FLOOR(_10a.y);
- size.width=CEIL(size.width)+1;
- size.height=CEIL(size.height)+1;
- if(!_104){
- var _10c=CGRectMakeCopy(_fa._standardBackingStoreFrame);
- if(ROUND((_10c.origin.x))!=ROUND((_fa._backingStoreFrame.origin.x))||ROUND((_10c.origin.y))!=ROUND((_fa._backingStoreFrame.origin.y))){
- objj_msgSend(_fa,"registerRunLoopUpdateWithMask:",_3b);
- }
- if(((_10c.size.width)!=ROUND((_fa._backingStoreFrame.size.width))||(_10c.size.height)!=ROUND((_fa._backingStoreFrame.size.height)))){
- objj_msgSend(_fa,"registerRunLoopUpdateWithMask:",_3c);
- }
- _fa._backingStoreFrame=_10c;
- }
- if(_fb&_35&&_fa._needsDisplayOnBoundsChange){
- objj_msgSend(_fa,"setNeedsDisplay");
- }else{
- if(_104||(_fb&~(_36|_37))){
- objj_msgSend(_fa,"setNeedsComposite");
- }
- }
- var _10d=_fa._sublayers,_10e=0,_10f=_10d.length;
- for(;_10e<_10f;++_10e){
- _CALayerRecalculateGeometry(_10d[_10e],_fb);
- }
- };
- _CALayerGetTransform=function(_110,_111){
- var _112=CGAffineTransformMakeIdentity();
- if(_110){
- var _113=_110;
- while(_113&&_113!=_111){
- var _114=_113._transformFromLayer;
- var tx=_112.tx*_114.a+_112.ty*_114.c+_114.tx;
- _112.ty=_112.tx*_114.b+_112.ty*_114.d+_114.ty;
- _112.tx=tx;
- var a=_112.a*_114.a+_112.b*_114.c,b=_112.a*_114.b+_112.b*_114.d,c=_112.c*_114.a+_112.d*_114.c;
- _112.d=_112.c*_114.b+_112.d*_114.d;
- _112.a=a;
- _112.b=b;
- _112.c=c;
- _113=_113._superlayer;
- }
- if(_113==_111){
- return _112;
- }
- }
- var _119=[],_113=_111;
- while(_113){
- _119.push(_113);
- _113=_113._superlayer;
- }
- var _11a=_119.length;
- while(_11a--){
- var _11b=_119[_11a]._transformToLayer;
- var tx=_112.tx*_11b.a+_112.ty*_11b.c+_11b.tx;
- _112.ty=_112.tx*_11b.b+_112.ty*_11b.d+_11b.ty;
- _112.tx=tx;
- var a=_112.a*_11b.a+_112.b*_11b.c,b=_112.a*_11b.b+_112.b*_11b.d,c=_112.c*_11b.a+_112.d*_11b.c;
- _112.d=_112.c*_11b.b+_112.d*_11b.d;
- _112.a=a;
- _112.b=b;
- _112.c=c;
- }
- return _112;
- };