| 66 |
protected set; |
protected set; |
| 67 |
} |
} |
| 68 |
public Vector3 vc拡大縮小倍率; |
public Vector3 vc拡大縮小倍率; |
| 69 |
|
public string filename; |
| 70 |
|
|
| 71 |
// 画面が変わるたび以下のプロパティを設定し治すこと。 |
// 画面が変わるたび以下のプロパティを設定し治すこと。 |
| 72 |
|
|
| 87 |
this.szテクスチャサイズ = new Size( 0, 0 ); |
this.szテクスチャサイズ = new Size( 0, 0 ); |
| 88 |
this._透明度 = 0xff; |
this._透明度 = 0xff; |
| 89 |
this.texture = null; |
this.texture = null; |
| 90 |
|
this.bSlimDXTextureDispose完了済み = true; |
| 91 |
this.cvPositionColoredVertexies = null; |
this.cvPositionColoredVertexies = null; |
| 92 |
this.b加算合成 = false; |
this.b加算合成 = false; |
| 93 |
this.fZ軸中心回転 = 0f; |
this.fZ軸中心回転 = 0f; |
| 94 |
this.vc拡大縮小倍率 = new Vector3( 1f, 1f, 1f ); |
this.vc拡大縮小倍率 = new Vector3( 1f, 1f, 1f ); |
| 95 |
|
this.filename = ""; // DTXMania rev:693bf14b0d83efc770235c788117190d08a4e531 |
| 96 |
// this._txData = null; |
// this._txData = null; |
| 97 |
} |
} |
| 98 |
|
|
| 123 |
stream.Seek( 0L, SeekOrigin.Begin ); |
stream.Seek( 0L, SeekOrigin.Begin ); |
| 124 |
int colorKey = unchecked( (int) 0xFF000000 ); |
int colorKey = unchecked( (int) 0xFF000000 ); |
| 125 |
this.texture = Texture.FromStream( device, stream, this.szテクスチャサイズ.Width, this.szテクスチャサイズ.Height, 1, Usage.None, format, poolvar, Filter.Point, Filter.None, colorKey ); |
this.texture = Texture.FromStream( device, stream, this.szテクスチャサイズ.Width, this.szテクスチャサイズ.Height, 1, Usage.None, format, poolvar, Filter.Point, Filter.None, colorKey ); |
| 126 |
|
this.bSlimDXTextureDispose完了済み = false; |
| 127 |
} |
} |
| 128 |
} |
} |
| 129 |
catch ( Exception e ) |
catch ( Exception e ) |
| 217 |
#endif |
#endif |
| 218 |
// 中で更にメモリ読み込みし直していて無駄なので、Streamを使うのは止めたいところ |
// 中で更にメモリ読み込みし直していて無駄なので、Streamを使うのは止めたいところ |
| 219 |
this.texture = Texture.FromStream( device, stream, n幅, n高さ, 1, usage, format, pool, Filter.Point, Filter.None, 0 ); |
this.texture = Texture.FromStream( device, stream, n幅, n高さ, 1, usage, format, pool, Filter.Point, Filter.None, 0 ); |
| 220 |
|
this.bSlimDXTextureDispose完了済み = false; |
| 221 |
} |
} |
| 222 |
} |
} |
| 223 |
} |
} |
| 252 |
throw new FileNotFoundException( string.Format( "ファイルが存在しません。\n[{0}]", strファイル名 ) ); |
throw new FileNotFoundException( string.Format( "ファイルが存在しません。\n[{0}]", strファイル名 ) ); |
| 253 |
|
|
| 254 |
Byte[] _txData = File.ReadAllBytes( strファイル名 ); |
Byte[] _txData = File.ReadAllBytes( strファイル名 ); |
| 255 |
|
this.filename = Path.GetFileName( strファイル名 ); |
| 256 |
MakeTexture( device, _txData, format, b黒を透過する, pool ); |
MakeTexture( device, _txData, format, b黒を透過する, pool ); |
| 257 |
} |
} |
| 258 |
|
|
| 278 |
// { |
// { |
| 279 |
//Trace.TraceInformation( "CTexture() start: " ); |
//Trace.TraceInformation( "CTexture() start: " ); |
| 280 |
this.texture = Texture.FromMemory( device, txData, this.sz画像サイズ.Width, this.sz画像サイズ.Height, 1, Usage.None, format, pool, Filter.Point, Filter.None, colorKey ); |
this.texture = Texture.FromMemory( device, txData, this.sz画像サイズ.Width, this.sz画像サイズ.Height, 1, Usage.None, format, pool, Filter.Point, Filter.None, colorKey ); |
| 281 |
|
this.bSlimDXTextureDispose完了済み = false; |
| 282 |
//Trace.TraceInformation( "CTexture() end: " ); |
//Trace.TraceInformation( "CTexture() end: " ); |
| 283 |
// } |
// } |
| 284 |
} |
} |
| 344 |
#endif |
#endif |
| 345 |
texture.UnlockRectangle( 0 ); |
texture.UnlockRectangle( 0 ); |
| 346 |
bitmap.UnlockBits( srcBufData ); |
bitmap.UnlockBits( srcBufData ); |
| 347 |
|
this.bSlimDXTextureDispose完了済み = false; |
| 348 |
} |
} |
| 349 |
//Trace.TraceInformation( "CTExture() End: " ); |
//Trace.TraceInformation( "CTExture() End: " ); |
| 350 |
} |
} |
| 746 |
//----------------- |
//----------------- |
| 747 |
public void Dispose() |
public void Dispose() |
| 748 |
{ |
{ |
| 749 |
if( !this.bDispose完了済み ) |
this.Dispose(true); |
| 750 |
|
GC.SuppressFinalize(this); |
| 751 |
|
} |
| 752 |
|
protected void Dispose(bool disposeManagedObjects) |
| 753 |
|
{ |
| 754 |
|
if (this.bDispose完了済み) |
| 755 |
|
return; |
| 756 |
|
|
| 757 |
|
if (disposeManagedObjects) |
| 758 |
{ |
{ |
| 759 |
// テクスチャの破棄 |
// (A) Managed リソースの解放 |
| 760 |
if( this.texture != null ) |
// テクスチャの破棄 (SharpDXのテクスチャは、SharpDX側で管理されるため、FDKからはmanagedリソースと見做す) |
| 761 |
|
if (this.texture != null) |
| 762 |
{ |
{ |
| 763 |
this.texture.Dispose(); |
this.texture.Dispose(); |
| 764 |
this.texture = null; |
this.texture = null; |
| 765 |
|
this.bSlimDXTextureDispose完了済み = true; |
| 766 |
} |
} |
| 767 |
|
} |
| 768 |
|
|
| 769 |
this.bDispose完了済み = true; |
// (B) Unamanaged リソースの解放 |
| 770 |
|
|
| 771 |
|
|
| 772 |
|
this.bDispose完了済み = true; |
| 773 |
|
} |
| 774 |
|
~CTexture() |
| 775 |
|
{ |
| 776 |
|
// ファイナライザの動作時にtextureのDisposeがされていない場合は、 |
| 777 |
|
// CTextureのDispose漏れと見做して警告をログ出力する |
| 778 |
|
if (!this.bSlimDXTextureDispose完了済み) |
| 779 |
|
{ |
| 780 |
|
Trace.TraceWarning("CTexture: Dispose漏れを検出しました。(Size=({0}, {1}), filename={2})", sz画像サイズ.Width, sz画像サイズ.Height, filename ); |
| 781 |
} |
} |
| 782 |
|
this.Dispose(false); |
| 783 |
} |
} |
| 784 |
//----------------- |
//----------------- |
| 785 |
#endregion |
#endregion |
| 790 |
#region [ private ] |
#region [ private ] |
| 791 |
//----------------- |
//----------------- |
| 792 |
private int _透明度; |
private int _透明度; |
| 793 |
private bool bDispose完了済み; |
private bool bDispose完了済み, bSlimDXTextureDispose完了済み; |
| 794 |
private PositionColoredTexturedVertex[] cvPositionColoredVertexies; |
private PositionColoredTexturedVertex[] cvPositionColoredVertexies; |
| 795 |
protected TransformedColoredTexturedVertex[] cvTransformedColoredVertexies = new TransformedColoredTexturedVertex[] |
protected TransformedColoredTexturedVertex[] cvTransformedColoredVertexies = new TransformedColoredTexturedVertex[] |
| 796 |
{ |
{ |