~ubuntu-branches/ubuntu/wily/mupen64plus-video-rice/wily-proposed

« back to all changes in this revision

Viewing changes to src/TextureFilters.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Sven Eckelmann
  • Date: 2011-08-14 17:07:19 UTC
  • Revision ID: james.westby@ubuntu.com-20110814170719-0jfo1wcnysg6vzc7
Tags: 1.99.4-4
* debian/patches:
  - Rewrite highres_memcorruption.patch to prevent further crashes and texture
    corruptions

Show diffs side-by-side

added added

removed removed

Lines of Context:
1871
1871
    }
1872
1872
 
1873
1873
    // calculate the texture size magnification by comparing the N64 texture size and the hi-res texture size
1874
 
    int scalex = width / (int)entry.ti.WidthToLoad;
1875
 
    int scaley = height / (int)entry.ti.HeightToLoad;
 
1874
    int scale = 1 << scaleShift;
1876
1875
    int mirrorx = 1;
1877
1876
    int mirrory = 1;
1878
1877
    if (entry.ti.WidthToCreate/entry.ti.WidthToLoad == 2) mirrorx = 2;
1879
1878
    if (entry.ti.HeightToCreate/entry.ti.HeightToLoad == 2) mirrory = 2;
1880
 
    entry.pEnhancedTexture = CDeviceBuilder::GetBuilder()->CreateTexture(entry.ti.WidthToCreate*scalex*mirrorx, entry.ti.HeightToCreate*scaley*mirrory);
 
1879
    entry.pEnhancedTexture = CDeviceBuilder::GetBuilder()->CreateTexture(entry.ti.WidthToCreate*scale, entry.ti.HeightToCreate*scale);
1881
1880
    DrawInfo info;
1882
 
 
 
1881
    
1883
1882
    if( entry.pEnhancedTexture && entry.pEnhancedTexture->StartUpdate(&info) )
1884
1883
    {
1885
1884
 
1935
1934
 
1936
1935
        if (mirrorx == 2)
1937
1936
        {
1938
 
            //printf("Mirror: ToCreate: (%d,%d) ToLoad: (%d,%d) Scale: (%i,%i) Mirror: (%i,%i) Size: (%i,%i) Mask: %i\n", entry.ti.WidthToCreate, entry.ti.HeightToCreate, entry.ti.WidthToLoad, entry.ti.HeightToLoad, scalex, scaley, mirrorx, mirrory, width, height, entry.ti.maskS+scaleShift);
 
1937
            //printf("Mirror: ToCreate: (%d,%d) ToLoad: (%d,%d) Scale: (%i,%i) Mirror: (%i,%i) Size: (%i,%i) Mask: %i\n", entry.ti.WidthToCreate, entry.ti.HeightToCreate, entry.ti.WidthToLoad, entry.ti.HeightToLoad, scale, scale, mirrorx, mirrory, width, height, entry.ti.maskS+scaleShift);
1939
1938
            gTextureManager.Mirror(info.lpSurface, width, entry.ti.maskS+scaleShift, width*2, width*2, height, S_FLAG, 4 );
1940
1939
        }
1941
1940
 
1942
1941
        if (mirrory == 2)
1943
1942
        {
1944
 
            //printf("Mirror: ToCreate: (%d,%d) ToLoad: (%d,%d) Scale: (%i,%i) Mirror: (%i,%i) Size: (%i,%i) Mask: %i\n", entry.ti.WidthToCreate, entry.ti.HeightToCreate, entry.ti.WidthToLoad, entry.ti.HeightToLoad, scalex, scaley, mirrorx, mirrory, width, height, entry.ti.maskT+scaleShift);
 
1943
            //printf("Mirror: ToCreate: (%d,%d) ToLoad: (%d,%d) Scale: (%i,%i) Mirror: (%i,%i) Size: (%i,%i) Mask: %i\n", entry.ti.WidthToCreate, entry.ti.HeightToCreate, entry.ti.WidthToLoad, entry.ti.HeightToLoad, scale, scale, mirrorx, mirrory, width, height, entry.ti.maskT+scaleShift);
1945
1944
            gTextureManager.Mirror(info.lpSurface, height, entry.ti.maskT+scaleShift, height*2, entry.pEnhancedTexture->m_dwCreatedTextureWidth, height, T_FLAG, 4 );
1946
1945
        }
1947
1946
 
1948
 
        if( entry.ti.WidthToCreate*scalex*mirrorx < entry.pEnhancedTexture->m_dwCreatedTextureWidth )
 
1947
        if( entry.ti.WidthToCreate*scale < entry.pEnhancedTexture->m_dwCreatedTextureWidth )
1949
1948
        {
1950
1949
            // Clamp
1951
1950
            gTextureManager.Clamp(info.lpSurface, width, entry.pEnhancedTexture->m_dwCreatedTextureWidth, entry.pEnhancedTexture->m_dwCreatedTextureWidth, height, S_FLAG, 4 );
1952
1951
        }
1953
 
        if( entry.ti.HeightToCreate*scaley*mirrory < entry.pEnhancedTexture->m_dwCreatedTextureHeight )
 
1952
        if( entry.ti.HeightToCreate*scale < entry.pEnhancedTexture->m_dwCreatedTextureHeight )
1954
1953
        {
1955
1954
            // Clamp
1956
1955
            gTextureManager.Clamp(info.lpSurface, height, entry.pEnhancedTexture->m_dwCreatedTextureHeight, entry.pEnhancedTexture->m_dwCreatedTextureWidth, height, T_FLAG, 4 );