Deleted Added
sdiff udiff text old ( 270485 ) new ( 270613 )
full compact
1/*-
2 * Copyright (c) 2005 Marcel Moolenaar
3 * All rights reserved.
4 *
5 * Copyright (c) 2009 The FreeBSD Foundation
6 * All rights reserved.
7 *
8 * Portions of this software were developed by Ed Schouten

--- 17 unchanged lines hidden (view full) ---

26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/dev/vt/hw/vga/vt_vga.c 270485 2014-08-24 14:39:33Z dumbbell $");
35
36#include <sys/param.h>
37#include <sys/kernel.h>
38#include <sys/systm.h>
39
40#include <dev/vt/vt.h>
41#include <dev/vt/hw/vga/vt_vga_reg.h>
42

--- 508 unchanged lines hidden (view full) ---

551 */
552
553 i = x;
554 used_colors = 0;
555 memset(used_colors_list, 0, sizeof(used_colors_list));
556 memset(pattern_2colors, 0, sizeof(pattern_2colors));
557 memset(pattern_ncolors, 0, sizeof(pattern_ncolors));
558
559 if (i < vw->vw_offset.tp_col) {
560 /*
561 * i is in the margin used to center the text area on
562 * the screen.
563 */
564
565 i = vw->vw_offset.tp_col;
566 }
567
568 while (i < x + VT_VGA_PIXELS_BLOCK) {
569 /*
570 * Find which character is drawn on this pixel in the
571 * pixels block.
572 *
573 * While here, record what colors it uses.
574 */
575
576 col = (i - vw->vw_offset.tp_col) / vf->vf_width;
577 row = (y - vw->vw_offset.tp_row) / vf->vf_height;
578
579 c = VTBUF_GET_FIELD(vb, row, col);
580 src = vtfont_lookup(vf, c);
581
582 vt_determine_colors(c, VTBUF_ISCURSOR(vb, row, col), &fg, &bg);
583 if ((used_colors_list[fg] & 0x1) != 0x1)
584 used_colors++;
585 if ((used_colors_list[bg] & 0x2) != 0x2)

--- 14 unchanged lines hidden (view full) ---

600 * - the last pixel of the character, or
601 * - the pixel of the character matching the end of
602 * the pixels block
603 * whichever comes first. This position is then
604 * changed to be relative to the start position of the
605 * character.
606 */
607
608 src_x = i - (col * vf->vf_width + vw->vw_offset.tp_col);
609 x_count = min(
610 (col + 1) * vf->vf_width + vw->vw_offset.tp_col,
611 x + VT_VGA_PIXELS_BLOCK);
612 x_count -= col * vf->vf_width + vw->vw_offset.tp_col;
613 x_count -= src_x;
614
615 /* Copy a portion of the character. */
616 vga_copy_bitmap_portion(pattern_2colors, pattern_ncolors,
617 src, NULL, vf->vf_width,
618 src_x, i % VT_VGA_PIXELS_BLOCK, x_count,
619 0, 0, vf->vf_height, fg, bg, 0);
620

--- 17 unchanged lines hidden (view full) ---

638 drawn_area.tr_end.tp_col = x + VT_VGA_PIXELS_BLOCK;
639 drawn_area.tr_end.tp_row = y + vf->vf_height;
640 if (vd->vd_mshown && vt_is_cursor_in_area(vd, &drawn_area)) {
641 struct vt_mouse_cursor *cursor;
642 unsigned int mx, my;
643 unsigned int dst_x, src_y, dst_y, y_count;
644
645 cursor = vd->vd_mcursor;
646 mx = vd->vd_mx_drawn + vw->vw_offset.tp_col;
647 my = vd->vd_my_drawn + vw->vw_offset.tp_row;
648
649 /* Compute the portion of the cursor we want to copy. */
650 src_x = x > mx ? x - mx : 0;
651 dst_x = mx > x ? mx - x : 0;
652 x_count = min(
653 min(cursor->width - src_x, x + VT_VGA_PIXELS_BLOCK - mx),
654 VT_VGA_PIXELS_BLOCK);
655
656 /*
657 * The cursor isn't aligned on the Y-axis with
658 * characters, so we need to compute the vertical
659 * start/count.
660 */
661 src_y = y > my ? y - my : 0;

--- 58 unchanged lines hidden (view full) ---

720 * alignment.
721 *
722 * For the Y-axis, we need to compute the character's y
723 * coordinate, but we don't need to align it.
724 */
725
726 col = area->tr_begin.tp_col;
727 row = area->tr_begin.tp_row;
728 x1 = (int)((col * vf->vf_width + vw->vw_offset.tp_col)
729 / VT_VGA_PIXELS_BLOCK)
730 * VT_VGA_PIXELS_BLOCK;
731 y1 = row * vf->vf_height + vw->vw_offset.tp_row;
732
733 /*
734 * Compute the bottom right pixel position, again, aligned with
735 * the pixels block size.
736 *
737 * The same rules apply, we just add 1 to base the computation
738 * on the "right border" of the dirty area.
739 */
740
741 col = area->tr_end.tp_col;
742 row = area->tr_end.tp_row;
743 x2 = (int)((col * vf->vf_width + vw->vw_offset.tp_col
744 + VT_VGA_PIXELS_BLOCK - 1)
745 / VT_VGA_PIXELS_BLOCK)
746 * VT_VGA_PIXELS_BLOCK;
747 y2 = row * vf->vf_height + vw->vw_offset.tp_row;
748
749 /*
750 * Clip the area to the screen size.
751 *
752 * FIXME: Take vw_offset into account.
753 */
754 x2 = min(x2, vd->vd_width - 1);
755 y2 = min(y2, vd->vd_height - 1);
756
757 /*
758 * Now, we take care of N pixels line at a time (the first for
759 * loop, N = font height), and for these lines, draw one pixels
760 * block at a time (the second for loop), not a character at a
761 * time.
762 *
763 * Therefore, on the X-axis, characters my be drawn partially if

--- 399 unchanged lines hidden ---