2 * DIB Engine DIBDRVBITMAP handling
4 * Copyright 2009 Massimo Del Fedele
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/port.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(dibdrv
);
28 /* gets human-readable dib format name */
29 const char *_DIBDRVBITMAP_GetFormatName(DIBDRVBITMAP
const *bmp
)
34 return "NULL BITMAP DETECTED";
43 return "DIBFMT_DIB4_RLE";
47 return "DIBFMT_DIB8_RLE";
48 case DIBFMT_DIB16_RGB
:
49 return "DIBFMT_DIB_RGB";
50 case DIBFMT_DIB16_BITFIELDS
:
51 return "DIBFMT_DIB16_BITFIELDS";
53 return "DIBFMT_DIB24";
54 case DIBFMT_DIB32_RGB
:
55 return "DIBFMT_DIB32_RGB";
56 case DIBFMT_DIB32_BITFIELDS
:
57 return "DIBFMT_DIB32_BITFIELDS";
60 return "DIBFMT_UNKNOWN";
64 /* calculates shift and length given a bit mask */
65 static void CalcShiftAndLen(DWORD mask
, int *shift
, int *len
)
72 FIXME("color mask == 0 -- problem on init_dib\n");
78 /* calculates bit shift
79 (number of 0's on right of bit field */
81 while ((mask
& 1) == 0)
87 /* calculates bitfield length
88 (number of 1's in bit field */
90 while ((mask
& 1) == 1)
99 /* initializes bit fields from bit masks */
100 static void InitBitFields(DIBDRVBITMAP
*dib
, const DWORD
*bit_fields
)
102 dib
->redMask
= bit_fields
[0];
103 dib
->greenMask
= bit_fields
[1];
104 dib
->blueMask
= bit_fields
[2];
105 CalcShiftAndLen(dib
->redMask
, &dib
->redShift
, &dib
->redLen
);
106 CalcShiftAndLen(dib
->greenMask
, &dib
->greenShift
, &dib
->greenLen
);
107 CalcShiftAndLen(dib
->blueMask
, &dib
->blueShift
, &dib
->blueLen
);
110 /* sets/gets bits of a DIBDRVBITMAP taking in account if it's a top down
111 or a bottom-up DIB */
112 void _DIBDRVBITMAP_Set_Bits(DIBDRVBITMAP
*dib
, void *bits
, BOOL owns
)
114 /* checks whether dib is top-down or bottom-up one */
123 /* data->bits always points to the top-left corner and the stride is -ve */
124 dib
->bits
= (BYTE
*)bits
- (dib
->height
- 1) * dib
->stride
;
126 dib
->ownsBits
= owns
;
129 void *_DIBDRVBITMAP_Get_Bits(DIBDRVBITMAP
* dib
)
131 /* checks whether dib is top-down or bottom-up one */
140 /* data->bits always points to the top-left corner and the stride is -ve */
141 return (BYTE
*)dib
->bits
+ (dib
->height
- 1) * dib
->stride
;
145 /* initializes dib from a bitmap :
146 dib dib being initialized
147 bi source BITMAPINFOHEADER with required DIB format info
148 bit_fields color masks
149 colorTable color table, if any
150 bits pointer to image data array
151 NOTE : DIBDRVBITMAP doesn't owns bits, but do own color table
153 BOOL
_DIBDRVBITMAP_InitFromBMIH(DIBDRVBITMAP
*dib
, const BITMAPINFOHEADER
*bi
, const DWORD
*bit_fields
,
154 const RGBQUAD
*colorTable
, void *bits
)
156 MAYBE(TRACE("dib=%p, bi=%p, bit_fields=%p, colorTable=%p, bits=%p\n", dib
, bi
, bit_fields
, colorTable
, bits
));
158 /* initializes DIB dimensions and color depth */
159 dib
->bitCount
= bi
->biBitCount
;
160 dib
->width
= bi
->biWidth
;
161 dib
->height
= bi
->biHeight
;
162 dib
->stride
= ((dib
->width
* dib
->bitCount
+ 31) >> 3) & ~3;
164 /* initializes image data pointer */
166 dib
->ownsBits
= FALSE
;
168 /* initializes color table */
169 dib
->colorTableSize
= 0;
170 dib
->colorTable
= NULL
;
171 dib
->colorTableGrabbed
= FALSE
;
173 /* checks whether dib is top-down or bottom-up one */
177 dib
->height
= -dib
->height
;
182 /* data->bits always points to the top-left corner and the stride is -ve */
183 dib
->bits
= (BYTE
*)dib
->bits
+ (dib
->height
- 1) * dib
->stride
;
184 dib
->stride
= -dib
->stride
;
187 /* gets and stores bitmap format */
188 switch(dib
->bitCount
)
191 dib
->format
= DIBFMT_DIB24
;
192 dib
->funcs
= &DIBDRV_funcs_DIB24
;
197 if(bi
->biCompression
== BI_RGB
)
199 dib
->format
= DIBFMT_DIB32_RGB
;
200 dib
->funcs
= &DIBDRV_funcs_DIB32_RGB
;
204 InitBitFields(dib
, bit_fields
);
205 dib
->format
= DIBFMT_DIB32_BITFIELDS
;
206 dib
->funcs
= &DIBDRV_funcs_DIB32_BITFIELDS
;
211 if(bi
->biCompression
== BI_RGB
)
213 dib
->format
= DIBFMT_DIB16_RGB
;
214 dib
->funcs
= &DIBDRV_funcs_DIB16_RGB
;
218 InitBitFields(dib
, bit_fields
);
219 dib
->format
= DIBFMT_DIB16_BITFIELDS
;
220 dib
->funcs
= &DIBDRV_funcs_DIB16_BITFIELDS
;
225 dib
->format
= DIBFMT_DIB8
;
226 dib
->funcs
= &DIBDRV_funcs_DIB8
;
227 dib
->colorTableSize
= 256;
228 if(bi
->biClrUsed
) dib
->colorTableSize
= bi
->biClrUsed
;
232 dib
->format
= DIBFMT_DIB4
;
233 dib
->funcs
= &DIBDRV_funcs_DIB4
;
234 dib
->colorTableSize
= 16;
235 if(bi
->biClrUsed
) dib
->colorTableSize
= bi
->biClrUsed
;
239 dib
->format
= DIBFMT_DIB1
;
240 dib
->funcs
= &DIBDRV_funcs_DIB1
;
241 dib
->colorTableSize
= 2;
242 if(bi
->biClrUsed
) dib
->colorTableSize
= bi
->biClrUsed
;
246 dib
->format
= DIBFMT_UNKNOWN
;
248 FIXME("bpp %d not supported\n", dib
->bitCount
);
251 MAYBE(TRACE("DIB FORMAT : %s\n", _DIBDRVBITMAP_GetFormatName(dib
)));
253 /* allocates color table and copy it from source, *if* source is
255 if(dib
->colorTableSize
&& colorTable
)
257 if(!(dib
->colorTable
= HeapAlloc(GetProcessHeap(), 0,
258 dib
->colorTableSize
* sizeof(dib
->colorTable
[0]))
261 ERR("HeapAlloc failed\n");
264 memcpy(dib
->colorTable
, colorTable
,
265 dib
->colorTableSize
* sizeof(dib
->colorTable
[0]));
266 dib
->colorTableGrabbed
= TRUE
;
268 else if(!dib
->colorTableSize
)
269 /* no color table on more than 8 bits/pixel */
270 dib
->colorTableGrabbed
= TRUE
;
272 MAYBE(TRACE("END\n"));
276 BOOL
_DIBDRVBITMAP_InitFromBitmapinfo(DIBDRVBITMAP
*dib
, const BITMAPINFO
*bmi
)
278 static const DWORD bit_fields_DIB32_RGB
[3] = {0xff0000, 0x00ff00, 0x0000ff};
279 static const DWORD bit_fields_DIB16_RGB
[3] = {0x7c00, 0x03e0, 0x001f};
280 BITMAPINFOHEADER
*bi
= (BITMAPINFOHEADER
*)bmi
;
281 const DWORD
*masks
= NULL
;
282 RGBQUAD
*colorTable
= NULL
;
283 BYTE
*ptr
= (BYTE
*)bmi
+ bi
->biSize
;
284 int num_colors
= bi
->biClrUsed
;
287 MAYBE(TRACE("dib=%p, bmi=%p\n", dib
, bmi
));
289 if(bi
->biCompression
== BI_BITFIELDS
)
291 masks
= (DWORD
*)ptr
;
292 ptr
+= 3 * sizeof(DWORD
);
294 else if(bi
->biBitCount
== 32)
295 masks
= bit_fields_DIB32_RGB
;
296 else if(bi
->biBitCount
== 16)
297 masks
= bit_fields_DIB16_RGB
;
299 if(!num_colors
&& bi
->biBitCount
<= 8)
300 num_colors
= 1 << bi
->biBitCount
;
302 colorTable
= (RGBQUAD
*)ptr
;
303 ptr
+= num_colors
* sizeof(*colorTable
);
305 res
= _DIBDRVBITMAP_InitFromBMIH(dib
, bi
, masks
, colorTable
, ptr
);
306 MAYBE(TRACE("END\n"));
310 /* initializes a DIBRDVBITMAP copying it from a source one
312 dib destination DIBDRVBITMAP
313 src source DIBDRVBITMAP
314 copy TRUE->copy source pixel array FALSE->link to source pixel array
316 BOOL
_DIBDRVBITMAP_InitFromDibdrvbitmap(DIBDRVBITMAP
*dib
, const DIBDRVBITMAP
*src
, BOOL copy
)
318 MAYBE(TRACE("dib=%p, src=%p, copy=%d\n", dib
, src
, copy
));
320 dib
->format
= src
->format
;
321 dib
->width
= src
->width
;
322 dib
->height
= src
->height
;
323 dib
->stride
= src
->stride
;
324 dib
->bitCount
= src
->bitCount
;
326 dib
->redMask
= src
->redMask
;
327 dib
->greenMask
= src
->greenMask
;
328 dib
->blueMask
= src
->blueMask
;
329 dib
->redShift
= src
->redShift
;
330 dib
->greenShift
= src
->greenShift
;
331 dib
->blueShift
= src
->blueShift
;
332 dib
->redLen
= src
->redLen
;
333 dib
->greenLen
= src
->greenLen
;
334 dib
->blueLen
= src
->blueLen
;
336 dib
->funcs
= src
->funcs
;
340 int size
= dib
->height
*abs(dib
->stride
);
341 if(!(dib
->bits
= HeapAlloc(GetProcessHeap(), 0, size
)))
343 ERR("Failed to allocate bits buffer\n");
346 dib
->ownsBits
= TRUE
;
348 /* check for bottom-up DIB */
351 /* copy the bitmap array */
352 memcpy(dib
->bits
, (BYTE
*)src
->bits
+ (src
->height
- 1) * src
->stride
, size
);
354 dib
->bits
= (BYTE
*)dib
->bits
- (dib
->height
-1) * dib
->stride
;
358 /* copy the bitmap array */
359 memcpy(dib
->bits
, src
->bits
, size
);
364 dib
->bits
= src
->bits
;
365 dib
->ownsBits
= FALSE
;
370 dib
->colorTable
= HeapAlloc(GetProcessHeap(), 0, src
->colorTableSize
* sizeof(src
->colorTable
[0]));
371 memcpy(dib
->colorTable
, src
->colorTable
, src
->colorTableSize
* sizeof(src
->colorTable
[0]));
374 dib
->colorTable
= NULL
;
375 dib
->colorTableSize
= src
->colorTableSize
;
376 dib
->colorTableGrabbed
= TRUE
;
377 MAYBE(TRACE("END\n"));
381 /* initializes a DIBRDVBITMAP from a DIB HBITMAP
383 bmp destination DIBDRVBITMAP
385 copyPixels TRUE->copy source pixel array FALSE->link to source pixel array */
386 BOOL
_DIBDRVBITMAP_InitFromHBITMAP(DIBDRVBITMAP
*bmp
, const HBITMAP hbmp
, BOOL copyPixels
)
388 BITMAPINFO
*destInfo
;
392 MAYBE(TRACE("bmp=%p, hbmp=%p, copyPixels = %s\n", bmp
, hbmp
, copyPixels
? "TRUE" : "FALSE"));
394 /* be sure bitmap is empty */
395 _DIBDRVBITMAP_Clear(bmp
);
397 /* gets source bitmap data */
398 if(!(size
= GetObjectW(hbmp
, sizeof(DIBSECTION
), &ds
)))
400 ERR("Failed getting bitmap object\n");
403 if(size
!= sizeof(DIBSECTION
))
405 ERR("Bitmap is not a DIB section\n");
409 destInfo
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(BITMAPINFOHEADER
) + 256 * sizeof(RGBQUAD
));
412 ERR("HeapAlloc failed\n");
416 memcpy(destInfo
, &ds
.dsBmih
, sizeof(BITMAPINFOHEADER
));
417 if(ds
.dsBmih
.biCompression
== BI_BITFIELDS
)
418 memcpy((BITMAPINFOHEADER
*)destInfo
+ 1, ds
.dsBitfields
, 3 * sizeof(RGBQUAD
));
419 else if(ds
.dsBmih
.biBitCount
<= 8)
421 FIXME("Can't grab color table here.... syslvel lock\n");
424 HDC refDC
= CreateCompatibleDC(0);
427 ERR("CreateCompatibleDC() failed\n");
430 if(!GetDIBits(refDC
, hbmp
, 0, 1, NULL
, destInfo
, DIB_RGB_COLORS
))
433 HeapFree(GetProcessHeap(), 0, destInfo
);
434 ERR("GetDIBits failed\n");
440 if(!_DIBDRVBITMAP_InitFromBitmapinfo(bmp
, destInfo
))
442 HeapFree(GetProcessHeap(), 0, destInfo
);
443 ERR("_DIBDRVBITMAP_InitFromBitmapinfo failed\n");
446 HeapFree(GetProcessHeap(), 0, destInfo
);
449 size
= abs(bmp
->stride
) * bmp
->height
;
450 if(!(bmp
->bits
= HeapAlloc(GetProcessHeap(), 0, size
)))
452 ERR("HeapAlloc failed\n");
453 _DIBDRVBITMAP_Free(bmp
);
456 memcpy(bmp
->bits
, ds
.dsBm
.bmBits
, size
);
457 bmp
->ownsBits
= TRUE
;
460 bmp
->bits
= ds
.dsBm
.bmBits
;
462 bmp
->bits
= (BYTE
*)bmp
->bits
- (bmp
->height
- 1) * bmp
->stride
;
468 /* creates a DIBRDVBITMAP copying format info from a source one
470 dib destination DIBDRVBITMAP
471 src source DIBDRVBITMAP
472 widht, height sizes of newly created bitmap
474 BOOL
_DIBDRVBITMAP_CreateFromDibdrvbitmap(DIBDRVBITMAP
*dib
, const DIBDRVBITMAP
*src
, int width
, int height
)
476 MAYBE(TRACE("dib=%p, src=%p, width=%d, height=%d\n", dib
, src
, width
, height
));
478 /* grab color and format info from source DIB */
479 if(!_DIBDRVBITMAP_InitFromDibdrvbitmap(dib
, src
, FALSE
))
481 ERR("Failed grabbing source dib format\n");
485 /* sets up new DIB dimensions */
487 dib
->height
= height
;
489 /* calculates new stride basing of new width */
490 dib
->stride
= ((width
* dib
->bitCount
+31) &~31) / 8;
492 dib
->stride
= -dib
->stride
;
494 /* allocates bits for newly created DIB */
495 if(!(dib
->bits
= HeapAlloc(GetProcessHeap(), 0, height
*abs(dib
->stride
))))
497 ERR("Failed to allocate bits buffer\n");
500 /* check for bottom-up DIB */
502 dib
->bits
= (BYTE
*)dib
->bits
- (dib
->height
-1) * dib
->stride
;
503 dib
->ownsBits
= TRUE
;
505 MAYBE(TRACE("END\n"));
509 /* Clears a DIBDRVBITMAP structure data
510 WARNING : doesn't free anything */
511 void _DIBDRVBITMAP_Clear(DIBDRVBITMAP
*bmp
)
513 MAYBE(TRACE("bmp=%p\n", bmp
));
516 bmp
->ownsBits
= FALSE
;
517 bmp
->colorTable
= NULL
;
518 bmp
->colorTableSize
= 0;
519 bmp
->colorTableGrabbed
= FALSE
;
521 MAYBE(TRACE("END\n"));
524 /* Frees a DIBDRVBITMAP structure data */
525 void _DIBDRVBITMAP_Free(DIBDRVBITMAP
*bmp
)
527 MAYBE(TRACE("bmp=%p\n", bmp
));
529 /* frees bits, if needed */
530 if(bmp
->bits
&& bmp
->ownsBits
)
532 /* on bottom-up dibs, bits doesn't point to starting
533 of buffer.... bad design choice */
535 bmp
->bits
= (BYTE
*)bmp
->bits
+ bmp
->stride
* (bmp
->height
-1);
536 HeapFree(GetProcessHeap(), 0, bmp
->bits
);
538 bmp
->ownsBits
= FALSE
;
541 /* frees color table */
543 HeapFree(GetProcessHeap(), 0, bmp
->colorTable
);
544 bmp
->colorTable
= NULL
;
545 bmp
->colorTableSize
= 0;
546 bmp
->colorTableGrabbed
= FALSE
;
548 MAYBE(TRACE("END\n"));
552 /* checks whether the format of 2 DIBs are identical
553 it checks the pixel bit count and the color table size
554 and content, if needed */
555 BOOL
_DIBDRVBITMAP_FormatMatch(const DIBDRVBITMAP
*d1
, const DIBDRVBITMAP
*d2
)
557 /* checks at first the format (bit count and color masks) */
558 if(d1
->format
!= d2
->format
)
561 /* formats matches, now checks color tables if needed */
564 case DIBFMT_DIB32_RGB
:
565 case DIBFMT_DIB32_BITFIELDS
:
567 case DIBFMT_DIB16_RGB
:
568 case DIBFMT_DIB16_BITFIELDS
:
573 /*case DIBFMT_DIB4_RLE :*/
575 /*case DIBFMT_DIB8_RLE :*/
576 if(d1
->colorTableSize
!= d2
->colorTableSize
)
578 return !memcmp(d1
->colorTable
, d2
->colorTable
, d1
->colorTableSize
* sizeof(d1
->colorTable
[0]));
581 ERR("Unexpected depth %d\n", d1
->bitCount
);
586 /* convert a given dib into another format given by 'format' parameter */
587 BOOL
_DIBDRVBITMAP_Convert(DIBDRVBITMAP
*dst
, const DIBDRVBITMAP
*src
, const DIBDRVBITMAP
*format
)
594 MAYBE(TRACE("dst=%p, src=%p, format=%p\n", dst
, src
, format
));
596 /* free, if needed, destination bitmap */
597 _DIBDRVBITMAP_Free(dst
);
599 /* if format and source bitmaps format match,
600 just copy source on destination */
601 if(_DIBDRVBITMAP_FormatMatch(src
, format
))
603 res
= _DIBDRVBITMAP_InitFromDibdrvbitmap(dst
, src
, TRUE
);
604 MAYBE(TRACE("END - Identical formats\n"));
608 /* formats don't match, we create the dest bitmap with same format as format's one
609 but with source's one dimensions */
611 height
= src
->height
;
612 if(!_DIBDRVBITMAP_CreateFromDibdrvbitmap(dst
, format
, width
, height
))
614 ERR("Couldn't create destination bmp\n");
618 /* we now copy/convert from source to dest */
619 if(!(buf
= HeapAlloc(GetProcessHeap(), 0, width
* 4)))
621 ERR("HeapAlloc failed\n");
625 for(iLine
= 0; iLine
< height
; iLine
++)
627 src
->funcs
->GetLine(src
, iLine
, 0, width
, buf
);
628 dst
->funcs
->PutLine(dst
, iLine
, 0, width
, buf
);
630 HeapFree(GetProcessHeap(), 0, buf
);
632 MAYBE(TRACE("END - different formats\n"));
636 /* creates a solid-filled DIB of given color and format
637 DIB format is given by 'format' parameter */
638 BOOL
_DIBDRVBITMAP_CreateSolid(DIBDRVBITMAP
*bmp
, DIBDRVBITMAP
*format
, int width
, int height
, DWORD Color
)
643 MAYBE(TRACE("bmp=%p, format=%p, width=%d, height=%d, Color=%08x\n", bmp
, format
, width
, height
, Color
));
645 /* swaps color bytes....*/
646 Color
= RGB((Color
>> 8) & 0xff, (Color
>> 16) &0xff, Color
&0xff);
648 /* creates the destination bitmap */
649 if(!_DIBDRVBITMAP_CreateFromDibdrvbitmap(bmp
, format
, width
, height
))
651 ERR("Couldn't create destination bmp\n");
655 /* creates a temporary line filled with given color */
656 if(!(buf
= HeapAlloc(GetProcessHeap(), 0, width
* 4)))
658 ERR("HeapAlloc failed\n");
662 for(i
= 0, bufPnt
= buf
; i
< width
; i
++)
665 /* fills the bitmap */
666 for(i
= 0; i
< height
; i
++)
667 bmp
->funcs
->PutLine(bmp
, i
, 0, width
, buf
);
669 /* frees temporaty line */
670 HeapFree(GetProcessHeap(), 0, buf
);
672 MAYBE(TRACE("END\n"));
676 /* expands horizontally a bitmap to reach a minimum size,
677 keeping its width as a multiple of a base width
678 Used to widen brushes in order to optimize blitting */
679 BOOL
_DIBDRVBITMAP_ExpandHoriz(DIBDRVBITMAP
*dib
, int baseWidth
, int minWidth
)
681 BYTE
*srcBuf
, *dstBuf
;
688 MAYBE(TRACE("dib=%p, baseWidth=%d, minWidth=%d\n", dib
, baseWidth
, minWidth
));
690 /* if dst dib already wide enough, just do nothing */
691 if(dib
->width
>= minWidth
)
693 MAYBE(TRACE("END - No need to expand\n"));
697 /* source DIB can't be NULL */
700 ERR("Empty source DIB detected\n");
704 /* round up minWidth to be a multiple of source width */
705 minWidth
+= (baseWidth
- (minWidth
% baseWidth
));
707 /* creates a temporary destination bitmap with required sizes */
708 _DIBDRVBITMAP_Clear(&tmpDib
);
709 if(!_DIBDRVBITMAP_CreateFromDibdrvbitmap(&tmpDib
, dib
, minWidth
, dib
->height
))
711 ERR("Couldn't create the temporary DIB for brush cache\n");
715 /* if format uses almost 1 byte/pixel, fast copy path */
716 if(dib
->bitCount
>= 8)
718 chunkSize
= dib
->width
* dib
->bitCount
/ 8;
719 for(iLine
= 0; iLine
< dib
->height
; iLine
++)
721 srcBuf
= (BYTE
*)dib
->bits
+ iLine
* dib
->stride
;
722 dstBuf
= (BYTE
*)tmpDib
.bits
+ iLine
* tmpDib
.stride
;
723 for(iCol
= 0; iCol
< tmpDib
.width
; iCol
+= dib
->width
)
725 memcpy(dstBuf
, srcBuf
, chunkSize
);
730 /* otherwise slow path -- could be optimized */
733 chunkSize
= dib
->width
* 4;
734 /* allocates a line buffer */
735 if(!(srcBuf
= HeapAlloc(GetProcessHeap(), 0, tmpDib
.width
* 4)))
737 ERR("HeapAlloc failed\n");
741 FIXME("dib:format=%s, funcs=%p, bits=%p, width=%d, height=%d, stride=%d\n",
742 _DIBDRVBITMAP_GetFormatName(dib
), dib
->funcs
, dib
->bits
, dib
->width
, dib
->height
, dib
->stride
);
743 for(iLine
= 0; iLine
< dib
->height
; iLine
++)
745 /* fills the line buffer repeating source's line data */
746 dib
->funcs
->GetLine(dib
, iLine
, 0, dib
->width
, srcBuf
);
747 dstBuf
= srcBuf
+ chunkSize
;
748 for(iCol
= dib
->width
; iCol
< tmpDib
.width
; iCol
+= dib
->width
)
750 memcpy(dstBuf
, srcBuf
, chunkSize
);
753 /* stores the line on destination bmp */
754 tmpDib
.funcs
->PutLine(&tmpDib
, iLine
, 0, tmpDib
.width
, srcBuf
);
756 HeapFree(GetProcessHeap(), 0, srcBuf
);
759 /* swaps temp DIB and source one */
761 ownsBits
= dib
->ownsBits
;
762 dib
->bits
= tmpDib
.bits
;
763 dib
->ownsBits
= tmpDib
.ownsBits
;
765 tmpDib
.ownsBits
= ownsBits
;
767 /* frees the temporary DIB */
768 _DIBDRVBITMAP_Free(&tmpDib
);
770 MAYBE(TRACE("END\n"));