Changeset 10497 for trunk/src/gdi32/blit.cpp
- Timestamp:
- Mar 9, 2004, 3:24:34 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/blit.cpp
r10495 r10497 1 /* $Id: blit.cpp,v 1.4 8 2004-03-09 10:03:21sandervl Exp $ */1 /* $Id: blit.cpp,v 1.49 2004-03-09 14:24:34 sandervl Exp $ */ 2 2 3 3 /* … … 276 276 if (!cx || !cy) goto invalid_parameter; 277 277 278 //testestset279 if(xSrc != 0 || ySrc != 0)280 {281 dprintf(("xSrc %d ySrc %d bpp %d", xSrc, ySrc, info->bmiHeader.biBitCount));282 // return lines;283 }284 //testestest285 286 278 // check if new bitmap must be created 287 279 if (xSrc == 0 && ySrc == 0 && startscan == 0 && lines == height && … … 296 288 info->bmiHeader.biCompression == BI_BITFIELDS) 297 289 { 290 // not zero if bpp < 8 and starting on an uneven pixel 291 UINT xOffset = (xSrc * info->bmiHeader.biBitCount) % 8; 292 298 293 // compute size of memory buffer 299 294 UINT lBytesPerLineOrig = DIB_GetDIBWidthBytes (info->bmiHeader.biWidth, info->bmiHeader.biBitCount); 300 UINT lBytesToCopyInLine = DIB_GetDIBWidthBytes (cx , info->bmiHeader.biBitCount);295 UINT lBytesToCopyInLine = DIB_GetDIBWidthBytes (cx + xOffset, info->bmiHeader.biBitCount); 301 296 302 297 newBits = (char *)malloc (lBytesToCopyInLine * cy); … … 306 301 // copy bits to new buffer 307 302 int i; 308 // starting pointer 309 char *pBits = (char *)bits + // origin 310 (ySrc - startscan) * lBytesPerLineOrig + // y offset 311 (xSrc * info->bmiHeader.biBitCount) / 8; // x offset 312 303 304 char *pNewBits = (char *)newBits; 305 313 306 if (info->bmiHeader.biHeight > 0) 314 307 { 315 char *pNewBits = (char *)newBits; 316 308 // starting pointer 309 char *pBits = (char *)bits + // origin 310 (ySrc - startscan) * lBytesPerLineOrig + // y offset 311 (xSrc * info->bmiHeader.biBitCount) / 8; // x offset 312 317 313 for (i = 0; i < cy; i++) 318 314 { … … 324 320 else 325 321 { 326 char *pNewBits = (char *)newBits + (cy - 1) * lBytesToCopyInLine; 327 322 // starting pointer 323 char *pBits = (char *)bits + // origin 324 (lines - 1 - (ySrc - startscan)) * lBytesPerLineOrig + // y offset 325 (xSrc * info->bmiHeader.biBitCount) / 8; // x offset 326 328 327 for (i = 0; i < cy; i++) 329 328 { 330 329 memcpy (pNewBits, pBits, lBytesToCopyInLine); 331 pBits += lBytesPerLineOrig;332 pNewBits -= lBytesToCopyInLine;330 pBits -= lBytesPerLineOrig; 331 pNewBits += lBytesToCopyInLine; 333 332 } 334 333 } … … 336 335 // newBits contain partial bitmap, correct the header 337 336 // todo bitcount < 8 338 ((BITMAPINFO *)info)->bmiHeader.biWidth = cx;337 ((BITMAPINFO *)info)->bmiHeader.biWidth = cx + xOffset; 339 338 ((BITMAPINFO *)info)->bmiHeader.biHeight = cy; 340 339 ((BITMAPINFO *)info)->bmiHeader.biSizeImage = lBytesToCopyInLine * cy; 341 340 342 xSrc = (xSrc * info->bmiHeader.biBitCount) % 8;343 341 ySrc = startscan = 0; 342 xSrc = xOffset; 344 343 lines = cy; 345 dprintf(("Converted BITMAP: (%d,%d) %d bytes ",346 info->bmiHeader.biWidth, info->bmiHeader.biHeight, info->bmiHeader.biSizeImage ));344 dprintf(("Converted BITMAP: (%d,%d) %d bytes xSrc %d ySrc %d", 345 info->bmiHeader.biWidth, info->bmiHeader.biHeight, info->bmiHeader.biSizeImage, xSrc, ySrc)); 347 346 } 348 347 }
Note:
See TracChangeset
for help on using the changeset viewer.