|
@@ -98,12 +98,16 @@ class Texture {
|
|
return format.match(SRGB | SRGB_ALPHA);
|
|
return format.match(SRGB | SRGB_ALPHA);
|
|
}
|
|
}
|
|
|
|
|
|
- public function clone( ?allocPos : h3d.impl.AllocPos ) {
|
|
|
|
- if( t == null ) {
|
|
|
|
- if( realloc == null ) throw "Can't clone disposed texture";
|
|
|
|
|
|
+ function checkAlloc() {
|
|
|
|
+ if( t == null && realloc != null ) {
|
|
alloc();
|
|
alloc();
|
|
realloc();
|
|
realloc();
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function clone( ?allocPos : h3d.impl.AllocPos ) {
|
|
|
|
+ checkAlloc();
|
|
|
|
+ if( t == null ) throw "Can't clone disposed texture";
|
|
var old = lastFrame;
|
|
var old = lastFrame;
|
|
preventAutoDispose();
|
|
preventAutoDispose();
|
|
var flags = [];
|
|
var flags = [];
|
|
@@ -279,6 +283,8 @@ class Texture {
|
|
BEWARE : if the texture is a cached image (hxd.res.Image), the swap will affect the cache!
|
|
BEWARE : if the texture is a cached image (hxd.res.Image), the swap will affect the cache!
|
|
**/
|
|
**/
|
|
public function swapTexture( t : Texture ) {
|
|
public function swapTexture( t : Texture ) {
|
|
|
|
+ checkAlloc();
|
|
|
|
+ t.checkAlloc();
|
|
if( isDisposed() || t.isDisposed() )
|
|
if( isDisposed() || t.isDisposed() )
|
|
throw "One of the two texture is disposed";
|
|
throw "One of the two texture is disposed";
|
|
var tmp = this.t;
|
|
var tmp = this.t;
|