PageRenderTime 30ms CodeModel.GetById 2ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/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
  1I;21;Foundation/CPObject.jI;23;AppKit/CABackingStore.jI;18;AppKit/CGContext.jI;19;AppKit/CGGeometry.ji;12;CGGeometry.jc;24770;
  2CGAffineTransformMake=function(a,b,c,d,tx,ty){
  3return {a:a,b:b,c:c,d:d,tx:tx,ty:ty};
  4};
  5CGAffineTransformMakeIdentity=function(){
  6return {a:1,b:0,c:0,d:1,tx:0,ty:0};
  7};
  8CGAffineTransformMakeCopy=function(_7){
  9return {a:_7.a,b:_7.b,c:_7.c,d:_7.d,tx:_7.tx,ty:_7.ty};
 10};
 11CGAffineTransformMakeScale=function(sx,sy){
 12return {a:sx,b:0,c:0,d:sy,tx:0,ty:0};
 13};
 14CGAffineTransformMakeTranslation=function(tx,ty){
 15return {a:1,b:0,c:0,d:1,tx:tx,ty:ty};
 16};
 17CGAffineTransformTranslate=function(_c,tx,ty){
 18return {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};
 19};
 20CGAffineTransformScale=function(_f,sx,sy){
 21return {a:_f.a*sx,b:_f.b*sx,c:_f.c*sy,d:_f.d*sy,tx:_f.tx,ty:_f.ty};
 22};
 23CGAffineTransformConcat=function(lhs,rhs){
 24return {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};
 25};
 26CGPointApplyAffineTransform=function(_14,_15){
 27return {x:_14.x*_15.a+_14.y*_15.c+_15.tx,y:_14.x*_15.b+_14.y*_15.d+_15.ty};
 28};
 29CGSizeApplyAffineTransform=function(_16,_17){
 30return {width:_16.width*_17.a+_16.height*_17.c,height:_16.width*_17.b+_16.height*_17.d};
 31};
 32CGAffineTransformIsIdentity=function(_18){
 33return (_18.a==1&&_18.b==0&&_18.c==0&&_18.d==1&&_18.tx==0&&_18.ty==0);
 34};
 35CGAffineTransformEqualToTransform=function(lhs,rhs){
 36return (lhs.a==rhs.a&&lhs.b==rhs.b&&lhs.c==rhs.c&&lhs.d==rhs.d&&lhs.tx==rhs.tx&&lhs.ty==rhs.ty);
 37};
 38CGStringCreateWithCGAffineTransform=function(_1b){
 39return (" [[ "+_1b.a+", "+_1b.b+", 0 ], [ "+_1b.c+", "+_1b.d+", 0 ], [ "+_1b.tx+", "+_1b.ty+", 1]]");
 40};
 41CGAffineTransformCreateCopy=function(_1c){
 42return {a:_1c.a,b:_1c.b,c:_1c.c,d:_1c.d,tx:_1c.tx,ty:_1c.ty};
 43};
 44CGAffineTransformMakeRotation=function(_1d){
 45var sin=SIN(_1d),cos=COS(_1d);
 46return {a:cos,b:sin,c:-sin,d:cos,tx:0,ty:0};
 47};
 48CGAffineTransformRotate=function(_20,_21){
 49var sin=SIN(_21),cos=COS(_21);
 50return {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};
 51};
 52CGAffineTransformInvert=function(_24){
 53var _25=1/(_24.a*_24.d-_24.b*_24.c);
 54return {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)};
 55};
 56CGRectApplyAffineTransform=function(_26,_27){
 57var 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);
 58return {origin:{x:_30,y:_32},size:{width:(_31-_30),height:(_33-_32)}};
 59};
 60CPStringFromCGAffineTransform=function(_34){
 61return "{"+_34.a+", "+_34.b+", "+_34.c+", "+_34.d+", "+_34.tx+", "+_34.ty+"}";
 62};
 63var _35=1,_36=2,_37=4,_38=8,_39=16;
 64var _3a=NO;
 65var _3b=1,_3c=2,_3d=4,_3e=8,_3f=16,_40=_3d|_3b|_3c;
 66var _41=nil;
 67var _42=objj_allocateClassPair(CPObject,"CALayer"),_43=_42.isa;
 68class_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")]);
 69objj_registerClassPair(_42);
 70objj_addClassForBundle(_42,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
 71class_addMethods(_42,[new objj_method(sel_getUid("init"),function(_44,_45){
 72with(_44){
 73_44=objj_msgSendSuper({receiver:_44,super_class:objj_getClass("CPObject")},"init");
 74if(_44){
 75_frame=CGRectMakeZero();
 76_backingStoreFrame=CGRectMakeZero();
 77_standardBackingStoreFrame=CGRectMakeZero();
 78_bounds=CGRectMakeZero();
 79_position=CGPointMakeZero();
 80_zPosition=0;
 81_anchorPoint=CGPointMake(0.5,0.5);
 82_affineTransform=CGAffineTransformMakeIdentity();
 83_sublayerTransform=CGAffineTransformMakeIdentity();
 84_transformToLayer=CGAffineTransformMakeIdentity();
 85_transformFromLayer=CGAffineTransformMakeIdentity();
 86_opacity=1;
 87_isHidden=NO;
 88_masksToBounds=NO;
 89_sublayers=[];
 90_DOMElement=document.createElement("div");
 91_DOMElement.style.overflow="visible";
 92_DOMElement.style.position="absolute";
 93_DOMElement.style.visibility="visible";
 94_DOMElement.style.top="0px";
 95_DOMElement.style.left="0px";
 96_DOMElement.style.zIndex=0;
 97_DOMElement.style.width="0px";
 98_DOMElement.style.height="0px";
 99}
100return _44;
101}
102}),new objj_method(sel_getUid("setBounds:"),function(_46,_47,_48){
103with(_46){
104if(CGRectEqualToRect(_bounds,_48)){
105return;
106}
107var _49=_bounds.origin;
108_bounds={origin:{x:_48.origin.x,y:_48.origin.y},size:{width:_48.size.width,height:_48.size.height}};
109if(_hasSublayerTransform){
110_CALayerUpdateSublayerTransformForSublayers(_46);
111}
112_CALayerRecalculateGeometry(_46,_35);
113}
114}),new objj_method(sel_getUid("bounds"),function(_4a,_4b){
115with(_4a){
116return _bounds;
117}
118}),new objj_method(sel_getUid("setPosition:"),function(_4c,_4d,_4e){
119with(_4c){
120if(CGPointEqualToPoint(_position,_4e)){
121return;
122}
123_position={x:_4e.x,y:_4e.y};
124_CALayerRecalculateGeometry(_4c,_36);
125}
126}),new objj_method(sel_getUid("position"),function(_4f,_50){
127with(_4f){
128return _position;
129}
130}),new objj_method(sel_getUid("setZPosition:"),function(_51,_52,_53){
131with(_51){
132if(_zPosition==_53){
133return;
134}
135_zPosition=_53;
136objj_msgSend(_51,"registerRunLoopUpdateWithMask:",_3d);
137}
138}),new objj_method(sel_getUid("setAnchorPoint:"),function(_54,_55,_56){
139with(_54){
140_56={x:_56.x,y:_56.y};
141_56.x=MIN(1,MAX(0,_56.x));
142_56.y=MIN(1,MAX(0,_56.y));
143if(CGPointEqualToPoint(_anchorPoint,_56)){
144return;
145}
146_anchorPoint=_56;
147if(_hasSublayerTransform){
148_CALayerUpdateSublayerTransformForSublayers(_54);
149}
150if(_owningView){
151_position=CGPointMake((_bounds.size.width)*_anchorPoint.x,(_bounds.size.height)*_anchorPoint.y);
152}
153_CALayerRecalculateGeometry(_54,_37);
154}
155}),new objj_method(sel_getUid("anchorPoint"),function(_57,_58){
156with(_57){
157return _anchorPoint;
158}
159}),new objj_method(sel_getUid("setAffineTransform:"),function(_59,_5a,_5b){
160with(_59){
161if(CGAffineTransformEqualToTransform(_affineTransform,_5b)){
162return;
163}
164_affineTransform={a:_5b.a,b:_5b.b,c:_5b.c,d:_5b.d,tx:_5b.tx,ty:_5b.ty};
165_CALayerRecalculateGeometry(_59,_38);
166}
167}),new objj_method(sel_getUid("affineTransform"),function(_5c,_5d){
168with(_5c){
169return _affineTransform;
170}
171}),new objj_method(sel_getUid("setSublayerTransform:"),function(_5e,_5f,_60){
172with(_5e){
173if(CGAffineTransformEqualToTransform(_sublayerTransform,_60)){
174return;
175}
176var _61=_hasSublayerTransform;
177_sublayerTransform={a:_60.a,b:_60.b,c:_60.c,d:_60.d,tx:_60.tx,ty:_60.ty};
178_hasSublayerTransform=!(_sublayerTransform.a==1&&_sublayerTransform.b==0&&_sublayerTransform.c==0&&_sublayerTransform.d==1&&_sublayerTransform.tx==0&&_sublayerTransform.ty==0);
179if(_hasSublayerTransform){
180_CALayerUpdateSublayerTransformForSublayers(_5e);
181var _62=_sublayers.length;
182while(_62--){
183_CALayerRecalculateGeometry(_sublayers[_62],_39);
184}
185}
186}
187}),new objj_method(sel_getUid("sublayerTransform"),function(_63,_64){
188with(_63){
189return _sublayerTransform;
190}
191}),new objj_method(sel_getUid("transformToLayer"),function(_65,_66){
192with(_65){
193return _transformToLayer;
194}
195}),new objj_method(sel_getUid("setFrame:"),function(_67,_68,_69){
196with(_67){
197alert("FIXME IMPLEMENT");
198}
199}),new objj_method(sel_getUid("frame"),function(_6a,_6b){
200with(_6a){
201if(!_frame){
202_frame=objj_msgSend(_6a,"convertRect:toLayer:",_bounds,_superlayer);
203}
204return _frame;
205}
206}),new objj_method(sel_getUid("backingStoreFrame"),function(_6c,_6d){
207with(_6c){
208return _backingStoreFrame;
209}
210}),new objj_method(sel_getUid("setBackingStoreFrame:"),function(_6e,_6f,_70){
211with(_6e){
212_hasCustomBackingStoreFrame=(_70!=nil);
213if(_70==nil){
214_70=CGRectMakeCopy(_standardBackingStoreFrame);
215}else{
216if(_superlayer){
217_70=objj_msgSend(_superlayer,"convertRect:toLayer:",_70,nil);
218var _71=objj_msgSend(_superlayer,"bounds"),_72=objj_msgSend(_superlayer,"convertRect:toLayer:",_71,nil);
219_70.origin.x-=(_72.origin.x);
220_70.origin.y-=(_72.origin.y);
221}else{
222_70=CGRectMakeCopy(_70);
223}
224}
225if(!CGPointEqualToPoint(_backingStoreFrame.origin,_70.origin)){
226objj_msgSend(_6e,"registerRunLoopUpdateWithMask:",_3b);
227}
228if(!CGSizeEqualToSize(_backingStoreFrame.size,_70.size)){
229objj_msgSend(_6e,"registerRunLoopUpdateWithMask:",_3c);
230}
231_backingStoreFrame=_70;
232}
233}),new objj_method(sel_getUid("contents"),function(_73,_74){
234with(_73){
235return _contents;
236}
237}),new objj_method(sel_getUid("setContents:"),function(_75,_76,_77){
238with(_75){
239if(_contents==_77){
240return;
241}
242_contents=_77;
243objj_msgSend(_75,"composite");
244}
245}),new objj_method(sel_getUid("composite"),function(_78,_79){
246with(_78){
247if(_3a&&!_contents||!_context){
248return;
249}
250CGContextClearRect(_context,{origin:{x:0,y:0},size:{width:(_backingStoreFrame.size.width),height:(_backingStoreFrame.size.height)}});
251var _7a=_transformFromLayer;
252if(_superlayer){
253var _7b=_CALayerGetTransform(_superlayer,nil),_7c=CGPointApplyAffineTransform(_superlayer._bounds.origin,_7b);
254_7a=CGAffineTransformConcat(_7a,_7b);
255_7a.tx-=_7c.x;
256_7a.ty-=_7c.y;
257}
258_7a.tx-=(_backingStoreFrame.origin.x);
259_7a.ty-=(_backingStoreFrame.origin.y);
260CGContextSaveGState(_context);
261CGContextConcatCTM(_context,_7a);
262if(_3a){
263_context.drawImage(_contents.buffer,(_bounds.origin.x),(_bounds.origin.y));
264}else{
265objj_msgSend(_78,"drawInContext:",_context);
266}
267CGContextRestoreGState(_context);
268}
269}),new objj_method(sel_getUid("display"),function(_7d,_7e){
270with(_7d){
271if(!_context){
272_context=CGBitmapGraphicsContextCreate();
273_DOMContentsElement=_context.DOMElement;
274_DOMContentsElement.style.zIndex=-100;
275_DOMContentsElement.style.overflow="hidden";
276_DOMContentsElement.style.position="absolute";
277_DOMContentsElement.style.visibility="visible";
278_DOMContentsElement.width=ROUND((_backingStoreFrame.size.width));
279_DOMContentsElement.height=ROUND((_backingStoreFrame.size.height));
280_DOMContentsElement.style.top="0px";
281_DOMContentsElement.style.left="0px";
282_DOMContentsElement.style.width=ROUND((_backingStoreFrame.size.width))+"px";
283_DOMContentsElement.style.height=ROUND((_backingStoreFrame.size.height))+"px";
284_DOMElement.appendChild(_DOMContentsElement);
285}
286if(_3a){
287if(_delegateRespondsToDisplayLayerSelector){
288return objj_msgSend(_delegate,"displayInLayer:",_7d);
289}
290if((_backingStoreFrame.size.width)==0||(_backingStoreFrame.size.height)==0){
291return;
292}
293if(!_contents){
294_contents=CABackingStoreCreate();
295}
296CABackingStoreSetSize(_contents,_bounds.size);
297objj_msgSend(_7d,"drawInContext:",CABackingStoreGetContext(_contents));
298}
299objj_msgSend(_7d,"composite");
300}
301}),new objj_method(sel_getUid("drawInContext:"),function(_7f,_80,_81){
302with(_7f){
303if(_backgroundColor){
304CGContextSetFillColor(_81,_backgroundColor);
305CGContextFillRect(_81,_bounds);
306}
307if(_delegateRespondsToDrawLayerInContextSelector){
308objj_msgSend(_delegate,"drawLayer:inContext:",_7f,_81);
309}
310}
311}),new objj_method(sel_getUid("opacity"),function(_82,_83){
312with(_82){
313return _opacity;
314}
315}),new objj_method(sel_getUid("setOpacity:"),function(_84,_85,_86){
316with(_84){
317if(_opacity==_86){
318return;
319}
320_opacity=_86;
321_DOMElement.style.opacity=_86;
322_DOMElement.style.filter="alpha(opacity="+_86*100+")";
323}
324}),new objj_method(sel_getUid("setHidden:"),function(_87,_88,_89){
325with(_87){
326_isHidden=_89;
327_DOMElement.style.display=_89?"none":"block";
328}
329}),new objj_method(sel_getUid("hidden"),function(_8a,_8b){
330with(_8a){
331return _isHidden;
332}
333}),new objj_method(sel_getUid("isHidden"),function(_8c,_8d){
334with(_8c){
335return _isHidden;
336}
337}),new objj_method(sel_getUid("setMasksToBounds:"),function(_8e,_8f,_90){
338with(_8e){
339if(_masksToBounds==_90){
340return;
341}
342_masksToBounds=_90;
343_DOMElement.style.overflow=_masksToBounds?"hidden":"visible";
344}
345}),new objj_method(sel_getUid("setBackgroundColor:"),function(_91,_92,_93){
346with(_91){
347_backgroundColor=_93;
348objj_msgSend(_91,"setNeedsDisplay");
349}
350}),new objj_method(sel_getUid("backgroundColor"),function(_94,_95){
351with(_94){
352return _backgroundColor;
353}
354}),new objj_method(sel_getUid("sublayers"),function(_96,_97){
355with(_96){
356return _sublayers;
357}
358}),new objj_method(sel_getUid("superlayer"),function(_98,_99){
359with(_98){
360return _superlayer;
361}
362}),new objj_method(sel_getUid("addSublayer:"),function(_9a,_9b,_9c){
363with(_9a){
364objj_msgSend(_9a,"insertSublayer:atIndex:",_9c,_sublayers.length);
365return;
366if(_DOMContentsElement&&_9c._zPosition>_DOMContentsElement.style.zIndex){
367_DOMContentsElement.style.zIndex-=100;
368}
369objj_msgSend(_sublayers,"addObject:",_9c);
370_DOMElement.appendChild(_9c._DOMElement);
371}
372}),new objj_method(sel_getUid("removeFromSuperlayer"),function(_9d,_9e){
373with(_9d){
374if(_owningView){
375objj_msgSend(_owningView,"setLayer:",nil);
376}
377if(!_superlayer){
378return;
379}
380_superlayer._DOMElement.removeChild(_DOMElement);
381objj_msgSend(_superlayer._sublayers,"removeObject:",_9d);
382_superlayer=nil;
383}
384}),new objj_method(sel_getUid("insertSublayer:atIndex:"),function(_9f,_a0,_a1,_a2){
385with(_9f){
386if(!_a1){
387return;
388}
389var _a3=objj_msgSend(_a1,"superlayer");
390if(_a3==_9f){
391var _a4=objj_msgSend(_sublayers,"indexOfObjectIdenticalTo:",_a1);
392if(_a4==_a2){
393return;
394}
395objj_msgSend(_sublayers,"removeObjectAtIndex:",_a4);
396if(_a4<_a2){
397--_a2;
398}
399}else{
400if(_a3!=nil){
401objj_msgSend(_a1,"removeFromSuperlayer");
402}
403}
404if(_DOMContentsElement&&_a1._zPosition>_DOMContentsElement.style.zIndex){
405_DOMContentsElement.style.zIndex-=100;
406}
407objj_msgSend(_sublayers,"insertObject:atIndex:",_a1,_a2);
408if(_a2>=_sublayers.length-1){
409_DOMElement.appendChild(_a1._DOMElement);
410}else{
411_DOMElement.insertBefore(_a1._DOMElement,_sublayers[_a2+1]._DOMElement);
412}
413_a1._superlayer=_9f;
414if(_9f!=_a3){
415_CALayerRecalculateGeometry(_a1,268435455);
416}
417}
418}),new objj_method(sel_getUid("insertSublayer:below:"),function(_a5,_a6,_a7,_a8){
419with(_a5){
420var _a9=_a8?objj_msgSend(_sublayers,"indexOfObjectIdenticalTo:",_a8):0;
421objj_msgSend(_a5,"insertSublayer:atIndex:",_a7,_a9==CPNotFound?_sublayers.length:_a9);
422}
423}),new objj_method(sel_getUid("insertSublayer:above:"),function(_aa,_ab,_ac,_ad){
424with(_aa){
425var _ae=_ad?objj_msgSend(_sublayers,"indexOfObjectIdenticalTo:",_ad):_sublayers.length;
426if(_ae==CPNotFound){
427objj_msgSend(CPException,"raise:reason:","CALayerNotFoundException","aSublayer is not a sublayer of this layer");
428}
429objj_msgSend(_sublayers,"insertObject:atIndex:",_ac,_ae==CPNotFound?_sublayers.length:_ae+1);
430}
431}),new objj_method(sel_getUid("replaceSublayer:with:"),function(_af,_b0,_b1,_b2){
432with(_af){
433if(_b1==_b2){
434return;
435}
436if(_b1._superlayer!=_af){
437alert("EXCEPTION");
438return;
439}
440if(_DOMContentsElement&&_b2._zPosition>_DOMContentsElement.style.zIndex){
441_DOMContentsElement.style.zIndex-=100;
442}
443objj_msgSend(_sublayers,"replaceObjectAtIndex:withObject:",objj_msgSend(_sublayers,"indexOfObjectIdenticalTo:",_b1),_b2);
444_DOMElement.replaceChild(_b1._DOMElement,_b2._DOMElement);
445}
446}),new objj_method(sel_getUid("registerRunLoopUpdateWithMask:"),function(_b3,_b4,_b5){
447with(_b3){
448if(_41==nil){
449_41={};
450objj_msgSend(objj_msgSend(CPRunLoop,"currentRunLoop"),"performSelector:target:argument:order:modes:",sel_getUid("runLoopUpdateLayers"),CALayer,nil,0,[CPDefaultRunLoopMode]);
451}
452_runLoopUpdateMask|=_b5;
453_41[objj_msgSend(_b3,"hash")]=_b3;
454}
455}),new objj_method(sel_getUid("setNeedsComposite"),function(_b6,_b7){
456with(_b6){
457objj_msgSend(_b6,"registerRunLoopUpdateWithMask:",_3f);
458}
459}),new objj_method(sel_getUid("setNeedsDisplay"),function(_b8,_b9){
460with(_b8){
461objj_msgSend(_b8,"registerRunLoopUpdateWithMask:",_3e);
462}
463}),new objj_method(sel_getUid("setNeedsDisplayOnBoundsChange:"),function(_ba,_bb,_bc){
464with(_ba){
465_needsDisplayOnBoundsChange=_bc;
466}
467}),new objj_method(sel_getUid("needsDisplayOnBoundsChange"),function(_bd,_be){
468with(_bd){
469return _needsDisplayOnBoundsChange;
470}
471}),new objj_method(sel_getUid("setNeedsDisplayInRect:"),function(_bf,_c0,_c1){
472with(_bf){
473_dirtyRect=_c1;
474objj_msgSend(_bf,"display");
475}
476}),new objj_method(sel_getUid("convertPoint:fromLayer:"),function(_c2,_c3,_c4,_c5){
477with(_c2){
478return CGPointApplyAffineTransform(_c4,_CALayerGetTransform(_c5,_c2));
479}
480}),new objj_method(sel_getUid("convertPoint:toLayer:"),function(_c6,_c7,_c8,_c9){
481with(_c6){
482return CGPointApplyAffineTransform(_c8,_CALayerGetTransform(_c6,_c9));
483}
484}),new objj_method(sel_getUid("convertRect:fromLayer:"),function(_ca,_cb,_cc,_cd){
485with(_ca){
486return CGRectApplyAffineTransform(_cc,_CALayerGetTransform(_cd,_ca));
487}
488}),new objj_method(sel_getUid("convertRect:toLayer:"),function(_ce,_cf,_d0,_d1){
489with(_ce){
490return CGRectApplyAffineTransform(_d0,_CALayerGetTransform(_ce,_d1));
491}
492}),new objj_method(sel_getUid("containsPoint:"),function(_d2,_d3,_d4){
493with(_d2){
494return (_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));
495}
496}),new objj_method(sel_getUid("hitTest:"),function(_d5,_d6,_d7){
497with(_d5){
498if(_isHidden){
499return nil;
500}
501var _d8=CGPointApplyAffineTransform(_d7,_transformToLayer);
502if(!(_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))){
503return nil;
504}
505var _d9=nil,_da=_sublayers.length;
506while(_da--){
507if(_d9=objj_msgSend(_sublayers[_da],"hitTest:",_d8)){
508return _d9;
509}
510}
511return _d5;
512}
513}),new objj_method(sel_getUid("setDelegate:"),function(_db,_dc,_dd){
514with(_db){
515if(_delegate==_dd){
516return;
517}
518_delegate=_dd;
519_delegateRespondsToDisplayLayerSelector=objj_msgSend(_delegate,"respondsToSelector:",sel_getUid("displayLayer:"));
520_delegateRespondsToDrawLayerInContextSelector=objj_msgSend(_delegate,"respondsToSelector:",sel_getUid("drawLayer:inContext:"));
521if(_delegateRespondsToDisplayLayerSelector||_delegateRespondsToDrawLayerInContextSelector){
522objj_msgSend(_db,"setNeedsDisplay");
523}
524}
525}),new objj_method(sel_getUid("delegate"),function(_de,_df){
526with(_de){
527return _delegate;
528}
529}),new objj_method(sel_getUid("_setOwningView:"),function(_e0,_e1,_e2){
530with(_e0){
531_owningView=_e2;
532if(_owningView){
533_owningView=_e2;
534_bounds.size=CGSizeMakeCopy(objj_msgSend(_owningView,"bounds").size);
535_position=CGPointMake((_bounds.size.width)*_anchorPoint.x,(_bounds.size.height)*_anchorPoint.y);
536}
537_CALayerRecalculateGeometry(_e0,_36|_35);
538}
539}),new objj_method(sel_getUid("_owningViewBoundsChanged"),function(_e3,_e4){
540with(_e3){
541_bounds.size=CGSizeMakeCopy(objj_msgSend(_owningView,"bounds").size);
542_position=CGPointMake((_bounds.size.width)*_anchorPoint.x,(_bounds.size.height)*_anchorPoint.y);
543_CALayerRecalculateGeometry(_e3,_36|_35);
544}
545}),new objj_method(sel_getUid("_update"),function(_e5,_e6){
546with(_e5){
547window.loop=true;
548var _e7=_runLoopUpdateMask;
549if(_e7&_40){
550_CALayerUpdateDOM(_e5,_e7);
551}
552if(_e7&_3e){
553objj_msgSend(_e5,"display");
554}else{
555if(_e7&_3c||_e7&_3f){
556objj_msgSend(_e5,"composite");
557}
558}
559_runLoopUpdateMask=0;
560window.loop=false;
561}
562})]);
563class_addMethods(_43,[new objj_method(sel_getUid("layer"),function(_e8,_e9){
564with(_e8){
565return objj_msgSend(objj_msgSend(objj_msgSend(_e8,"class"),"alloc"),"init");
566}
567}),new objj_method(sel_getUid("runLoopUpdateLayers"),function(_ea,_eb){
568with(_ea){
569if(window.oops){
570alert(window.latest);
571objj_debug_print_backtrace();
572}
573window.loop=true;
574for(hash in _41){
575var _ec=_41[hash],_ed=_ec._runLoopUpdateMask;
576if(_ed&_40){
577_CALayerUpdateDOM(_ec,_ed);
578}
579if(_ed&_3e){
580objj_msgSend(_ec,"display");
581}else{
582if(_ed&_3c||_ed&_3f){
583objj_msgSend(_ec,"composite");
584}
585}
586_ec._runLoopUpdateMask=0;
587}
588window.loop=false;
589_41=nil;
590}
591})]);
592_CALayerUpdateSublayerTransformForSublayers=function(_ee){
593var _ef=_ee._bounds,_f0=_ee._anchorPoint,_f1=(_ef.size.width)*_f0.x,_f2=(_ef.size.height)*_f0.y;
594_ee._sublayerTransformForSublayers=CGAffineTransformConcat(CGAffineTransformMakeTranslation(-_f1,-_f2),CGAffineTransformConcat(_ee._sublayerTransform,CGAffineTransformMakeTranslation(_f1,_f2)));
595};
596_CALayerUpdateDOM=function(_f3,_f4){
597var _f5=_f3._DOMElement.style;
598if(_f4&_3d){
599_f5.zIndex=_f3._zPosition;
600}
601var _f6=_f3._backingStoreFrame;
602if(_f4&_3b){
603_f5.top=ROUND((_f6.origin.y))+"px";
604_f5.left=ROUND((_f6.origin.x))+"px";
605}
606if(_f4&_3c){
607var _f7=MAX(0,ROUND((_f6.size.width))),_f8=MAX(0,ROUND((_f6.size.height))),_f9=_f3._DOMContentsElement;
608_f5.width=_f7+"px";
609_f5.height=_f8+"px";
610if(_f9){
611_f9.width=_f7;
612_f9.height=_f8;
613_f9.style.width=_f7+"px";
614_f9.style.height=_f8+"px";
615}
616}
617};
618_CALayerRecalculateGeometry=function(_fa,_fb){
619var _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;
620_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)));
621if(_fd&&_fd._hasSublayerTransform){
622var tx=_fa._transformFromLayer.tx*_fd._sublayerTransformForSublayers.a+_fa._transformFromLayer.ty*_fd._sublayerTransformForSublayers.c+_fd._sublayerTransformForSublayers.tx;
623_fa._transformFromLayer.ty=_fa._transformFromLayer.tx*_fd._sublayerTransformForSublayers.b+_fa._transformFromLayer.ty*_fd._sublayerTransformForSublayers.d+_fd._sublayerTransformForSublayers.ty;
624_fa._transformFromLayer.tx=tx;
625var 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;
626_fa._transformFromLayer.d=_fa._transformFromLayer.c*_fd._sublayerTransformForSublayers.b+_fa._transformFromLayer.d*_fd._sublayerTransformForSublayers.d;
627_fa._transformFromLayer.a=a;
628_fa._transformFromLayer.b=b;
629_fa._transformFromLayer.c=c;
630}
631_fa._transformToLayer=CGAffineTransformInvert(_fa._transformFromLayer);
632_fa._frame=nil;
633_fa._standardBackingStoreFrame=objj_msgSend(_fa,"convertRect:toLayer:",_fc,nil);
634if(_fd){
635var _fc=objj_msgSend(_fd,"bounds"),_109=objj_msgSend(_fd,"convertRect:toLayer:",_fc,nil);
636_fa._standardBackingStoreFrame.origin.x-=(_109.origin.x);
637_fa._standardBackingStoreFrame.origin.y-=(_109.origin.y);
638}
639var _10a=_fa._standardBackingStoreFrame.origin,size=_fa._standardBackingStoreFrame.size;
640_10a.x=FLOOR(_10a.x);
641_10a.y=FLOOR(_10a.y);
642size.width=CEIL(size.width)+1;
643size.height=CEIL(size.height)+1;
644if(!_104){
645var _10c=CGRectMakeCopy(_fa._standardBackingStoreFrame);
646if(ROUND((_10c.origin.x))!=ROUND((_fa._backingStoreFrame.origin.x))||ROUND((_10c.origin.y))!=ROUND((_fa._backingStoreFrame.origin.y))){
647objj_msgSend(_fa,"registerRunLoopUpdateWithMask:",_3b);
648}
649if(((_10c.size.width)!=ROUND((_fa._backingStoreFrame.size.width))||(_10c.size.height)!=ROUND((_fa._backingStoreFrame.size.height)))){
650objj_msgSend(_fa,"registerRunLoopUpdateWithMask:",_3c);
651}
652_fa._backingStoreFrame=_10c;
653}
654if(_fb&_35&&_fa._needsDisplayOnBoundsChange){
655objj_msgSend(_fa,"setNeedsDisplay");
656}else{
657if(_104||(_fb&~(_36|_37))){
658objj_msgSend(_fa,"setNeedsComposite");
659}
660}
661var _10d=_fa._sublayers,_10e=0,_10f=_10d.length;
662for(;_10e<_10f;++_10e){
663_CALayerRecalculateGeometry(_10d[_10e],_fb);
664}
665};
666_CALayerGetTransform=function(_110,_111){
667var _112=CGAffineTransformMakeIdentity();
668if(_110){
669var _113=_110;
670while(_113&&_113!=_111){
671var _114=_113._transformFromLayer;
672var tx=_112.tx*_114.a+_112.ty*_114.c+_114.tx;
673_112.ty=_112.tx*_114.b+_112.ty*_114.d+_114.ty;
674_112.tx=tx;
675var 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;
676_112.d=_112.c*_114.b+_112.d*_114.d;
677_112.a=a;
678_112.b=b;
679_112.c=c;
680_113=_113._superlayer;
681}
682if(_113==_111){
683return _112;
684}
685}
686var _119=[],_113=_111;
687while(_113){
688_119.push(_113);
689_113=_113._superlayer;
690}
691var _11a=_119.length;
692while(_11a--){
693var _11b=_119[_11a]._transformToLayer;
694var tx=_112.tx*_11b.a+_112.ty*_11b.c+_11b.tx;
695_112.ty=_112.tx*_11b.b+_112.ty*_11b.d+_11b.ty;
696_112.tx=tx;
697var 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;
698_112.d=_112.c*_11b.b+_112.d*_11b.d;
699_112.a=a;
700_112.b=b;
701_112.c=c;
702}
703return _112;
704};