H. Verbeet : wined3d: Store the texture in a local variable in sampler_texmatrix().

Alexandre Julliard julliard at winehq.org
Thu Jul 17 06:37:52 CDT 2008


Module: wine
Branch: master
Commit: c72c70d609e6543f72ea2f560b4b07d2185caf7b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c72c70d609e6543f72ea2f560b4b07d2185caf7b

Author: H. Verbeet <hverbeet at gmail.com>
Date:   Wed Jul 16 22:45:45 2008 +0200

wined3d: Store the texture in a local variable in sampler_texmatrix().

Slightly improves readability.

---

 dlls/wined3d/state.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 106fb55..fc7b80d 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -2308,8 +2308,9 @@ static void tex_bumpenvloffset(DWORD state, IWineD3DStateBlockImpl *stateblock,
 static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
     BOOL texIsPow2 = FALSE;
     DWORD sampler = state - STATE_SAMPLER(0);
+    IWineD3DBaseTexture *texture = stateblock->textures[sampler];
 
-    if(!stateblock->textures[sampler]) return;
+    if(!texture) return;
     /* The fixed function np2 texture emulation uses the texture matrix to fix up the coordinates
      * IWineD3DBaseTexture::ApplyStateChanges multiplies the set matrix with a fixup matrix. Before the
      * scaling is reapplied or removed, the texture matrix has to be reapplied
@@ -2320,12 +2321,12 @@ static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, W
     if(!GL_SUPPORT(ARB_TEXTURE_NON_POWER_OF_TWO) && sampler < MAX_TEXTURES) {
         if(stateblock->textureDimensions[sampler] == GL_TEXTURE_2D ||
            stateblock->textureDimensions[sampler] == GL_TEXTURE_RECTANGLE_ARB) {
-            if(((IWineD3DTextureImpl *) stateblock->textures[sampler])->baseTexture.pow2Matrix[0] != 1.0 ||
-               ((IWineD3DTextureImpl *) stateblock->textures[sampler])->baseTexture.pow2Matrix[5] != 1.0 ) {
+            if(((IWineD3DTextureImpl *)texture)->baseTexture.pow2Matrix[0] != 1.0 ||
+               ((IWineD3DTextureImpl *)texture)->baseTexture.pow2Matrix[5] != 1.0 ) {
                 texIsPow2 = TRUE;
             }
         } else if(stateblock->textureDimensions[sampler] == GL_TEXTURE_CUBE_MAP_ARB) {
-            if(((IWineD3DCubeTextureImpl *) stateblock->textures[sampler])->baseTexture.pow2Matrix[0] != 1.0) {
+            if(((IWineD3DCubeTextureImpl *)texture)->baseTexture.pow2Matrix[0] != 1.0) {
                 texIsPow2 = TRUE;
             }
         }




More information about the wine-cvs mailing list