Changeset View
Changeset View
Standalone View
Standalone View
src/TerminalDisplay.cpp
Context not available. | |||||
619 | { | 619 | { | ||
---|---|---|---|---|---|
620 | //Calculate cell midpoints, end points. | 620 | //Calculate cell midpoints, end points. | ||
621 | const int cx = x + w / 2; | 621 | const int cx = x + w / 2; | ||
622 | const int cy = y + h / 2; | 622 | const int cy = y + h / 2. - 0.5; | ||
623 | const int ex = x + w - 1; | 623 | const int ex = x + w - 1; | ||
624 | const int ey = y + h - 1; | 624 | const int ey = y + h - 1; | ||
625 | 625 | | |||
Context not available. | |||||
671 | 671 | | |||
672 | //Intersection points. | 672 | //Intersection points. | ||
673 | if ((toDraw & Int11) != 0u) { | 673 | if ((toDraw & Int11) != 0u) { | ||
674 | paint.drawPoint(cx - 1, cy - 1); | 674 | paint.drawPoint(cx - 2, cy - 2); | ||
675 | } | 675 | } | ||
676 | if ((toDraw & Int12) != 0u) { | 676 | if ((toDraw & Int12) != 0u) { | ||
677 | paint.drawPoint(cx, cy - 1); | 677 | paint.drawPoint(cx - 1, cy - 2); | ||
678 | } | 678 | } | ||
679 | if ((toDraw & Int13) != 0u) { | 679 | if ((toDraw & Int13) != 0u) { | ||
680 | paint.drawPoint(cx + 1, cy - 1); | 680 | paint.drawPoint(cx - 0, cy - 2); | ||
681 | } | 681 | } | ||
682 | 682 | | |||
683 | if ((toDraw & Int21) != 0u) { | 683 | if ((toDraw & Int21) != 0u) { | ||
684 | paint.drawPoint(cx - 1, cy); | 684 | paint.drawPoint(cx - 2, cy - 1); | ||
685 | } | 685 | } | ||
686 | if ((toDraw & Int22) != 0u) { | 686 | if ((toDraw & Int22) != 0u) { | ||
687 | paint.drawPoint(cx, cy); | 687 | paint.drawPoint(cx - 1, cy - 1); | ||
688 | } | 688 | } | ||
689 | if ((toDraw & Int23) != 0u) { | 689 | if ((toDraw & Int23) != 0u) { | ||
690 | paint.drawPoint(cx + 1, cy); | 690 | paint.drawPoint(cx - 0, cy - 1); | ||
691 | } | 691 | } | ||
692 | 692 | | |||
693 | if ((toDraw & Int31) != 0u) { | 693 | if ((toDraw & Int31) != 0u) { | ||
694 | paint.drawPoint(cx - 1, cy + 1); | 694 | paint.drawPoint(cx - 2, cy); | ||
695 | } | 695 | } | ||
696 | if ((toDraw & Int32) != 0u) { | 696 | if ((toDraw & Int32) != 0u) { | ||
697 | paint.drawPoint(cx, cy + 1); | 697 | paint.drawPoint(cx - 1, cy); | ||
698 | } | 698 | } | ||
699 | if ((toDraw & Int33) != 0u) { | 699 | if ((toDraw & Int33) != 0u) { | ||
700 | paint.drawPoint(cx + 1, cy + 1); | 700 | paint.drawPoint(cx - 0, cy); | ||
701 | } | 701 | } | ||
702 | } | 702 | } | ||
703 | 703 | | |||
Context not available. | |||||
705 | { | 705 | { | ||
706 | //Calculate cell midpoints, end points. | 706 | //Calculate cell midpoints, end points. | ||
707 | const int cx = x + w / 2; | 707 | const int cx = x + w / 2; | ||
708 | const int cy = y + h / 2; | 708 | const int cy = y + h / 2. - 0.5; // Compensate for the translation, to match fonts | ||
709 | const int ex = x + w - 1; | 709 | const int ex = x + w - 1; | ||
710 | const int ey = y + h - 1; | 710 | const int ey = y + h - 1; | ||
711 | 711 | | |||
Context not available. | |||||
792 | const Character* attributes) | 792 | const Character* attributes) | ||
793 | { | 793 | { | ||
794 | painter.save(); | 794 | painter.save(); | ||
795 | painter.setRenderHint(QPainter::Antialiasing); | | |||
796 | 795 | | |||
797 | const QPen& originalPen = painter.pen(); | 796 | // For antialiasing, we need to shift it so the single pixel width is in the middle | ||
797 | painter.translate(0.5, 0.5); | ||||
798 | 798 | | |||
799 | if (((attributes->rendition & RE_BOLD) != 0) && _boldIntense) { | 799 | if (((attributes->rendition & RE_BOLD) != 0) && _boldIntense) { | ||
800 | QPen boldPen(originalPen); | 800 | QPen boldPen(painter.pen()); | ||
801 | boldPen.setWidth(3); | 801 | boldPen.setWidth(4); | ||
802 | painter.setPen(boldPen); | 802 | painter.setPen(boldPen); | ||
803 | } | 803 | } | ||
804 | 804 | | |||
805 | | ||||
805 | for (int i = 0 ; i < str.length(); i++) { | 806 | for (int i = 0 ; i < str.length(); i++) { | ||
806 | const uchar code = str[i].cell(); | 807 | const uchar code = str[i].cell(); | ||
807 | if (LineChars[code] != 0u) { | 808 | if (LineChars[code] != 0u) { | ||
Context not available. | |||||
909 | QColor color(backgroundColor); | 910 | QColor color(backgroundColor); | ||
910 | color.setAlpha(qAlpha(_blendColor)); | 911 | color.setAlpha(qAlpha(_blendColor)); | ||
911 | 912 | | |||
912 | painter.save(); | 913 | const QPainter::CompositionMode originalMode = painter.compositionMode(); | ||
913 | painter.setCompositionMode(QPainter::CompositionMode_Source); | 914 | painter.setCompositionMode(QPainter::CompositionMode_Source); | ||
914 | painter.fillRect(rect, color); | 915 | painter.fillRect(rect, color); | ||
915 | painter.restore(); | 916 | painter.setCompositionMode(originalMode); | ||
916 | #endif | 917 | #endif | ||
917 | } else { | 918 | } else { | ||
918 | painter.fillRect(rect, backgroundColor); | 919 | painter.fillRect(rect, backgroundColor); | ||
Context not available. | |||||
1041 | const QString& text, | 1042 | const QString& text, | ||
1042 | const Character* style) | 1043 | const Character* style) | ||
1043 | { | 1044 | { | ||
1044 | painter.save(); | | |||
1045 | | ||||
1046 | // setup painter | 1045 | // setup painter | ||
1047 | const QColor foregroundColor = style->foregroundColor.color(_colorTable); | 1046 | const QColor foregroundColor = style->foregroundColor.color(_colorTable); | ||
1048 | const QColor backgroundColor = style->backgroundColor.color(_colorTable); | 1047 | const QColor backgroundColor = style->backgroundColor.color(_colorTable); | ||
Context not available. | |||||
1062 | 1061 | | |||
1063 | // draw text | 1062 | // draw text | ||
1064 | drawCharacters(painter, rect, text, style, invertCharacterColor); | 1063 | drawCharacters(painter, rect, text, style, invertCharacterColor); | ||
1065 | | ||||
1066 | painter.restore(); | | |||
1067 | } | 1064 | } | ||
1068 | 1065 | | |||
1069 | void TerminalDisplay::drawPrinterFriendlyTextFragment(QPainter& painter, | 1066 | void TerminalDisplay::drawPrinterFriendlyTextFragment(QPainter& painter, | ||
Context not available. | |||||
1071 | const QString& text, | 1068 | const QString& text, | ||
1072 | const Character* style) | 1069 | const Character* style) | ||
1073 | { | 1070 | { | ||
1074 | painter.save(); | | |||
1075 | | ||||
1076 | // Set the colors used to draw to black foreground and white | 1071 | // Set the colors used to draw to black foreground and white | ||
1077 | // background for printer friendly output when printing | 1072 | // background for printer friendly output when printing | ||
1078 | Character print_style = *style; | 1073 | Character print_style = *style; | ||
Context not available. | |||||
1081 | 1076 | | |||
1082 | // draw text | 1077 | // draw text | ||
1083 | drawCharacters(painter, rect, text, &print_style, false); | 1078 | drawCharacters(painter, rect, text, &print_style, false); | ||
1084 | | ||||
1085 | painter.restore(); | | |||
1086 | } | 1079 | } | ||
1087 | 1080 | | |||
1088 | void TerminalDisplay::setRandomSeed(uint randomSeed) | 1081 | void TerminalDisplay::setRandomSeed(uint randomSeed) | ||
Context not available. | |||||
1499 | drawBackground(paint, rect, getBackgroundColor(), true /* use opacity setting */); | 1492 | drawBackground(paint, rect, getBackgroundColor(), true /* use opacity setting */); | ||
1500 | } | 1493 | } | ||
1501 | 1494 | | |||
1495 | paint.setRenderHint(QPainter::Antialiasing, _antialiasText); | ||||
1496 | | ||||
1502 | foreach(const QRect & rect, dirtyImageRegion.rects()) { | 1497 | foreach(const QRect & rect, dirtyImageRegion.rects()) { | ||
1503 | drawContents(paint, rect); | 1498 | drawContents(paint, rect); | ||
1504 | } | 1499 | } | ||
Context not available. |