diff options
author | Fabio Battaglia | 2009-03-02 11:30:23 +0000 |
---|---|---|
committer | Fabio Battaglia | 2009-03-02 11:30:23 +0000 |
commit | ed65593bb3341df18eeb9c2794c88d89ba78390f (patch) | |
tree | 769edd4e7297d41ba1122c06a3b6d7b9740c2643 /engines/sword1 | |
parent | 023320215097f69d99a4c907c847ce867e8069a0 (diff) | |
download | scummvm-rg350-ed65593bb3341df18eeb9c2794c88d89ba78390f.tar.gz scummvm-rg350-ed65593bb3341df18eeb9c2794c88d89ba78390f.tar.bz2 scummvm-rg350-ed65593bb3341df18eeb9c2794c88d89ba78390f.zip |
Avoid using unnecessary buffers in psxBackgroundToIndexed
svn-id: r39072
Diffstat (limited to 'engines/sword1')
-rw-r--r-- | engines/sword1/screen.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp index 43657434eb..959baa1003 100644 --- a/engines/sword1/screen.cpp +++ b/engines/sword1/screen.cpp @@ -842,7 +842,7 @@ uint8* Screen::psxBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint uint32 tag = READ_LE_UINT32(psxBackground); uint8 *decomp_tile = (uint8 *)malloc(16 * 16); //Tiles are always 16 * 16 - uint8 *halfres_buffer = (uint8 *)malloc(totTiles * 16 * 16); //This buffer will contain the half vertical res image + uint8 *fullres_buffer = (uint8 *)malloc(bakXres * yresInTiles * 32); bool isCompressed = (tag == 0x434F4D50); @@ -861,25 +861,15 @@ uint8* Screen::psxBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint tileXpos = 0; } - for (byte tileLine=0; tileLine<16; tileLine++) - memcpy(halfres_buffer + tileLine * bakXres + tileXpos * 16 + tileYpos * bakXres * 16, decomp_tile + tileLine * 16, 16); //Copy data to destination buffer - + for (byte tileLine=0; tileLine<16; tileLine++) { // Copy data to destination buffer + memcpy(fullres_buffer + tileLine * bakXres * 2 + tileXpos * 16 + tileYpos * bakXres * 16 * 2, decomp_tile + tileLine * 16, 16); + memcpy(fullres_buffer + tileLine * bakXres * 2 + bakXres + tileXpos * 16 + tileYpos * bakXres * 16 * 2, decomp_tile + tileLine * 16, 16); + } tileXpos++; } free(decomp_tile); - uint8 *fullres_buffer = (uint8 *)malloc(bakXres * yresInTiles * 32); - memset(fullres_buffer, 0x00, bakXres * yresInTiles * 32); - - //Let's linedouble the image (to keep correct aspect ratio) - for (uint32 currentLine = 0; currentLine < (bakYres/2); currentLine++) { - memcpy(fullres_buffer + currentLine * bakXres * 2, halfres_buffer + currentLine * bakXres, bakXres); // destination_line is 2*original_line - memcpy(fullres_buffer + currentLine * bakXres * 2 + bakXres, halfres_buffer + currentLine * bakXres, bakXres); // destination_line+1 - } - - free(halfres_buffer); - return fullres_buffer; } |