Skip to content

Commit

Permalink
renamed 'Texture.asyncBitmapUploadSupported' to '...Enabled'; changed…
Browse files Browse the repository at this point in the history
… default to 'false' for now
  • Loading branch information
PrimaryFeather committed Jun 27, 2017
1 parent 3b0ff4a commit 48d277c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
12 changes: 6 additions & 6 deletions starling/src/starling/textures/ConcretePotTexture.as
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ package starling.textures
private static var sMatrix:Matrix = new Matrix();
private static var sRectangle:Rectangle = new Rectangle();
private static var sOrigin:Point = new Point();
private static var sAsyncSupported:Boolean = true;
private static var sAsyncUploadEnabled:Boolean = false;

/** Creates a new instance with the given parameters. */
public function ConcretePotTexture(base:flash.display3D.textures.Texture, format:String,
Expand Down Expand Up @@ -148,19 +148,19 @@ package starling.textures

private function uploadAsync(source:BitmapData, mipLevel:uint):void
{
if (sAsyncSupported)
if (sAsyncUploadEnabled)
{
try { base["uploadFromBitmapDataAsync"](source, mipLevel); }
catch (error:Error)
{
if (error.errorID == 3708 || error.errorID == 1069)
sAsyncSupported = false;
sAsyncUploadEnabled = false;
else
throw error;
}
}

if (!sAsyncSupported)
if (!sAsyncUploadEnabled)
{
setTimeout(base.dispatchEvent, 1, new Event(Event.TEXTURE_READY));
potBase.uploadFromBitmapData(source);
Expand All @@ -182,7 +182,7 @@ package starling.textures
}

/** @private */
internal static function get asyncSupported():Boolean { return sAsyncSupported; }
internal static function set asyncSupported(value:Boolean):void { sAsyncSupported = value; }
internal static function get asyncUploadEnabled():Boolean { return sAsyncUploadEnabled; }
internal static function set asyncUploadEnabled(value:Boolean):void { sAsyncUploadEnabled = value; }
}
}
12 changes: 6 additions & 6 deletions starling/src/starling/textures/ConcreteRectangleTexture.as
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ package starling.textures
{
private var _textureReadyCallback:Function;

private static var sAsyncSupported:Boolean = true;
private static var sAsyncUploadEnabled:Boolean = false;

/** Creates a new instance with the given parameters. */
public function ConcreteRectangleTexture(base:RectangleTexture, format:String,
Expand Down Expand Up @@ -80,19 +80,19 @@ package starling.textures

private function uploadAsync(source:BitmapData):void
{
if (sAsyncSupported)
if (sAsyncUploadEnabled)
{
try { base["uploadFromBitmapDataAsync"](source); }
catch (error:Error)
{
if (error.errorID == 3708 || error.errorID == 1069)
sAsyncSupported = false; // feature or method not available
sAsyncUploadEnabled = false; // feature or method not available
else
throw error;
}
}

if (!sAsyncSupported)
if (!sAsyncUploadEnabled)
{
setTimeout(base.dispatchEvent, 1, new Event(Event.TEXTURE_READY));
rectBase.uploadFromBitmapData(source);
Expand All @@ -109,7 +109,7 @@ package starling.textures
}

/** @private */
internal static function get asyncSupported():Boolean { return sAsyncSupported; }
internal static function set asyncSupported(value:Boolean):void { sAsyncSupported = value; }
internal static function get asyncUploadEnabled():Boolean { return sAsyncUploadEnabled; }
internal static function set asyncUploadEnabled(value:Boolean):void { sAsyncUploadEnabled = value; }
}
}
24 changes: 10 additions & 14 deletions starling/src/starling/textures/Texture.as
Original file line number Diff line number Diff line change
Expand Up @@ -762,26 +762,22 @@ package starling.textures
return 4096;
}

/** Indicates if it should be attempted to upload bitmaps asynchronously when the
* <code>async</code> parameter is supplied to supported methods. This defaults to 'true',
* but automatically reverts to 'false' if the feature is not supported by the current
* AIR or Flash version.
/** Indicates if it should be attempted to upload bitmaps asynchronously when the <code>async</code> parameter
* is supplied to supported methods. Since this feature is still not 100% reliable in AIR 26 (especially on
* Android), it defaults to 'false' for now.
*
* <p>Even if disabled or unsupported, the <code>async</code> callback will still be
* executed; the upload will happen synchronously, though.</p>
*
* <p>At the time of this writing (with AIR 25), this feature is still problematic on
* some Android devices. It's recommended to deactivate it for production builds.</p>
* <p>If the feature is disabled or not available in the current AIR/Flash runtime, the async callback will
* still be executed; however, the upload itself will be made synchronously.</p>
*/
public static function get asyncBitmapUploadSupported():Boolean
public static function get asyncBitmapUploadEnabled():Boolean
{
return ConcreteRectangleTexture.asyncSupported;
return ConcreteRectangleTexture.asyncUploadEnabled;
}

public static function set asyncBitmapUploadSupported(value:Boolean):void
public static function set asyncBitmapUploadEnabled(value:Boolean):void
{
ConcreteRectangleTexture.asyncSupported = value;
ConcretePotTexture.asyncSupported = value;
ConcreteRectangleTexture.asyncUploadEnabled = value;
ConcretePotTexture.asyncUploadEnabled = value;
}
}
}

0 comments on commit 48d277c

Please sign in to comment.