splash_bmp.c (43229) | splash_bmp.c (43664) |
---|---|
1/*- 2 * Copyright (c) 1999 Michael Smith <msmith@freebsd.org> 3 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@freebsd.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/*- 2 * Copyright (c) 1999 Michael Smith <msmith@freebsd.org> 3 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@freebsd.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $Id: splash_bmp.c,v 1.4 1999/01/21 18:29:33 yokota Exp $ | 27 * $Id: splash_bmp.c,v 1.5 1999/01/26 10:00:02 yokota Exp $ |
28 */ 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/linker.h> 34 35#include <machine/console.h> --- 175 unchanged lines hidden (view full) --- 211fill(BMP_INFO *info, int x, int y, int xsize, int ysize) 212{ 213 u_char *window; 214 int banksize; 215 int bank; 216 int p; 217 218 banksize = info->adp->va_window_size; | 28 */ 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/linker.h> 34 35#include <machine/console.h> --- 175 unchanged lines hidden (view full) --- 211fill(BMP_INFO *info, int x, int y, int xsize, int ysize) 212{ 213 u_char *window; 214 int banksize; 215 int bank; 216 int p; 217 218 banksize = info->adp->va_window_size; |
219 bank = (info->swidth*y + x)/banksize; | 219 bank = (info->adp->va_line_width*y + x)/banksize; |
220 window = (u_char *)info->adp->va_window; 221 (*vidsw[info->adp->va_index]->set_win_org)(info->adp, bank*banksize); 222 while (ysize > 0) { | 220 window = (u_char *)info->adp->va_window; 221 (*vidsw[info->adp->va_index]->set_win_org)(info->adp, bank*banksize); 222 while (ysize > 0) { |
223 p = (info->swidth*y + x)%banksize; | 223 p = (info->adp->va_line_width*y + x)%banksize; |
224 for (; (p + xsize <= banksize) && ysize > 0; --ysize, ++y) { 225 generic_bzero(window + p, xsize); | 224 for (; (p + xsize <= banksize) && ysize > 0; --ysize, ++y) { 225 generic_bzero(window + p, xsize); |
226 p += info->swidth; | 226 p += info->adp->va_line_width; |
227 } 228 if (ysize <= 0) 229 break; 230 if (p < banksize) { 231 /* the last line crosses the window boundary */ 232 generic_bzero(window + p, banksize - p); 233 } 234 ++bank; /* next bank */ --- 27 unchanged lines hidden (view full) --- 262 if ((x < 0) || (x >= info->swidth) || (y < 0) || (y >= info->sheight)) 263 return; 264 265 /* 266 * calculate offset into video memory; 267 * because 0,0 is bottom-left for DIB, we have to convert. 268 */ 269 sofs = ((info->height - (y+1) + (info->sheight - info->height) / 2) | 227 } 228 if (ysize <= 0) 229 break; 230 if (p < banksize) { 231 /* the last line crosses the window boundary */ 232 generic_bzero(window + p, banksize - p); 233 } 234 ++bank; /* next bank */ --- 27 unchanged lines hidden (view full) --- 262 if ((x < 0) || (x >= info->swidth) || (y < 0) || (y >= info->sheight)) 263 return; 264 265 /* 266 * calculate offset into video memory; 267 * because 0,0 is bottom-left for DIB, we have to convert. 268 */ 269 sofs = ((info->height - (y+1) + (info->sheight - info->height) / 2) |
270 * info->swidth) + x + (info->swidth - info->width) / 2; | 270 * info->adp->va_line_width); |
271 272 switch(info->sdepth) { 273 case 1: | 271 272 switch(info->sdepth) { 273 case 1: |
274 sofs = sofs >> 3; /* correct for depth */ | 274 sofs += ((x + (info->swidth - info->width) / 2) >> 3); |
275 bofs = x & 0x7; /* offset within byte */ 276 277 val &= 1; /* mask pixel value */ 278 mask = ~(0x80 >> bofs); /* calculate bit mask */ 279 tpv = *(info->vidmem+sofs) & mask; /* get screen contents, excluding masked bit */ 280 *(info->vidmem+sofs) = tpv | (val << (8-bofs)); /* write new bit */ 281 break; 282 283 /* XXX only correct for non-interleaved modes */ 284 case 4: | 275 bofs = x & 0x7; /* offset within byte */ 276 277 val &= 1; /* mask pixel value */ 278 mask = ~(0x80 >> bofs); /* calculate bit mask */ 279 tpv = *(info->vidmem+sofs) & mask; /* get screen contents, excluding masked bit */ 280 *(info->vidmem+sofs) = tpv | (val << (8-bofs)); /* write new bit */ 281 break; 282 283 /* XXX only correct for non-interleaved modes */ 284 case 4: |
285 sofs = sofs >> 1; /* correct for depth */ | 285 sofs += ((x + (info->swidth - info->width) / 2) >> 1); |
286 bofs = x & 0x1; /* offset within byte */ 287 288 val &= 0xf; /* mask pixel value */ 289 mask = bofs ? 0x0f : 0xf0; /* calculate bit mask */ 290 tpv = *(info->vidmem+sofs) & mask; /* get screen contents, excluding masked bits */ 291 *(info->vidmem+sofs) = tpv | (val << (bofs ? 0 : 4)); /* write new bits */ 292 break; 293 294 case 8: | 286 bofs = x & 0x1; /* offset within byte */ 287 288 val &= 0xf; /* mask pixel value */ 289 mask = bofs ? 0x0f : 0xf0; /* calculate bit mask */ 290 tpv = *(info->vidmem+sofs) & mask; /* get screen contents, excluding masked bits */ 291 *(info->vidmem+sofs) = tpv | (val << (bofs ? 0 : 4)); /* write new bits */ 292 break; 293 294 case 8: |
295 sofs += x + (info->swidth - info->width) / 2; |
|
295 newbank = sofs/info->adp->va_window_size; 296 if (info->bank != newbank) { 297 (*vidsw[info->adp->va_index]->set_win_org)(info->adp, newbank*info->adp->va_window_size); 298 info->bank = newbank; 299 } 300 sofs %= info->adp->va_window_size; 301 *(info->vidmem+sofs) = val; 302 break; --- 246 unchanged lines hidden --- | 296 newbank = sofs/info->adp->va_window_size; 297 if (info->bank != newbank) { 298 (*vidsw[info->adp->va_index]->set_win_org)(info->adp, newbank*info->adp->va_window_size); 299 info->bank = newbank; 300 } 301 sofs %= info->adp->va_window_size; 302 *(info->vidmem+sofs) = val; 303 break; --- 246 unchanged lines hidden --- |