Window.resizeが失敗することがある不具合を修正
@@ -158,10 +158,12 @@ | ||
158 | 158 | for( i = 0; i < g_RenderTargetList.count; i++ ) |
159 | 159 | { |
160 | 160 | struct DXRubyRenderTarget *rt = (struct DXRubyRenderTarget *)g_RenderTargetList.pointer[i]; |
161 | - | |
161 | + if( g_RenderTargetList.pointer[i] ) | |
162 | + { | |
162 | 163 | // ppD3DTexture[i] = to_image( rt ); |
163 | - RELEASE( rt->surface ); | |
164 | - RELEASE( rt->texture->pD3DTexture ); | |
164 | + RELEASE( rt->surface ); | |
165 | + RELEASE( rt->texture->pD3DTexture ); | |
166 | + } | |
165 | 167 | } |
166 | 168 | |
167 | 169 | /* シェーダのロスト */ |
@@ -185,15 +187,17 @@ | ||
185 | 187 | for( i = 0; i < g_RenderTargetList.count; i++ ) |
186 | 188 | { |
187 | 189 | struct DXRubyRenderTarget *rt = (struct DXRubyRenderTarget *)g_RenderTargetList.pointer[i]; |
190 | + if( g_RenderTargetList.pointer[i] ) | |
191 | + { | |
192 | + /* テクスチャオブジェクトを作成する */ | |
193 | + hr = D3DXCreateTexture( g_pD3DDevice, (UINT)rt->texture->width, (UINT)rt->texture->height, | |
194 | + 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, | |
195 | + &rt->texture->pD3DTexture); | |
196 | + if( FAILED( hr ) ) return 2; | |
188 | 197 | |
189 | - /* テクスチャオブジェクトを作成する */ | |
190 | - hr = D3DXCreateTexture( g_pD3DDevice, (UINT)rt->texture->width, (UINT)rt->texture->height, | |
191 | - 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, | |
192 | - &rt->texture->pD3DTexture); | |
193 | - if( FAILED( hr ) ) return 2; | |
194 | - | |
195 | - hr = rt->texture->pD3DTexture->lpVtbl->GetSurfaceLevel( rt->texture->pD3DTexture, 0, &rt->surface ); | |
196 | - if( FAILED( hr ) ) return 3; | |
198 | + hr = rt->texture->pD3DTexture->lpVtbl->GetSurfaceLevel( rt->texture->pD3DTexture, 0, &rt->surface ); | |
199 | + if( FAILED( hr ) ) return 3; | |
200 | + } | |
197 | 201 | } |
198 | 202 | |
199 | 203 | /* シェーダの復帰 */ |
@@ -310,8 +314,11 @@ | ||
310 | 314 | for( i = 0; i < g_RenderTargetList.count; i++ ) |
311 | 315 | { |
312 | 316 | struct DXRubyRenderTarget *rt = (struct DXRubyRenderTarget *)g_RenderTargetList.pointer[i]; |
313 | - RELEASE( rt->surface ); | |
314 | - RELEASE( rt->texture->pD3DTexture ); | |
317 | + if( g_RenderTargetList.pointer[i] ) | |
318 | + { | |
319 | + RELEASE( rt->surface ); | |
320 | + RELEASE( rt->texture->pD3DTexture ); | |
321 | + } | |
315 | 322 | } |
316 | 323 | |
317 | 324 | /* シェーダのロスト */ |
@@ -343,15 +350,17 @@ | ||
343 | 350 | for( i = 0; i < g_RenderTargetList.count; i++ ) |
344 | 351 | { |
345 | 352 | struct DXRubyRenderTarget *rt = (struct DXRubyRenderTarget *)g_RenderTargetList.pointer[i]; |
353 | + if( g_RenderTargetList.pointer[i] ) | |
354 | + { | |
355 | + /* テクスチャオブジェクトを作成する */ | |
356 | + hr = D3DXCreateTexture( g_pD3DDevice, (UINT)rt->texture->width, (UINT)rt->texture->height, | |
357 | + 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, | |
358 | + &rt->texture->pD3DTexture); | |
359 | + if( FAILED( hr ) ) return 2; | |
346 | 360 | |
347 | - /* テクスチャオブジェクトを作成する */ | |
348 | - hr = D3DXCreateTexture( g_pD3DDevice, (UINT)rt->texture->width, (UINT)rt->texture->height, | |
349 | - 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, | |
350 | - &rt->texture->pD3DTexture); | |
351 | - if( FAILED( hr ) ) return 2; | |
352 | - | |
353 | - hr = rt->texture->pD3DTexture->lpVtbl->GetSurfaceLevel( rt->texture->pD3DTexture, 0, &rt->surface ); | |
354 | - if( FAILED( hr ) ) return 3; | |
361 | + hr = rt->texture->pD3DTexture->lpVtbl->GetSurfaceLevel( rt->texture->pD3DTexture, 0, &rt->surface ); | |
362 | + if( FAILED( hr ) ) return 3; | |
363 | + } | |
355 | 364 | } |
356 | 365 | |
357 | 366 | /* シェーダの復帰 */ |
@@ -1095,6 +1104,7 @@ | ||
1095 | 1104 | int ret; |
1096 | 1105 | |
1097 | 1106 | ret = SendMessage( g_hWnd, WM_APP + 1, 0, 0 ); |
1107 | + | |
1098 | 1108 | switch( ret ) |
1099 | 1109 | { |
1100 | 1110 | case 0: |