1 /* $NetBSD: ite_cc.c,v 1.38 2007/03/04 05:59:21 christos Exp $ */
4 * Copyright (c) 1994 Christian E. Hopps
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Christian E. Hopps.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include "opt_amigaccgrf.h"
35 #include <sys/cdefs.h>
36 __KERNEL_RCSID(0, "$NetBSD: ite_cc.c,v 1.38 2007/03/04 05:59:21 christos Exp $");
41 #include <sys/param.h>
44 #include <sys/device.h>
45 #include <sys/ioctl.h>
47 #include <sys/systm.h>
48 #include <sys/queue.h>
49 #include <sys/termios.h>
51 #include <machine/cpu.h>
52 #include <amiga/dev/itevar.h>
53 #include <amiga/dev/iteioctl.h>
54 #include <amiga/amiga/cc.h>
55 #include <amiga/amiga/device.h>
56 #include <amiga/dev/grfabs_reg.h>
57 #include <amiga/dev/grfioctl.h>
58 #include <amiga/dev/grfvar.h>
59 #include <amiga/dev/grf_ccreg.h>
60 #include <amiga/dev/viewioctl.h>
61 #include <amiga/dev/viewvar.h>
65 #define kernel_font_width kernel_font_width_8x11
66 #define kernel_font_height kernel_font_height_8x11
67 #define kernel_font_baseline kernel_font_baseline_8x11
68 #define kernel_font_boldsmear kernel_font_boldsmear_8x11
69 #define kernel_font_lo kernel_font_lo_8x11
70 #define kernel_font_hi kernel_font_hi_8x11
71 #define kernel_font kernel_font_8x11
72 #define kernel_cursor kernel_cursor_8x11
74 #define kernel_font_width kernel_font_width_8x8
75 #define kernel_font_height kernel_font_height_8x8
76 #define kernel_font_baseline kernel_font_baseline_8x8
77 #define kernel_font_boldsmear kernel_font_boldsmear_8x8
78 #define kernel_font_lo kernel_font_lo_8x8
79 #define kernel_font_hi kernel_font_hi_8x8
80 #define kernel_font kernel_font_8x8
81 #define kernel_cursor kernel_cursor_8x8
85 extern u_char kernel_font_width
, kernel_font_height
, kernel_font_baseline
;
86 extern short kernel_font_boldsmear
;
87 extern u_char kernel_font_lo
, kernel_font_hi
;
88 extern u_char kernel_font
[], kernel_cursor
[];
91 #if !defined(USE_C_BFOPS) && !defined(__m68k__)
95 #if !defined(USE_C_BFOPS)
96 #define BFEXT(v,p,o,w) __asm("bfextu %1@{%2:%3},%0" : "=d" (v) : \
97 "a"(p), "d"(o), "d"(w))
98 #define BFINS(v,p,o,w) __asm("bfins %0,%1@{%2:%3}" : /* no output */ : \
99 "d"(v), "a"(p), "d"(o), "d"(w))
100 #define BFCLR(p,o,w) __asm("bfclr %0@{%1:%2}" : /* no output */ : \
101 "a"(p), "d"(o), "d"(w))
102 #define BFCHG(p,o,w) __asm("bfchg %0@{%1:%2}" : /* no output */ : \
103 "a"(p), "d"(o), "d"(w))
104 #define BFSET(p,o,w) __asm("bfset %0@{%1:%2}" : /* no output */ : \
105 "a"(p), "d"(o), "d"(w))
107 #define BFEXT(v,p,o,w) do {v = ((u_int8_t *)(p))[(o)>>3];} while (0)
108 #define BFINS(v,p,o,w) do {((u_int8_t *)(p))[(o)>>3] = (v);} while (0)
109 #define BFCLR(p,o,w) BFINS(0x00,p,o,w)
110 #define BFSET(p,o,w) BFINS(0xff,p,o,w)
111 #define BFCHG(p,o,w) do {((u_int8_t *)(p))[(o)>>3] ^= 0xff;} while (0)
115 * This is what ip->priv points to;
116 * it contains local variables for custom-chip ites.
119 view_t
*view
; /* the view for this ite. */
120 u_char
**row_ptr
; /* array of pointers into the bitmap */
123 u_int
*column_offset
; /* array of offsets for columns */
124 u_int row_offset
; /* the row offset */
125 u_short width
; /* the bitmap width */
126 u_short underline
; /* where the underline goes */
127 u_short ft_x
; /* the font width */
128 u_short ft_y
; /* the font height */
129 u_char
*font_cell
[256]; /* the font pointer */
131 typedef struct ite_priv ipriv_t
;
133 void view_deinit(struct ite_softc
*);
134 void view_init(struct ite_softc
*);
136 static void putc8(struct ite_softc
*, int, int, int, int);
137 static void clear8(struct ite_softc
*, int, int, int, int);
138 static void scroll8(struct ite_softc
*, int, int, int, int);
139 static void cursor32(struct ite_softc
*, int);
140 static void scrollbmap(bmap_t
*, u_short
, u_short
, u_short
, u_short
,
141 short, short, u_char
);
144 int ite_default_x
= 0; /* def leftedge offset */
145 int ite_default_y
= 0; /* def topedge offset */
146 int ite_default_width
= 640; /* def width */
147 int ite_default_depth
= 2; /* def depth */
148 #if defined (GRF_NTSC)
149 int ite_default_height
= 400; /* def NTSC height */
150 #elif defined (GRF_PAL)
151 int ite_default_height
= 512; /* def PAL height */
153 int ite_default_height
= 400; /* def NON-PAL/NTSC height (?) */
156 int ite_newsize(struct ite_softc
*, struct itewinsize
*);
157 static void putc_nm(ipriv_t
*, u_char
*, u_char
*, u_int
, u_int
,
159 static void putc_in(ipriv_t
*, u_char
*, u_char
*, u_int
, u_int
,
161 static void putc_ul(ipriv_t
*, u_char
*, u_char
*, u_int
, u_int
,
163 static void putc_ul_in(ipriv_t
*, u_char
*, u_char
*, u_int
, u_int
,
165 static void putc_bd(ipriv_t
*, u_char
*, u_char
*, u_int
, u_int
,
167 static void putc_bd_in(ipriv_t
*, u_char
*, u_char
*, u_int
, u_int
,
169 static void putc_bd_ul(ipriv_t
*, u_char
*, u_char
*, u_int
, u_int
,
171 static void putc_bd_ul_in(ipriv_t
*, u_char
*, u_char
*, u_int
, u_int
,
175 * called from grf_cc to return console priority
184 * called from grf_cc to init ite portion of
188 grfcc_iteinit(struct grf_softc
*gp
)
190 gp
->g_itecursor
= cursor32
;
191 gp
->g_iteputc
= putc8
;
192 gp
->g_iteclear
= clear8
;
193 gp
->g_itescroll
= scroll8
;
194 gp
->g_iteinit
= view_init
;
195 gp
->g_itedeinit
= view_deinit
;
199 ite_newsize(struct ite_softc
*ip
, struct itewinsize
*winsz
)
201 extern struct view_softc views
[];
202 extern const struct cdevsw view_cdevsw
;
204 ipriv_t
*cci
= ip
->priv
;
210 vs
.width
= winsz
->width
;
211 vs
.height
= winsz
->height
;
212 vs
.depth
= winsz
->depth
;
213 /* XXX type of vs ? */
214 error
= (*view_cdevsw
.d_ioctl
)(0, VIOCSSIZE
, (void *)&vs
, -1, NULL
);
217 * Reinitialize our structs
219 cci
->view
= views
[0].view
;
221 ip
->cols
= cci
->view
->display
.width
/ ip
->ftwidth
;
222 ip
->rows
= cci
->view
->display
.height
/ ip
->ftheight
;
225 * save new values so that future opens use them
226 * this may not be correct when we implement Virtual Consoles
228 ite_default_height
= cci
->view
->display
.height
;
229 ite_default_width
= cci
->view
->display
.width
;
230 ite_default_x
= cci
->view
->display
.x
;
231 ite_default_y
= cci
->view
->display
.y
;
232 ite_default_depth
= cci
->view
->bitmap
->depth
;
235 free_chipmem(cci
->row_ptr
);
236 if (cci
->column_offset
)
237 free_chipmem(cci
->column_offset
);
239 cci
->row_ptr
= alloc_chipmem(sizeof(u_char
*) * ip
->rows
);
240 cci
->column_offset
= alloc_chipmem(sizeof(u_int
) * ip
->cols
);
242 if (cci
->row_ptr
== NULL
|| cci
->column_offset
== NULL
)
243 panic("no chipmem for itecc data");
246 cci
->width
= cci
->view
->bitmap
->bytes_per_row
<< 3;
247 cci
->underline
= ip
->ftbaseline
+ 1;
248 cci
->row_offset
= cci
->view
->bitmap
->bytes_per_row
249 + cci
->view
->bitmap
->row_mod
;
250 cci
->ft_x
= ip
->ftwidth
;
251 cci
->ft_y
= ip
->ftheight
;
253 cci
->row_bytes
= cci
->row_offset
* ip
->ftheight
;
255 cci
->row_ptr
[0] = VDISPLAY_LINE (cci
->view
, 0, 0);
256 for (i
= 1; i
< ip
->rows
; i
++)
257 cci
->row_ptr
[i
] = cci
->row_ptr
[i
-1] + cci
->row_bytes
;
259 /* initialize the column offsets */
260 cci
->column_offset
[0] = 0;
261 for (i
= 1; i
< ip
->cols
; i
++)
262 cci
->column_offset
[i
] = cci
->column_offset
[i
- 1] + cci
->ft_x
;
264 /* initialize the font cell pointers */
265 cci
->font_cell
[ip
->font_lo
] = ip
->font
;
266 for (i
=ip
->font_lo
+1; i
<=ip
->font_hi
; i
++)
267 cci
->font_cell
[i
] = cci
->font_cell
[i
-1] + ip
->ftheight
;
273 view_init(register struct ite_softc
*ip
)
275 struct itewinsize wsz
;
283 ip
->font
= kernel_font
;
284 ip
->font_lo
= kernel_font_lo
;
285 ip
->font_hi
= kernel_font_hi
;
286 ip
->ftwidth
= kernel_font_width
;
287 ip
->ftheight
= kernel_font_height
;
288 ip
->ftbaseline
= kernel_font_baseline
;
289 ip
->ftboldsmear
= kernel_font_boldsmear
;
291 /* Find the correct set of rendering routines for this font. */
293 panic("kernel font size not supported");
294 cci
= alloc_chipmem(sizeof (*cci
));
296 panic("no memory for console device.");
302 cci
->column_offset
= NULL
;
304 wsz
.x
= ite_default_x
;
305 wsz
.y
= ite_default_y
;
306 wsz
.width
= ite_default_width
;
307 wsz
.height
= ite_default_height
;
308 wsz
.depth
= ite_default_depth
;
310 ite_newsize (ip
, &wsz
);
311 cc_mode(ip
->grf
, GM_GRFON
, NULL
, 0, 0);
315 ite_grf_ioctl(struct ite_softc
*ip
, u_long cmd
, void *addr
, int flag
,
319 struct itewinsize
*is
;
320 extern const struct cdevsw ite_cdevsw
;
321 extern const struct cdevsw view_cdevsw
;
330 is
= (struct itewinsize
*)addr
;
331 is
->x
= cci
->view
->display
.x
;
332 is
->y
= cci
->view
->display
.y
;
333 is
->width
= cci
->view
->display
.width
;
334 is
->height
= cci
->view
->display
.height
;
335 is
->depth
= cci
->view
->bitmap
->depth
;
338 is
= (struct itewinsize
*)addr
;
340 if (ite_newsize(ip
, is
))
343 ws
.ws_row
= ip
->rows
;
344 ws
.ws_col
= ip
->cols
;
345 ws
.ws_xpixel
= cci
->view
->display
.width
;
346 ws
.ws_ypixel
= cci
->view
->display
.height
;
349 * XXX tell tty about the change
350 * XXX this is messy, but works
352 (*ite_cdevsw
.d_ioctl
)(0, TIOCSWINSZ
,
357 cc_mode(ip
->grf
, GM_GRFON
, NULL
, 0, 0);
360 cc_mode(ip
->grf
, GM_GRFOFF
, NULL
, 0, 0);
365 * XXX needs to be fixed when multiple console implemented
366 * XXX watchout for that -1 its not really the kernel talking
367 * XXX these two commands don't use the proc pointer though
369 error
= (*view_cdevsw
.d_ioctl
)(0, cmd
, addr
, -1, l
);
372 error
= EPASSTHROUGH
;
379 view_deinit(struct ite_softc
*ip
)
381 ip
->flags
&= ~ITE_INITED
;
384 /*** (M<8)-by-N routines ***/
387 cursor32(struct ite_softc
*ip
, int flag
)
389 int cend
, ofs
, h
, cstart
, dr_plane
;
398 dr_plane
= (bm
->depth
> 1 ? bm
->depth
-1 : 0);
400 if (flag
== END_CURSOROPT
)
402 else if (flag
== START_CURSOROPT
) {
403 if (!cci
->cursor_opt
)
404 cursor32 (ip
, ERASE_CURSOR
);
406 return; /* if we are already opted. */
410 return; /* if we are still nested. */
411 /* else we draw the cursor. */
413 cend
= ip
->ftheight
-1;
414 pl
= VDISPLAY_LINE(v
, dr_plane
, (ip
->cursory
* ip
->ftheight
+ cstart
));
415 ofs
= (ip
->cursorx
* ip
->ftwidth
);
417 if (flag
!= DRAW_CURSOR
&& flag
!= END_CURSOROPT
) {
424 for (hh
= cend
; hh
>= 0; hh
--) {
425 BFCLR(pl
, ofs
, ip
->ftwidth
);
426 pl
+= cci
->row_offset
;
429 for (hh
= cend
; hh
>= 0; hh
--) {
430 BFCHG(pl
, ofs
, ip
->ftwidth
);
431 pl
+= cci
->row_offset
;
436 if (flag
!= DRAW_CURSOR
&& flag
!= MOVE_CURSOR
&&
437 flag
!= END_CURSOROPT
)
444 ip
->cursorx
= min(ip
->curx
, ip
->cols
-1);
445 ip
->cursory
= ip
->cury
;
447 cend
= ip
->ftheight
-1;
448 pl
= VDISPLAY_LINE(v
, dr_plane
, ip
->cursory
* ip
->ftheight
+ cstart
);
449 ofs
= ip
->cursorx
* ip
->ftwidth
;
452 for (h
= cend
; h
>= 0; h
--) {
453 BFSET(pl
, ofs
, ip
->ftwidth
);
454 pl
+= cci
->row_offset
;
457 for (h
= cend
; h
>= 0; h
--) {
458 BFCHG(pl
, ofs
, ip
->ftwidth
);
459 pl
+= cci
->row_offset
;
466 int expbits(int data
)
472 for (i
=1; i
< 32; i
++) {
481 /* Notes: optimizations given the kernel_font_(width|height) #define'd.
482 * the dbra loops could be elminated and unrolled using height,
483 * the :width in the bfxxx instruction could be made immediate instead
484 * of a data register as it now is.
485 * the underline could be added when the loop is unrolled
487 * It would look like hell but be very fast.*/
490 putc_nm(register ipriv_t
*cci
, register u_char
*p
, register u_char
*f
,
491 register u_int co
, register u_int ro
, register u_int fw
,
495 BFINS(*f
++, p
, co
, fw
);
501 putc_in(register ipriv_t
*cci
, register u_char
*p
, register u_char
*f
,
502 register u_int co
, register u_int ro
, register u_int fw
,
506 BFINS(~(*f
++), p
, co
, fw
);
513 putc_ul(register ipriv_t
*cci
, register u_char
*p
, register u_char
*f
,
514 register u_int co
, register u_int ro
, register u_int fw
,
517 int underline
= cci
->underline
;
518 while (underline
--) {
523 BFINS(expbits(*f
++),p
,co
,fw
);
526 underline
= fh
- cci
->underline
- 1;
527 while (underline
--) {
535 putc_ul_in(register ipriv_t
*cci
, register u_char
*p
, register u_char
*f
,
536 register u_int co
, register u_int ro
, register u_int fw
,
539 int underline
= cci
->underline
;
540 while (underline
--) {
541 BFINS(~(*f
++),p
,co
,fw
);
545 BFINS(~expbits(*f
++),p
,co
,fw
);
548 underline
= fh
- cci
->underline
- 1;
549 while (underline
--) {
550 BFINS(~(*f
++),p
,co
,fw
);
557 putc_bd(register ipriv_t
*cci
, register u_char
*p
, register u_char
*f
,
558 register u_int co
, register u_int ro
, register u_int fw
,
572 putc_bd_in(register ipriv_t
*cci
, register u_char
*p
, register u_char
*f
,
573 register u_int co
, register u_int ro
, register u_int fw
,
588 putc_bd_ul(register ipriv_t
*cci
, register u_char
*p
, register u_char
*f
,
589 register u_int co
, register u_int ro
, register u_int fw
,
592 int underline
= cci
->underline
;
595 while (underline
--) {
604 BFINS(expbits(ch
),p
,co
,fw
);
607 underline
= fh
- cci
->underline
- 1;
608 while (underline
--) {
618 putc_bd_ul_in(register ipriv_t
*cci
, register u_char
*p
, register u_char
*f
,
619 register u_int co
, register u_int ro
, register u_int fw
,
622 int underline
= cci
->underline
;
625 while (underline
--) {
634 BFINS(~expbits(ch
),p
,co
,fw
);
637 underline
= fh
- cci
->underline
- 1;
638 while (underline
--) {
647 typedef void cc_putc_func(ipriv_t
*, u_char
*, u_char
*, u_int
, u_int
,
650 cc_putc_func
*put_func
[ATTR_ALL
+1] = {
659 /* no support for blink */
671 /* FIX: shouldn't this advance the cursor even if the character to
672 be output is not available in the font? -ch */
675 putc8(struct ite_softc
*ip
, int c
, int dy
, int dx
, int mode
)
677 ipriv_t
*cci
= (ipriv_t
*) ip
->priv
;
679 * if character is higher than font has glyphs, substitute
683 if (c
< ip
->font_lo
|| c
> ip
->font_hi
)
685 put_func
[mode
](cci
, cci
->row_ptr
[dy
], cci
->font_cell
[c
],
686 cci
->column_offset
[dx
], cci
->row_offset
, cci
->ft_x
, cci
->ft_y
);
690 clear8(struct ite_softc
*ip
, int sy
, int sx
, int h
, int w
)
692 ipriv_t
*cci
= (ipriv_t
*) ip
->priv
;
693 bmap_t
*bm
= cci
->view
->bitmap
;
695 if ((sx
== 0) && (w
== ip
->cols
))
697 /* common case: clearing whole lines */
701 u_char
*ptr
= cci
->row_ptr
[sy
];
702 for (i
=0; i
< ip
->ftheight
; i
++) {
703 memset(ptr
, 0, bm
->bytes_per_row
);
704 ptr
+= bm
->bytes_per_row
+ bm
->row_mod
; /* don't get any smart
705 ideas, because this is for
706 interleaved bitmaps */
713 /* clearing only part of a line */
714 /* XXX could be optimized MUCH better, but is it worth the trouble? */
717 u_char
*pl
= cci
->row_ptr
[sy
];
718 int ofs
= sx
* ip
->ftwidth
;
720 for (i
= w
-1; i
>= 0; i
--)
723 for (j
= ip
->ftheight
-1; j
>= 0; j
--)
725 BFCLR(ppl
, ofs
, ip
->ftwidth
);
726 ppl
+= bm
->row_mod
+ bm
->bytes_per_row
;
735 /* Note: sx is only relevant for SCROLL_LEFT or SCROLL_RIGHT. */
737 scroll8(register struct ite_softc
*ip
, register int sy
, int sx
, int count
,
740 bmap_t
*bm
= ((ipriv_t
*)ip
->priv
)->view
->bitmap
;
741 u_char
*pl
= ((ipriv_t
*)ip
->priv
)->row_ptr
[sy
];
743 if (dir
== SCROLL_UP
)
747 /*FIX: add scroll bitmap call */
748 cursor32(ip
, ERASE_CURSOR
);
749 scrollbmap (bm
, 0, dy
*ip
->ftheight
,
750 bm
->bytes_per_row
>> 3, (ip
->bottom_margin
-dy
+1)*ip
->ftheight
,
751 0, -(count
*ip
->ftheight
), 0x1);
752 /* if (ip->cursory <= bot || ip->cursory >= dy) {
753 ip->cursory -= count;
756 else if (dir
== SCROLL_DOWN
)
759 /* FIX: add scroll bitmap call */
760 cursor32(ip
, ERASE_CURSOR
);
761 scrollbmap (bm
, 0, sy
*ip
->ftheight
,
762 bm
->bytes_per_row
>> 3, (ip
->bottom_margin
-sy
+1)*ip
->ftheight
,
763 0, count
*ip
->ftheight
, 0x1);
764 /* if (ip->cursory <= bot || ip->cursory >= sy) {
765 ip->cursory += count;
768 else if (dir
== SCROLL_RIGHT
)
770 int sofs
= (ip
->cols
- count
) * ip
->ftwidth
;
771 int dofs
= (ip
->cols
) * ip
->ftwidth
;
774 cursor32(ip
, ERASE_CURSOR
);
775 for (j
= ip
->ftheight
-1; j
>= 0; j
--)
777 int sofs2
= sofs
, dofs2
= dofs
;
778 for (i
= (ip
->cols
- (sx
+ count
))-1; i
>= 0; i
--)
781 sofs2
-= ip
->ftwidth
;
782 dofs2
-= ip
->ftwidth
;
783 BFEXT(t
, pl
, sofs2
, ip
->ftwidth
);
784 BFINS(t
, pl
, dofs2
, ip
->ftwidth
);
786 pl
+= bm
->row_mod
+ bm
->bytes_per_row
;
789 else /* SCROLL_LEFT */
791 int sofs
= (sx
) * ip
->ftwidth
;
792 int dofs
= (sx
- count
) * ip
->ftwidth
;
795 cursor32(ip
, ERASE_CURSOR
);
796 for (j
= ip
->ftheight
-1; j
>= 0; j
--)
798 int sofs2
= sofs
, dofs2
= dofs
;
799 for (i
= (ip
->cols
- sx
)-1; i
>= 0; i
--)
802 BFEXT(t
, pl
, sofs2
, ip
->ftwidth
);
803 BFINS(t
, pl
, dofs2
, ip
->ftwidth
);
804 sofs2
+= ip
->ftwidth
;
805 dofs2
+= ip
->ftwidth
;
807 pl
+= bm
->row_mod
+ bm
->bytes_per_row
;
813 scrollbmap(bmap_t
*bm
, u_short x
, u_short y
, u_short width
, u_short height
,
814 short dx
, short dy
, u_char mask
)
816 u_short depth
= bm
->depth
;
817 u_short lwpr
= bm
->bytes_per_row
>> 2;
819 /* FIX: */ panic ("delta x not supported in scroll bitmap yet.");
821 if (bm
->flags
& BMF_INTERLEAVED
) {
830 for (i
=0; i
< depth
&& mask
; i
++, mask
>>= 1) {
832 u_long
*pl
= (u_long
*)bm
->plane
[i
];
833 u_long
*src_y
= pl
+ (lwpr
*y
);
834 u_long
*dest_y
= pl
+ (lwpr
*(y
+dy
));
835 u_long count
= lwpr
*(height
-dy
);
836 u_long
*clr_y
= src_y
;
837 u_long clr_count
= dest_y
- src_y
;
847 *dest_y
-- = *src_y
--; *dest_y
-- = *src_y
--;
848 *dest_y
-- = *src_y
--; *dest_y
-- = *src_y
--;
849 *dest_y
-- = *src_y
--; *dest_y
-- = *src_y
--;
850 *dest_y
-- = *src_y
--; *dest_y
-- = *src_y
--;
851 *dest_y
-- = *src_y
--; *dest_y
-- = *src_y
--;
852 *dest_y
-- = *src_y
--; *dest_y
-- = *src_y
--;
853 *dest_y
-- = *src_y
--; *dest_y
-- = *src_y
--;
854 *dest_y
-- = *src_y
--; *dest_y
-- = *src_y
--;
857 *dest_y
-- = *src_y
--;
860 cbc
= clr_count
>> 4;
864 *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0;
865 *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0;
866 *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0;
867 *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0;
869 while (clr_count
--) {
876 for (i
=0; i
< depth
&& mask
; i
++, mask
>>= 1) {
878 u_long
*pl
= (u_long
*)bm
->plane
[i
];
879 u_long
*src_y
= pl
+ (lwpr
*(y
-dy
));
880 u_long
*dest_y
= pl
+ (lwpr
*y
);
881 long count
= lwpr
*(height
+ dy
);
882 u_long
*clr_y
= dest_y
+ count
;
883 u_long clr_count
= src_y
- dest_y
;
890 *dest_y
++ = *src_y
++; *dest_y
++ = *src_y
++;
891 *dest_y
++ = *src_y
++; *dest_y
++ = *src_y
++;
892 *dest_y
++ = *src_y
++; *dest_y
++ = *src_y
++;
893 *dest_y
++ = *src_y
++; *dest_y
++ = *src_y
++;
894 *dest_y
++ = *src_y
++; *dest_y
++ = *src_y
++;
895 *dest_y
++ = *src_y
++; *dest_y
++ = *src_y
++;
896 *dest_y
++ = *src_y
++; *dest_y
++ = *src_y
++;
897 *dest_y
++ = *src_y
++; *dest_y
++ = *src_y
++;
900 *dest_y
++ = *src_y
++;
903 cbc
= clr_count
>> 4;
907 *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0;
908 *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0;
909 *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0;
910 *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0; *clr_y
++ = 0;
912 while (clr_count
--) {