OSDN Git Service

#xxxxx CTextureクラスの描画関数でまだ new を使っている箇所があったので、高速化のために排除。
authorfrom <from@16f42ceb-6dc6-49c8-ba94-f2d53467949d>
Wed, 21 Mar 2012 12:01:51 +0000 (12:01 +0000)
committerfrom <from@16f42ceb-6dc6-49c8-ba94-f2d53467949d>
Wed, 21 Mar 2012 12:01:51 +0000 (12:01 +0000)
#xxxxx CTextureクラスで間接的なメソッドを挟んでいたメソッドがあったので、高速化のために最終メソッドに直接飛ぶように変更。

git-svn-id: http://svn.osdn.jp/svnroot/dtxmania/trunk@332 16f42ceb-6dc6-49c8-ba94-f2d53467949d

FDK17プロジェクト/コード/04.グラフィック/CTexture.cs

index 2d48c1f..fd64561 100644 (file)
@@ -95,7 +95,8 @@ namespace FDK
                        {\r
                                this.sz画像サイズ = new Size( bitmap.Width, bitmap.Height );\r
                                this.szテクスチャサイズ = this.t指定されたサイズを超えない最適なテクスチャサイズを返す( device, this.sz画像サイズ );\r
-                               \r
+                               this.rc全画像 = new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height );\r
+\r
                                using( var stream = new MemoryStream() )\r
                                {\r
                                        bitmap.Save( stream, ImageFormat.Bmp );\r
@@ -169,7 +170,8 @@ namespace FDK
                        {\r
                                this.sz画像サイズ = new Size( n幅, n高さ );\r
                                this.szテクスチャサイズ = this.t指定されたサイズを超えない最適なテクスチャサイズを返す( device, this.sz画像サイズ );\r
-                               \r
+                               this.rc全画像 = new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height );\r
+               \r
                                using ( var bitmap = new Bitmap( 1, 1 ) )\r
                                {\r
                                        using ( var graphics = Graphics.FromImage( bitmap ) )\r
@@ -220,6 +222,7 @@ namespace FDK
                                \r
                                this.sz画像サイズ = new Size( information.Width, information.Height );\r
                                this.szテクスチャサイズ = this.t指定されたサイズを超えない最適なテクスチャサイズを返す( device, this.sz画像サイズ );\r
+                               this.rc全画像 = new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height );\r
 #if TEST_Direct3D9Ex\r
                                pool = poolvar;\r
 #endif\r
@@ -244,7 +247,7 @@ namespace FDK
                /// <param name="y">描画位置(テクスチャの左上位置の Y 座標[dot])。</param>\r
                public void t2D描画( Device device, int x, int y )\r
                {\r
-                       this.t2D描画( device, x, y, new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height ) );\r
+                       this.t2D描画( device, x, y, 1f, this.rc全画像 );\r
                }\r
                public void t2D描画( Device device, int x, int y, Rectangle rc画像内の描画領域 )\r
                {\r
@@ -269,7 +272,8 @@ namespace FDK
                                float f右U値 = ( (float) rc画像内の描画領域.Right ) / ( (float) this.szテクスチャサイズ.Width );\r
                                float f上V値 = ( (float) rc画像内の描画領域.Top ) / ( (float) this.szテクスチャサイズ.Height );\r
                                float f下V値 = ( (float) rc画像内の描画領域.Bottom ) / ( (float) this.szテクスチャサイズ.Height );\r
-                               int color = new Color4( ( (float) this._透明度 ) / 255f, 1f, 1f, 1f ).ToArgb();\r
+                               this.color4.Alpha = ( (float) this._透明度 ) / 255f;\r
+                               int color = this.color4.ToArgb();\r
 \r
                                if( this.cvTransformedColoredVertexies == null )\r
                                        this.cvTransformedColoredVertexies = new TransformedColoredTexturedVertex[ 4 ];\r
@@ -326,7 +330,8 @@ namespace FDK
                                float f右U値 = ( (float) rc画像内の描画領域.Right ) / ( (float) this.szテクスチャサイズ.Width );\r
                                float f上V値 = ( (float) rc画像内の描画領域.Top ) / ( (float) this.szテクスチャサイズ.Height );\r
                                float f下V値 = ( (float) rc画像内の描画領域.Bottom ) / ( (float) this.szテクスチャサイズ.Height );\r
-                               int color = new Color4( ( (float) this._透明度 ) / 255f, 1f, 1f, 1f ).ToArgb();\r
+                               this.color4.Alpha = ( (float) this._透明度 ) / 255f;\r
+                               int color = this.color4.ToArgb();\r
 \r
                                if( this.cvPositionColoredVertexies == null )\r
                                        this.cvPositionColoredVertexies = new PositionColoredTexturedVertex[ 4 ];\r
@@ -383,7 +388,7 @@ namespace FDK
                /// </summary>\r
                public void t3D描画( Device device, Matrix mat )\r
                {\r
-                       this.t3D描画( device, mat, new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height ) );\r
+                       this.t3D描画( device, mat, this.rc全画像 );\r
                }\r
                public void t3D描画( Device device, Matrix mat, Rectangle rc画像内の描画領域 )\r
                {\r
@@ -397,7 +402,8 @@ namespace FDK
                        float f右U値 = ( (float) rc画像内の描画領域.Right ) / ( (float) this.szテクスチャサイズ.Width );\r
                        float f上V値 = ( (float) rc画像内の描画領域.Top ) / ( (float) this.szテクスチャサイズ.Height );\r
                        float f下V値 = ( (float) rc画像内の描画領域.Bottom ) / ( (float) this.szテクスチャサイズ.Height );\r
-                       int color = new Color4( ( (float) this._透明度 ) / 255f, 1f, 1f, 1f ).ToArgb();\r
+                       this.color4.Alpha = ( (float) this._透明度 ) / 255f;\r
+                       int color = this.color4.ToArgb();\r
                        \r
                        if( this.cvPositionColoredVertexies == null )\r
                                this.cvPositionColoredVertexies = new PositionColoredTexturedVertex[ 4 ];\r
@@ -540,6 +546,12 @@ namespace FDK
 \r
                        return szサイズ;\r
                }\r
+\r
+               \r
+               // 2012.3.21 さらなる new の省略作戦\r
+\r
+               private Rectangle rc全画像;                                                          // テクスチャ作ったらあとは不変\r
+               private Color4 color4 = new Color4( 1f, 1f, 1f, 1f );   // アルファ以外は不変\r
                //-----------------\r
                #endregion\r
        }\r