public static void uploadBitmapData(bc.flash.display3D.textures.AsTexture nativeTexture, AsBitmapData data, bool generateMipmaps)
 {
     nativeTexture.uploadFromBitmapData(data);
     if(generateMipmaps && data.getWidth() > 1 && data.getHeight() > 1)
     {
         int currentWidth = data.getWidth() >> 1;
         int currentHeight = data.getHeight() >> 1;
         int level = 1;
         AsBitmapData canvas = new AsBitmapData(currentWidth, currentHeight, true, 0);
         AsMatrix transform = new AsMatrix(.5f, 0, 0, .5f);
         AsRectangle bounds = new AsRectangle();
         while(currentWidth >= 1 || currentHeight >= 1)
         {
             bounds.width = currentWidth;
             bounds.height = currentHeight;
             canvas.fillRect(bounds, (uint)(0));
             canvas.draw(data, transform, null, null, null, true);
             nativeTexture.uploadFromBitmapData(canvas, (uint)(level++));
             transform.scale(0.5f, 0.5f);
             currentWidth = currentWidth >> 1;
             currentHeight = currentHeight >> 1;
         }
         canvas.dispose();
     }
 }
 public override bc.flash.xml.AsXML appendChild(bc.flash.xml.AsXML child)
 {
     return mChildren.appendChild(child);
 }
 public static void uploadAtfData(bc.flash.display3D.textures.AsTexture nativeTexture, AsByteArray data, int offset)
 {
     nativeTexture.uploadCompressedTextureFromByteArray(data, (uint)(offset));
 }
 public static void uploadAtfData(bc.flash.display3D.textures.AsTexture nativeTexture, AsByteArray data)
 {
     uploadAtfData(nativeTexture, data, 0);
 }
 private void autoScaleNativeTextField(bc.flash.text.AsTextField textField)
 {
     float size = ((float)(textField.getDefaultTextFormat().getSize()));
     int maxHeight = (int)(textField.getHeight() - 4);
     int maxWidth = (int)(textField.getWidth() - 4);
     while(textField.getTextWidth() > maxWidth || textField.getTextHeight() > maxHeight)
     {
         if(size <= 4)
         {
             break;
         }
         AsTextFormat format = textField.getDefaultTextFormat();
         format.setSize(size--);
         textField.setTextFormat(format);
     }
 }
 public virtual void testFuncParams(bc.test.basic.packages.foo.AsPackageClass foo1, bc.test.basic.packages.bar.AsPackageClass foo2)
 {
     this.foo1 = foo1;
     this.foo2 = foo2;
 }
 public AsStarling(AsClass rootClass, bc.flash.display.AsStage stage, AsRectangle viewPort, AsStage3D stage3D, String renderMode, String profile)
 {
     if(stage == null)
     {
         throw new AsArgumentError("Stage must not be null");
     }
     if(rootClass == null)
     {
         throw new AsArgumentError("Root class must not be null");
     }
     if(viewPort == null)
     {
         viewPort = new AsRectangle(0, 0, stage.getStageWidth(), stage.getStageHeight());
     }
     if(stage3D == null)
     {
         stage3D = stage.getStage3Ds()[0];
     }
     makeCurrent();
     mRootClass = rootClass;
     mViewPort = viewPort;
     mStage3D = stage3D;
     mStage = new AsStage(viewPort.width, viewPort.height, stage.getColor());
     mNativeOverlay = new AsSprite();
     mNativeStage = stage;
     mNativeStage.addChild(mNativeOverlay);
     mTouchProcessor = new AsTouchProcessor(mStage);
     mJuggler = new AsJuggler();
     mAntiAliasing = 0;
     mSimulateMultitouch = false;
     mEnableErrorChecking = false;
     mLastFrameTimestamp = AsGlobal.getTimer() / 1000.0f;
     mPrograms = new AsDictionary();
     mCustomData = new AsDictionary();
     mSupport = new AsRenderSupport();
     AsArray __touchEventTypes_ = getTouchEventTypes();
     if (__touchEventTypes_ != null)
     {
         foreach (String touchEventType in __touchEventTypes_)
         {
             stage.addEventListener(touchEventType, onTouch, false, 0, true);
         }
     }
     stage.addEventListener(AsEvent.ENTER_FRAME, onEnterFrame, false, 0, true);
     stage.addEventListener(AsKeyboardEvent.KEY_DOWN, onKey, false, 0, true);
     stage.addEventListener(AsKeyboardEvent.KEY_UP, onKey, false, 0, true);
     stage.addEventListener(AsEvent.RESIZE, onResize, false, 0, true);
     if(mStage3D.getContext3D() != null && mStage3D.getContext3D().getDriverInfo() != "Disposed")
     {
         mShareContext = true;
         AsGlobal.setTimeout(initialize, 1);
     }
     else
     {
         mShareContext = false;
         mStage3D.addEventListener(AsEvent.CONTEXT3D_CREATE, onContextCreated, false, 1, true);
         mStage3D.addEventListener(AsErrorEvent.ERROR, onStage3DError, false, 1, true);
         try
         {
             mStage3D.requestContext3D(renderMode);
         }
         catch (AsError e)
         {
             showFatalError("Context3D error: " + e.message);
         }
     }
 }
 private void onResize(bc.flash.events.AsEvent _event)
 {
     bc.flash.display.AsStage stage = _event.getTarget() as Asbc.flash.display.Stage;
     mStage.dispatchEvent(new AsResizeEvent(AsEvent.RESIZE, stage.getStageWidth(), stage.getStageHeight()));
 }
 public AsStarling(AsClass rootClass, bc.flash.display.AsStage stage)
     : this(rootClass, stage, null, null, "auto", "baselineConstrained")
 {
 }
 public AsStarling(AsClass rootClass, bc.flash.display.AsStage stage, AsRectangle viewPort)
     : this(rootClass, stage, viewPort, null, "auto", "baselineConstrained")
 {
 }
 public AsStarling(AsClass rootClass, bc.flash.display.AsStage stage, AsRectangle viewPort, AsStage3D stage3D, String renderMode)
     : this(rootClass, stage, viewPort, stage3D, renderMode, "baselineConstrained")
 {
 }