xref: /freebsd/lib/libvgl/bitmap.c (revision 71819202385f9090dacddce16cbaa35abf10baf8)
19a57b7d2SSøren Schmidt /*-
25e53a4f9SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
35e53a4f9SPedro F. Giffuni  *
4bf3f9db6SUlrich Spörlein  * Copyright (c) 1991-1997 Søren Schmidt
59a57b7d2SSøren Schmidt  * All rights reserved.
69a57b7d2SSøren Schmidt  *
79a57b7d2SSøren Schmidt  * Redistribution and use in source and binary forms, with or without
89a57b7d2SSøren Schmidt  * modification, are permitted provided that the following conditions
99a57b7d2SSøren Schmidt  * are met:
109a57b7d2SSøren Schmidt  * 1. Redistributions of source code must retain the above copyright
119a57b7d2SSøren Schmidt  *    notice, this list of conditions and the following disclaimer,
129a57b7d2SSøren Schmidt  *    in this position and unchanged.
139a57b7d2SSøren Schmidt  * 2. Redistributions in binary form must reproduce the above copyright
149a57b7d2SSøren Schmidt  *    notice, this list of conditions and the following disclaimer in the
159a57b7d2SSøren Schmidt  *    documentation and/or other materials provided with the distribution.
169a57b7d2SSøren Schmidt  * 3. The name of the author may not be used to endorse or promote products
1721dc7d4fSJens Schweikhardt  *    derived from this software without specific prior written permission.
189a57b7d2SSøren Schmidt  *
199a57b7d2SSøren Schmidt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
209a57b7d2SSøren Schmidt  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
219a57b7d2SSøren Schmidt  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
229a57b7d2SSøren Schmidt  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
239a57b7d2SSøren Schmidt  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
249a57b7d2SSøren Schmidt  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
259a57b7d2SSøren Schmidt  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
269a57b7d2SSøren Schmidt  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
279a57b7d2SSøren Schmidt  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
289a57b7d2SSøren Schmidt  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
299a57b7d2SSøren Schmidt  */
309a57b7d2SSøren Schmidt 
31e67f5b9fSMatthew Dillon #include <sys/cdefs.h>
32e67f5b9fSMatthew Dillon __FBSDID("$FreeBSD$");
33e67f5b9fSMatthew Dillon 
349a57b7d2SSøren Schmidt #include <sys/types.h>
359a57b7d2SSøren Schmidt #include <signal.h>
3600d25f51SPoul-Henning Kamp #include <sys/fbio.h>
379a57b7d2SSøren Schmidt #include "vgl.h"
389a57b7d2SSøren Schmidt 
395acf51eaSKazutaka YOKOTA #define min(x, y)	(((x) < (y)) ? (x) : (y))
405acf51eaSKazutaka YOKOTA 
419a57b7d2SSøren Schmidt static byte mask[8] = {0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01};
429a57b7d2SSøren Schmidt static int color2bit[16] = {0x00000000, 0x00000001, 0x00000100, 0x00000101,
439a57b7d2SSøren Schmidt 			    0x00010000, 0x00010001, 0x00010100, 0x00010101,
449a57b7d2SSøren Schmidt 			    0x01000000, 0x01000001, 0x01000100, 0x01000101,
459a57b7d2SSøren Schmidt 			    0x01010000, 0x01010001, 0x01010100, 0x01010101};
469a57b7d2SSøren Schmidt 
479a57b7d2SSøren Schmidt static void
489a57b7d2SSøren Schmidt WriteVerticalLine(VGLBitmap *dst, int x, int y, int width, byte *line)
499a57b7d2SSøren Schmidt {
509a57b7d2SSøren Schmidt   int i, pos, last, planepos, start_offset, end_offset, offset;
515acf51eaSKazutaka YOKOTA   int len;
529a57b7d2SSøren Schmidt   unsigned int word = 0;
539a57b7d2SSøren Schmidt   byte *address;
545acf51eaSKazutaka YOKOTA   byte *VGLPlane[4];
559a57b7d2SSøren Schmidt 
569a57b7d2SSøren Schmidt   switch (dst->Type) {
579a57b7d2SSøren Schmidt   case VIDBUF4:
585acf51eaSKazutaka YOKOTA   case VIDBUF4S:
599a57b7d2SSøren Schmidt     start_offset = (x & 0x07);
609a57b7d2SSøren Schmidt     end_offset = (x + width) & 0x07;
615acf51eaSKazutaka YOKOTA     i = (width + start_offset) / 8;
625acf51eaSKazutaka YOKOTA     if (end_offset)
635acf51eaSKazutaka YOKOTA 	i++;
645acf51eaSKazutaka YOKOTA     VGLPlane[0] = VGLBuf;
655acf51eaSKazutaka YOKOTA     VGLPlane[1] = VGLPlane[0] + i;
665acf51eaSKazutaka YOKOTA     VGLPlane[2] = VGLPlane[1] + i;
675acf51eaSKazutaka YOKOTA     VGLPlane[3] = VGLPlane[2] + i;
689a57b7d2SSøren Schmidt     pos = 0;
699a57b7d2SSøren Schmidt     planepos = 0;
705acf51eaSKazutaka YOKOTA     last = 8 - start_offset;
719a57b7d2SSøren Schmidt     while (pos < width) {
729a57b7d2SSøren Schmidt       word = 0;
739a57b7d2SSøren Schmidt       while (pos < last && pos < width)
749a57b7d2SSøren Schmidt 	word = (word<<1) | color2bit[line[pos++]&0x0f];
759a57b7d2SSøren Schmidt       VGLPlane[0][planepos] = word;
769a57b7d2SSøren Schmidt       VGLPlane[1][planepos] = word>>8;
779a57b7d2SSøren Schmidt       VGLPlane[2][planepos] = word>>16;
789a57b7d2SSøren Schmidt       VGLPlane[3][planepos] = word>>24;
799a57b7d2SSøren Schmidt       planepos++;
805acf51eaSKazutaka YOKOTA       last += 8;
819a57b7d2SSøren Schmidt     }
829a57b7d2SSøren Schmidt     planepos--;
839a57b7d2SSøren Schmidt     if (end_offset) {
849a57b7d2SSøren Schmidt       word <<= (8 - end_offset);
859a57b7d2SSøren Schmidt       VGLPlane[0][planepos] = word;
869a57b7d2SSøren Schmidt       VGLPlane[1][planepos] = word>>8;
879a57b7d2SSøren Schmidt       VGLPlane[2][planepos] = word>>16;
889a57b7d2SSøren Schmidt       VGLPlane[3][planepos] = word>>24;
899a57b7d2SSøren Schmidt     }
909a57b7d2SSøren Schmidt     if (start_offset || end_offset)
919a57b7d2SSøren Schmidt       width+=8;
925acf51eaSKazutaka YOKOTA     width /= 8;
935acf51eaSKazutaka YOKOTA     outb(0x3ce, 0x01); outb(0x3cf, 0x00);		/* set/reset enable */
945acf51eaSKazutaka YOKOTA     outb(0x3ce, 0x08); outb(0x3cf, 0xff);		/* bit mask */
959a57b7d2SSøren Schmidt     for (i=0; i<4; i++) {
969a57b7d2SSøren Schmidt       outb(0x3c4, 0x02);
979a57b7d2SSøren Schmidt       outb(0x3c5, 0x01<<i);
989a57b7d2SSøren Schmidt       outb(0x3ce, 0x04);
999a57b7d2SSøren Schmidt       outb(0x3cf, i);
1005acf51eaSKazutaka YOKOTA       pos = VGLAdpInfo.va_line_width*y + x/8;
1015acf51eaSKazutaka YOKOTA       if (dst->Type == VIDBUF4) {
1029a57b7d2SSøren Schmidt 	if (end_offset)
1035acf51eaSKazutaka YOKOTA 	  VGLPlane[i][planepos] |= dst->Bitmap[pos+planepos] & mask[end_offset];
1045acf51eaSKazutaka YOKOTA 	if (start_offset)
1055acf51eaSKazutaka YOKOTA 	  VGLPlane[i][0] |= dst->Bitmap[pos] & ~mask[start_offset];
1065acf51eaSKazutaka YOKOTA 	bcopy(&VGLPlane[i][0], dst->Bitmap + pos, width);
1075acf51eaSKazutaka YOKOTA       } else {	/* VIDBUF4S */
1085acf51eaSKazutaka YOKOTA 	if (end_offset) {
1095acf51eaSKazutaka YOKOTA 	  offset = VGLSetSegment(pos + planepos);
1105acf51eaSKazutaka YOKOTA 	  VGLPlane[i][planepos] |= dst->Bitmap[offset] & mask[end_offset];
1115acf51eaSKazutaka YOKOTA 	}
1125acf51eaSKazutaka YOKOTA 	offset = VGLSetSegment(pos);
1135acf51eaSKazutaka YOKOTA 	if (start_offset)
1145acf51eaSKazutaka YOKOTA 	  VGLPlane[i][0] |= dst->Bitmap[offset] & ~mask[start_offset];
1155acf51eaSKazutaka YOKOTA 	for (last = width; ; ) {
1165acf51eaSKazutaka YOKOTA 	  len = min(VGLAdpInfo.va_window_size - offset, last);
1175acf51eaSKazutaka YOKOTA 	  bcopy(&VGLPlane[i][width - last], dst->Bitmap + offset, len);
1185acf51eaSKazutaka YOKOTA 	  pos += len;
1195acf51eaSKazutaka YOKOTA 	  last -= len;
1205acf51eaSKazutaka YOKOTA 	  if (last <= 0)
1215acf51eaSKazutaka YOKOTA 	    break;
1225acf51eaSKazutaka YOKOTA 	  offset = VGLSetSegment(pos);
1235acf51eaSKazutaka YOKOTA 	}
1245acf51eaSKazutaka YOKOTA       }
1259a57b7d2SSøren Schmidt     }
1269a57b7d2SSøren Schmidt     break;
1279a57b7d2SSøren Schmidt   case VIDBUF8X:
1285acf51eaSKazutaka YOKOTA     address = dst->Bitmap + VGLAdpInfo.va_line_width * y + x/4;
1299a57b7d2SSøren Schmidt     for (i=0; i<4; i++) {
1309a57b7d2SSøren Schmidt       outb(0x3c4, 0x02);
1315e7a62b2SKazutaka YOKOTA       outb(0x3c5, 0x01 << ((x + i)%4));
1325e7a62b2SKazutaka YOKOTA       for (planepos=0, pos=i; pos<width; planepos++, pos+=4)
1339a57b7d2SSøren Schmidt         address[planepos] = line[pos];
1345e7a62b2SKazutaka YOKOTA       if ((x + i)%4 == 3)
1355e7a62b2SKazutaka YOKOTA 	++address;
1369a57b7d2SSøren Schmidt     }
1379a57b7d2SSøren Schmidt     break;
1385acf51eaSKazutaka YOKOTA   case VIDBUF8S:
139933d455fSNicolas Souchu   case VIDBUF16S:
140933d455fSNicolas Souchu   case VIDBUF24S:
141933d455fSNicolas Souchu   case VIDBUF32S:
142933d455fSNicolas Souchu     width = width * dst->PixelBytes;
143933d455fSNicolas Souchu     pos = (dst->VXsize * y + x) * dst->PixelBytes;
144933d455fSNicolas Souchu     while (width > 0) {
145933d455fSNicolas Souchu       offset = VGLSetSegment(pos);
146933d455fSNicolas Souchu       i = min(VGLAdpInfo.va_window_size - offset, width);
147933d455fSNicolas Souchu       bcopy(line, dst->Bitmap + offset, i);
148933d455fSNicolas Souchu       line += i;
149933d455fSNicolas Souchu       pos += i;
150933d455fSNicolas Souchu       width -= i;
151933d455fSNicolas Souchu     }
152933d455fSNicolas Souchu     break;
1539a57b7d2SSøren Schmidt   case MEMBUF:
154b8e788b6SBruce Evans   case VIDBUF8:
155933d455fSNicolas Souchu   case VIDBUF16:
156933d455fSNicolas Souchu   case VIDBUF24:
157933d455fSNicolas Souchu   case VIDBUF32:
158933d455fSNicolas Souchu     address = dst->Bitmap + (dst->VXsize * y + x) * dst->PixelBytes;
159933d455fSNicolas Souchu     bcopy(line, address, width * dst->PixelBytes);
160933d455fSNicolas Souchu     break;
1619a57b7d2SSøren Schmidt   default:
162a96d3de6SGarrett Wollman     ;
1639a57b7d2SSøren Schmidt   }
1649a57b7d2SSøren Schmidt }
1659a57b7d2SSøren Schmidt 
1669a57b7d2SSøren Schmidt int
1679a57b7d2SSøren Schmidt __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
1689a57b7d2SSøren Schmidt 	      VGLBitmap *dst, int dstx, int dsty, int width, int hight)
1699a57b7d2SSøren Schmidt {
170a07067eaSBruce Evans   byte *buffer, *p;
171a07067eaSBruce Evans   int mousemerge, srcline, dstline, yend, yextra, ystep;
1729a57b7d2SSøren Schmidt 
173a07067eaSBruce Evans   mousemerge = 0;
174a07067eaSBruce Evans   if (hight < 0) {
175a07067eaSBruce Evans     hight = -hight;
176a07067eaSBruce Evans     mousemerge = (dst == VGLDisplay &&
177a07067eaSBruce Evans 		  VGLMouseOverlap(dstx, dsty, width, hight));
178a07067eaSBruce Evans     if (mousemerge)
179a07067eaSBruce Evans       buffer = alloca(width*src->PixelBytes);
180a07067eaSBruce Evans   }
1815acf51eaSKazutaka YOKOTA   if (srcx>src->VXsize || srcy>src->VYsize
1825acf51eaSKazutaka YOKOTA 	|| dstx>dst->VXsize || dsty>dst->VYsize)
1839a57b7d2SSøren Schmidt     return -1;
1849a57b7d2SSøren Schmidt   if (srcx < 0) {
1859a57b7d2SSøren Schmidt     width=width+srcx; dstx-=srcx; srcx=0;
1869a57b7d2SSøren Schmidt   }
1879a57b7d2SSøren Schmidt   if (srcy < 0) {
1889a57b7d2SSøren Schmidt     hight=hight+srcy; dsty-=srcy; srcy=0;
1899a57b7d2SSøren Schmidt   }
1909a57b7d2SSøren Schmidt   if (dstx < 0) {
1919a57b7d2SSøren Schmidt     width=width+dstx; srcx-=dstx; dstx=0;
1929a57b7d2SSøren Schmidt   }
1939a57b7d2SSøren Schmidt   if (dsty < 0) {
1949a57b7d2SSøren Schmidt     hight=hight+dsty; srcy-=dsty; dsty=0;
1959a57b7d2SSøren Schmidt   }
1965acf51eaSKazutaka YOKOTA   if (srcx+width > src->VXsize)
1975acf51eaSKazutaka YOKOTA      width=src->VXsize-srcx;
1985acf51eaSKazutaka YOKOTA   if (srcy+hight > src->VYsize)
1995acf51eaSKazutaka YOKOTA      hight=src->VYsize-srcy;
2005acf51eaSKazutaka YOKOTA   if (dstx+width > dst->VXsize)
2015acf51eaSKazutaka YOKOTA      width=dst->VXsize-dstx;
2025acf51eaSKazutaka YOKOTA   if (dsty+hight > dst->VYsize)
2035acf51eaSKazutaka YOKOTA      hight=dst->VYsize-dsty;
2049a57b7d2SSøren Schmidt   if (width < 0 || hight < 0)
2059a57b7d2SSøren Schmidt      return -1;
2061e4abf1dSBruce Evans   yend = srcy + hight;
2071e4abf1dSBruce Evans   yextra = 0;
2081e4abf1dSBruce Evans   ystep = 1;
2091e4abf1dSBruce Evans   if (src->Bitmap == dst->Bitmap && srcy < dsty) {
210*71819202SBruce Evans     yend = srcy - 1;
2111e4abf1dSBruce Evans     yextra = hight - 1;
2121e4abf1dSBruce Evans     ystep = -1;
2131e4abf1dSBruce Evans   }
2141e4abf1dSBruce Evans   for (srcline = srcy + yextra, dstline = dsty + yextra; srcline != yend;
2151e4abf1dSBruce Evans        srcline += ystep, dstline += ystep) {
216a07067eaSBruce Evans     p = src->Bitmap+(srcline*src->VXsize+srcx)*dst->PixelBytes;
217a07067eaSBruce Evans     if (mousemerge && VGLMouseOverlap(dstx, dstline, width, 1)) {
218a07067eaSBruce Evans       bcopy(p, buffer, width*src->PixelBytes);
219a07067eaSBruce Evans       p = buffer;
220a07067eaSBruce Evans       VGLMouseMerge(dstx, dstline, width, p);
221a07067eaSBruce Evans     }
222a07067eaSBruce Evans     WriteVerticalLine(dst, dstx, dstline, width, p);
2239a57b7d2SSøren Schmidt   }
2249a57b7d2SSøren Schmidt   return 0;
2259a57b7d2SSøren Schmidt }
2269a57b7d2SSøren Schmidt 
2279a57b7d2SSøren Schmidt int
2289a57b7d2SSøren Schmidt VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
2299a57b7d2SSøren Schmidt 	      VGLBitmap *dst, int dstx, int dsty, int width, int hight)
2309a57b7d2SSøren Schmidt {
231a07067eaSBruce Evans   int error;
2329a57b7d2SSøren Schmidt 
233a07067eaSBruce Evans   if (hight < 0)
234a07067eaSBruce Evans     return -1;
2351fa51420SBruce Evans   if (src == VGLDisplay)
2361fa51420SBruce Evans     src = &VGLVDisplay;
237014ddcbcSBruce Evans   if (src->Type != MEMBUF)
2381fa51420SBruce Evans     return -1;		/* invalid */
2391fa51420SBruce Evans   if (dst == VGLDisplay) {
240c7432537SBruce Evans     VGLMouseFreeze();
241a07067eaSBruce Evans     __VGLBitmapCopy(src, srcx, srcy, &VGLVDisplay, dstx, dsty, width, hight);
242c7432537SBruce Evans     error = __VGLBitmapCopy(src, srcx, srcy, &VGLVDisplay, dstx, dsty,
243c7432537SBruce Evans                             width, hight);
244a07067eaSBruce Evans     if (error != 0)
245c7432537SBruce Evans       return error;
2461fa51420SBruce Evans     src = &VGLVDisplay;
2471fa51420SBruce Evans     srcx = dstx;
2481fa51420SBruce Evans     srcy = dsty;
2491fa51420SBruce Evans   } else if (dst->Type != MEMBUF)
2501fa51420SBruce Evans     return -1;		/* invalid */
251a07067eaSBruce Evans   error = __VGLBitmapCopy(src, srcx, srcy, dst, dstx, dsty, width, -hight);
252a07067eaSBruce Evans   if (dst == VGLDisplay)
2539a57b7d2SSøren Schmidt     VGLMouseUnFreeze();
2549a57b7d2SSøren Schmidt   return error;
2559a57b7d2SSøren Schmidt }
2569a57b7d2SSøren Schmidt 
2575acf51eaSKazutaka YOKOTA VGLBitmap
2585acf51eaSKazutaka YOKOTA *VGLBitmapCreate(int type, int xsize, int ysize, byte *bits)
2595acf51eaSKazutaka YOKOTA {
2605acf51eaSKazutaka YOKOTA   VGLBitmap *object;
2615acf51eaSKazutaka YOKOTA 
2625acf51eaSKazutaka YOKOTA   if (type != MEMBUF)
2635acf51eaSKazutaka YOKOTA     return NULL;
2645acf51eaSKazutaka YOKOTA   if (xsize < 0 || ysize < 0)
2655acf51eaSKazutaka YOKOTA     return NULL;
2665acf51eaSKazutaka YOKOTA   object = (VGLBitmap *)malloc(sizeof(*object));
2675acf51eaSKazutaka YOKOTA   if (object == NULL)
2685acf51eaSKazutaka YOKOTA     return NULL;
2695acf51eaSKazutaka YOKOTA   object->Type = type;
2705acf51eaSKazutaka YOKOTA   object->Xsize = xsize;
2715acf51eaSKazutaka YOKOTA   object->Ysize = ysize;
2725acf51eaSKazutaka YOKOTA   object->VXsize = xsize;
2735acf51eaSKazutaka YOKOTA   object->VYsize = ysize;
2745acf51eaSKazutaka YOKOTA   object->Xorigin = 0;
2755acf51eaSKazutaka YOKOTA   object->Yorigin = 0;
2765acf51eaSKazutaka YOKOTA   object->Bitmap = bits;
277fbc6daa1SBruce Evans   object->PixelBytes = VGLDisplay->PixelBytes;
2785acf51eaSKazutaka YOKOTA   return object;
2795acf51eaSKazutaka YOKOTA }
2805acf51eaSKazutaka YOKOTA 
2815acf51eaSKazutaka YOKOTA void
2825acf51eaSKazutaka YOKOTA VGLBitmapDestroy(VGLBitmap *object)
2835acf51eaSKazutaka YOKOTA {
2845acf51eaSKazutaka YOKOTA   if (object->Bitmap)
2855acf51eaSKazutaka YOKOTA     free(object->Bitmap);
2865acf51eaSKazutaka YOKOTA   free(object);
2875acf51eaSKazutaka YOKOTA }
2885acf51eaSKazutaka YOKOTA 
2895acf51eaSKazutaka YOKOTA int
2905acf51eaSKazutaka YOKOTA VGLBitmapAllocateBits(VGLBitmap *object)
2915acf51eaSKazutaka YOKOTA {
292fbc6daa1SBruce Evans   object->Bitmap = malloc(object->VXsize*object->VYsize*object->PixelBytes);
2935acf51eaSKazutaka YOKOTA   if (object->Bitmap == NULL)
2945acf51eaSKazutaka YOKOTA     return -1;
2955acf51eaSKazutaka YOKOTA   return 0;
2965acf51eaSKazutaka YOKOTA }
297a93ca07aSBruce Evans 
298a93ca07aSBruce Evans void
299a93ca07aSBruce Evans VGLBitmapCvt(VGLBitmap *src, VGLBitmap *dst)
300a93ca07aSBruce Evans {
301a93ca07aSBruce Evans   u_long color;
302a93ca07aSBruce Evans   int dstpos, i, pb, size, srcpb, srcpos;
303a93ca07aSBruce Evans 
304a93ca07aSBruce Evans   size = src->VXsize * src->VYsize;
305a93ca07aSBruce Evans   srcpb = src->PixelBytes;
306a93ca07aSBruce Evans   if (srcpb <= 0)
307a93ca07aSBruce Evans     srcpb = 1;
308a93ca07aSBruce Evans   pb = dst->PixelBytes;
309a93ca07aSBruce Evans   if (pb == srcpb) {
310a93ca07aSBruce Evans     bcopy(src->Bitmap, dst->Bitmap, size * pb);
311a93ca07aSBruce Evans     return;
312a93ca07aSBruce Evans   }
313a93ca07aSBruce Evans   if (srcpb != 1)
314a93ca07aSBruce Evans     return;		/* not supported */
315a93ca07aSBruce Evans   for (srcpos = dstpos = 0; srcpos < size; srcpos++) {
316a93ca07aSBruce Evans     color = VGLrgb332ToNative(src->Bitmap[srcpos]);
317a93ca07aSBruce Evans     for (i = 0; i < pb; i++, color >>= 8)
318a93ca07aSBruce Evans         dst->Bitmap[dstpos++] = color;
319a93ca07aSBruce Evans   }
320a93ca07aSBruce Evans }
321