Ticket #4828: quaramonte-valgrind-debug.patch
File quaramonte-valgrind-debug.patch, 4.1 KB (added by , 14 years ago) |
---|
-
render.cpp
112 112 } 113 113 114 114 void Screen::scaleImageGood(byte *dst, uint16 dstPitch, uint16 dstWidth, uint16 dstHeight, byte *src, uint16 srcPitch, uint16 srcWidth, uint16 srcHeight, byte *backbuf) { 115 bool debug = false; 116 117 if (dstPitch == 39 && dstWidth == 39 && dstHeight == 173 && srcPitch == 33 && srcWidth == 33 && srcHeight == 145) { 118 printf("Screen::scaleImageGood() Debug Triggered\r\n"); 119 fflush(stdout); 120 printf("Screen::scaleImageGood(dstPitch = %d, dstWidth = %d, dstHeight = %d, srcPitch = %d, srcWidth = %d, srcHeight = %d)\r\n", dstPitch, dstWidth, dstHeight, srcPitch, srcWidth, srcHeight); 121 fflush(stdout); 122 debug = true; 123 } 124 115 125 for (int y = 0; y < dstHeight; y++) { 116 126 for (int x = 0; x < dstWidth; x++) { 117 127 uint8 c1, c2, c3, c4; … … 124 134 byte *srcPtr = src + yPos * srcPitch + xPos; 125 135 byte *backPtr = backbuf + y * _screenWide + x; 126 136 137 if (debug && x == 0 && y == 161) { 138 printf("x: %d y: %d\r\n", x, y); 139 fflush(stdout); 140 printf("xPos: %lu yPos: %lu\r\n", xPos, yPos); 141 fflush(stdout); 142 printf("xFrac: %lu yFrac: %lu\r\n", xFrac, yFrac); 143 fflush(stdout); 144 printf("_screenWide: %lu\r\n", _screenWide); 145 fflush(stdout); 146 } 147 127 148 bool transparent = true; 128 149 129 150 if (*srcPtr) { 130 151 c1 = *srcPtr; 131 152 transparent = false; 132 } else 153 if (debug && x == 0 && y == 161) { 154 printf("pixel c1: %d\r\n", c1); 155 fflush(stdout); 156 } 157 } else { 133 158 c1 = *backPtr; 159 if (debug && x == 0 && y == 161) { 160 printf("back c1: %d\r\n", c1); 161 fflush(stdout); 162 } 163 } 134 164 135 165 if (x < dstWidth - 1) { 136 166 if (*(srcPtr + 1)) { 137 167 c2 = *(srcPtr + 1); 138 168 transparent = false; 139 } else 169 if (debug && x == 0 && y == 161) { 170 printf("pixel c2: %d\r\n", c2); 171 fflush(stdout); 172 } 173 } else { 140 174 c2 = *(backPtr + 1); 175 if (debug && x == 0 && y == 161) { 176 printf("back c2: %d\r\n", c2); 177 fflush(stdout); 178 } 179 } 141 180 } else 142 181 c2 = c1; 143 182 … … 145 184 if (*(srcPtr + srcPitch)) { 146 185 c3 = *(srcPtr + srcPitch); 147 186 transparent = false; 148 } else 187 if (debug && x == 0 && y == 161) { 188 printf("pixel c3: %d\r\n", c3); 189 fflush(stdout); 190 } 191 } else { 149 192 c3 = *(backPtr + _screenWide); 193 if (debug && x == 0 && y == 161) { 194 printf("back c3: %d\r\n", c3); 195 fflush(stdout); 196 } 197 } 150 198 } else 151 199 c3 = c1; 152 200 … … 154 202 if (*(srcPtr + srcPitch + 1)) { 155 203 c4 = *(srcPtr + srcPitch + 1); 156 204 transparent = false; 157 } else 205 if (debug && x == 0 && y == 161) { 206 printf("pixel c4: %d\r\n", c4); 207 fflush(stdout); 208 } 209 } else { 158 210 c4 = *(backPtr + _screenWide + 1); 211 if (debug && x == 0 && y == 161) { 212 printf("back c4: %d\r\n", c4); 213 fflush(stdout); 214 } 215 } 159 216 } else 160 217 c4 = c3; 161 218 219 if (debug && x == 0 && y == 161) { 220 printf("c1: %d c2: %d\r\n", c1, c2); 221 fflush(stdout); 222 printf("c3: %d c4: %d\r\n", c3, c4); 223 fflush(stdout); 224 uint32 tempDebug = _palette[c3 * 4 + 0]; 225 printf("_palette[c3 * 4 + 0] : %lu\r\n", tempDebug); 226 fflush(stdout); 227 } 228 162 229 if (!transparent) { 163 230 uint32 r1 = _palette[c1 * 4 + 0]; 164 231 uint32 g1 = _palette[c1 * 4 + 1]; -
sprite.cpp
700 700 701 701 // We cannot use good scaling for PSX version, as we are missing 702 702 // some required data. 703 if (_renderCaps & RDBLTFX_EDGEBLEND && !Sword2Engine::isPsx()) 703 if (_renderCaps & RDBLTFX_EDGEBLEND && !Sword2Engine::isPsx()) { 704 printf("sprite backbuf => rd.top: %d rd.left: %d\r\n", rd.top, rd.left); 705 fflush(stdout); 704 706 scaleImageGood(newSprite, s->scaledWidth, s->scaledWidth, s->scaledHeight, sprite, s->w, s->w, s->h, _buffer + _screenWide * rd.top + rd.left); 705 else707 } else 706 708 scaleImageFast(newSprite, s->scaledWidth, s->scaledWidth, s->scaledHeight, sprite, s->w, s->w, s->h); 707 709 708 710 if (freeSprite)