• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision7501 (tree)
Time2019-03-18 23:24:35
Authorzmatsuo

Log Message

高速化テスト(Ttssh2-devel 3598)

Change Summary

Incremental Difference

--- branches/speedup_parse_draw/teraterm/teraterm/buffer.c (revision 7500)
+++ branches/speedup_parse_draw/teraterm/teraterm/buffer.c (revision 7501)
@@ -88,7 +88,7 @@
8888 static BOOL BoxSelect;
8989 static POINT DblClkStart, DblClkEnd;
9090
91-static int StrChangeStart, StrChangeCount;
91+int StrChangeStart, StrChangeCount;
9292
9393 static BOOL SeveralPageSelect; // add (2005.5.15 yutaka)
9494
@@ -1900,6 +1900,7 @@
19001900 StrChangeStart = CursorX;
19011901 }
19021902 StrChangeCount++;
1903+ UpdateStr();
19031904 }
19041905 }
19051906
@@ -2024,7 +2025,7 @@
20242025 }
20252026 }
20262027
2027-void BuffUpdateRect
2028+void BuffUpdateRect2
20282029 (int XStart, int YStart, int XEnd, int YEnd)
20292030 // Display text in a rectangular region in the screen
20302031 // XStart: x position of the upper-left corner (screen cordinate)
@@ -2121,6 +2122,7 @@
21212122 }
21222123 }
21232124
2125+#if 0
21242126 void UpdateStr()
21252127 // Display not-yet-displayed string
21262128 {
@@ -2175,6 +2177,7 @@
21752177
21762178 StrChangeCount = 0;
21772179 }
2180+#endif
21782181
21792182 #if 0
21802183 void UpdateStrUnicode(void)
--- branches/speedup_parse_draw/teraterm/teraterm/teraterm.cpp (revision 7500)
+++ branches/speedup_parse_draw/teraterm/teraterm/teraterm.cpp (revision 7501)
@@ -47,6 +47,7 @@
4747 #include "keyboard.h"
4848 #include "dllutil.h"
4949 #include "compat_win.h"
50+#include "vtdisp_delay.h"
5051
5152 #include "teraapp.h"
5253
@@ -302,6 +303,12 @@
302303 Busy--;
303304 }
304305
306+ if (Busy == 0) {
307+ if (IsUpdateTerm()) {
308+ Busy++;
309+ }
310+ }
311+
305312 return (Busy>0);
306313 }
307314
--- branches/speedup_parse_draw/teraterm/teraterm/vtdisp.c (revision 7500)
+++ branches/speedup_parse_draw/teraterm/teraterm/vtdisp.c (revision 7501)
@@ -80,7 +80,7 @@
8080 {168,168,168}, {178,178,178}, {188,188,188}, {198,198,198}, {208,208,208}, {218,218,218}, {228,228,228}, {238,238,238} // 248 - 255
8181 };
8282
83-int WinWidth, WinHeight;
83+int WinWidth, WinHeight; // 画面に表示されている文字数
8484 static BOOL Active = FALSE;
8585 static BOOL CompletelyVisible;
8686 HFONT VTFont[AttrFontMask+1];
@@ -95,10 +95,12 @@
9595 RECT VirtualScreen;
9696
9797 // --- scrolling status flags
98-int WinOrgX, WinOrgY, NewOrgX, NewOrgY;
98+int WinOrgX, WinOrgY; // 現在の表示位置
99+int NewOrgX, NewOrgY; // 更新後の表示位置
100+int ScrollBarVPos; // スクロールバーの位置
99101
100-int NumOfLines, NumOfColumns;
101-int PageStart, BuffEnd;
102+int NumOfLines, NumOfColumns; // バッファリングしている文字数
103+int PageStart, BuffEnd; // 表示しているバッファ内の位置
102104
103105 static BOOL CursorOnDBCS = FALSE;
104106 static LOGFONT VTlf;
@@ -130,7 +132,7 @@
130132
131133 // scrolling
132134 static int ScrollCount = 0;
133-static int dScroll = 0;
135+int dScroll = 0;
134136 static int SRegionTop;
135137 static int SRegionBottom;
136138
@@ -3179,6 +3181,7 @@
31793181 if (ScrollCount>=ts.ScrollThreshold) DispUpdateScroll();
31803182 }
31813183
3184+#if 0
31823185 void DispUpdateScroll()
31833186 {
31843187 int d;
@@ -3284,6 +3287,7 @@
32843287
32853288 if (IsCaretOn()) CaretOn();
32863289 }
3290+#endif
32873291
32883292 void DispScrollHomePos()
32893293 {
--- branches/speedup_parse_draw/teraterm/teraterm/vtdisp_delay.c (nonexistent)
+++ branches/speedup_parse_draw/teraterm/teraterm/vtdisp_delay.c (revision 7501)
@@ -0,0 +1,183 @@
1+/* Tera Term 高速化テスト */
2+
3+#include <windows.h>
4+#include <time.h>
5+#include <stdio.h>
6+
7+#include "tttypes.h"
8+#include "ttwinman.h"
9+#include "ttlib.h"
10+#include "vtdisp.h"
11+#include "vtdisp_delay.h"
12+
13+// buffer.c
14+extern int StrChangeStart, StrChangeCount;
15+extern int dScroll;
16+
17+#define DISPLAY_INTERVAL (1000 / 30) // (ms)
18+//#define DISPLAY_INTERVAL (1000) // (ms)
19+
20+#define OutputDebugPrintf(...)
21+
22+void BuffUpdateRect2(int XStart, int YStart, int XEnd, int YEnd);
23+
24+////////////////////////////////////////
25+
26+typedef struct {
27+ enum {
28+ NONE, // 描画なし
29+ ONE_LINE, // 1行描画
30+ WHOLE_TERM, // 全画面描画
31+ } Type;
32+
33+ // ONE_LINE時のデータ
34+ int StrChangeStart; // cursorのX
35+ int CursorY; // cursorのY
36+ int StrChangeCount; // 文字数
37+
38+ // 表示開始位置
39+ int NewOrgX;
40+ int NewOrgY;
41+
42+ DWORD UpdateTick;
43+
44+ // scroll bar情報
45+ int ScrollBarVPos;
46+} UpdateInfo_t;
47+
48+static UpdateInfo_t UpdateInfo;
49+
50+void UpdateStr()
51+{
52+ if (UpdateInfo.Type == NONE) {
53+ if (StrChangeCount != 0) {
54+ UpdateInfo.Type = ONE_LINE;
55+ UpdateInfo.CursorY = CursorY;
56+ UpdateInfo.StrChangeStart = StrChangeStart;
57+ UpdateInfo.StrChangeCount = StrChangeCount;
58+ }
59+ } else if (UpdateInfo.Type == ONE_LINE) {
60+ if (StrChangeCount == 0) {
61+ ;
62+ } else if (UpdateInfo.CursorY != CursorY) {
63+ UpdateInfo.Type = WHOLE_TERM;
64+ } else if (UpdateInfo.StrChangeStart + UpdateInfo.StrChangeCount == StrChangeStart ) {
65+ UpdateInfo.StrChangeCount += StrChangeCount;
66+ } else {
67+ UpdateInfo.StrChangeStart = 0;
68+ UpdateInfo.StrChangeCount = NumOfColumns;
69+ }
70+ }
71+
72+ OutputDebugPrintf("%d (%d,%d)%d , (%d,%d)%d\n",
73+ UpdateInfo.Type,
74+ StrChangeStart, CursorY, StrChangeCount,
75+ UpdateInfo.StrChangeStart, UpdateInfo.CursorY, UpdateInfo.StrChangeCount);
76+
77+ StrChangeCount = 0;
78+}
79+
80+void BuffUpdateRect(int XStart, int YStart, int XEnd, int YEnd)
81+{
82+ OutputDebugPrintf("BuffUpdateRect(%d,%d,%d,%d)\n",
83+ XStart, YStart, XEnd, YEnd);
84+ UpdateInfo.Type = WHOLE_TERM;
85+}
86+
87+void DispUpdateScroll()
88+{
89+ OutputDebugPrintf("DispUpdateScroll\n");
90+ UpdateInfo.Type = WHOLE_TERM;
91+ UpdateInfo.NewOrgX += NewOrgX;
92+ UpdateInfo.NewOrgY += NewOrgY;
93+ dScroll = 0;
94+}
95+
96+void UpdateTerm()
97+{
98+ DWORD now = timeGetTime();
99+ int NewOrgX;
100+ int NewOrgY;
101+ int ScrollBarUpdated = 0;
102+ OutputDebugPrintf("UpdateTerm %d\n", UpdateInfo.Type);
103+
104+ if (UpdateInfo.Type == NONE) {
105+ return;
106+ }
107+
108+ NewOrgX = UpdateInfo.NewOrgX;
109+ NewOrgY = UpdateInfo.NewOrgY;
110+
111+ /* Update normal scroll */
112+ if (NewOrgX < 0) NewOrgX = 0;
113+ if (NewOrgX > NumOfColumns - WinWidth)
114+ NewOrgX = NumOfColumns - WinWidth;
115+ if (NewOrgY < -PageStart)
116+ NewOrgY = -PageStart;
117+ if (NewOrgY > BuffEnd - WinHeight - PageStart)
118+ NewOrgY = BuffEnd - WinHeight - PageStart;
119+
120+ if (NewOrgX != WinOrgX) {
121+ SetScrollPos(HVTWin, SB_HORZ, NewOrgX, TRUE);
122+ ScrollBarUpdated = 1;
123+ }
124+
125+ if (((ts.AutoScrollOnlyInBottomLine != 0 || NewOrgY!=WinOrgY)) &&
126+ (UpdateInfo.ScrollBarVPos != NewOrgY + PageStart))
127+ {
128+ SCROLLINFO scroll_info;
129+ scroll_info.cbSize = sizeof(scroll_info);
130+ scroll_info.fMask = SIF_PAGE | SIF_RANGE | SIF_POS;
131+ scroll_info.nPage = WinHeight;
132+ scroll_info.nMin = 0;
133+ scroll_info.nMax = BuffEnd-WinHeight;
134+
135+ if ((BuffEnd==WinHeight) && (ts.EnableScrollBuff>0)) {
136+ scroll_info.nMax = BuffEnd;
137+ scroll_info.nPos = 0;
138+ } else {
139+ int max = BuffEnd - WinHeight;
140+ scroll_info.nMax = BuffEnd;
141+ scroll_info.nPos = NewOrgY+PageStart;
142+ }
143+
144+ SetScrollInfo(HVTWin, SB_VERT, &scroll_info, TRUE);
145+ UpdateInfo.ScrollBarVPos = scroll_info.nPos;
146+ ScrollBarUpdated = 1;
147+ OutputDebugPrintf("sb_vert %d-%d-%d,%d\n",
148+ scroll_info.nMin,
149+ scroll_info.nPos,
150+ scroll_info.nMax,
151+ scroll_info.nPage);
152+ }
153+
154+#if 0
155+ if (ScrollBarUpdated) {
156+ // スクロールバーが更新された場合はすぐに描画する
157+ InvalidateRect(HVTWin, NULL, FALSE);
158+ } else
159+#endif
160+ if (UpdateInfo.Type == WHOLE_TERM) {
161+ if ((now - UpdateInfo.UpdateTick) < DISPLAY_INTERVAL) {
162+ return;
163+ }
164+ InvalidateRect(HVTWin, NULL, FALSE);
165+ } else if (UpdateInfo.Type == ONE_LINE) {
166+ BuffUpdateRect2(UpdateInfo.StrChangeStart, UpdateInfo.CursorY,
167+ UpdateInfo.StrChangeStart + UpdateInfo.StrChangeCount, UpdateInfo.CursorY);
168+ }
169+
170+ WinOrgX = NewOrgX;
171+ WinOrgY = NewOrgY;
172+ UpdateInfo.UpdateTick = now;
173+ UpdateInfo.Type = NONE;
174+
175+}
176+
177+int IsUpdateTerm()
178+{
179+ if (UpdateInfo.Type == NONE) {
180+ return 0;
181+ }
182+ return 1;
183+}
--- branches/speedup_parse_draw/teraterm/teraterm/vtdisp_delay.h (nonexistent)
+++ branches/speedup_parse_draw/teraterm/teraterm/vtdisp_delay.h (revision 7501)
@@ -0,0 +1,10 @@
1+#ifdef __cplusplus
2+extern "C" {
3+#endif
4+
5+int IsUpdateTerm();
6+void UpdateTerm();
7+
8+#ifdef __cplusplus
9+}
10+#endif
--- branches/speedup_parse_draw/teraterm/teraterm/vtterm.c (revision 7500)
+++ branches/speedup_parse_draw/teraterm/teraterm/vtterm.c (revision 7501)
@@ -54,6 +54,8 @@
5454 #include "clipboar.h"
5555 #include "codeconv.h"
5656
57+#include "vtdisp_delay.h"
58+
5759 #include "vtterm.h"
5860
5961 #ifdef _DEBUG
@@ -5748,7 +5750,12 @@
57485750
57495751 c = CommRead1Byte(&cv,&b);
57505752
5751- if (c==0) return 0;
5753+ if (c==0) {
5754+ if (IsUpdateTerm()) {
5755+ UpdateTerm();
5756+ }
5757+ return 0;
5758+ }
57525759
57535760 CaretOff();
57545761 UpdateCaretPosition(FALSE); // 非アクティブの場合のみ再描画する
@@ -5807,7 +5814,9 @@
58075814 c = CommRead1Byte(&cv,&b);
58085815 }
58095816
5810- BuffUpdateScroll();
5817+ if (IsUpdateTerm()) {
5818+ UpdateTerm();
5819+ }
58115820
58125821 BuffSetCaretWidth();
58135822 UnlockBuffer();
--- branches/speedup_parse_draw/teraterm/teraterm/vtwin.cpp (revision 7500)
+++ branches/speedup_parse_draw/teraterm/teraterm/vtwin.cpp (revision 7501)
@@ -94,6 +94,8 @@
9494 static char THIS_FILE[] = __FILE__;
9595 #endif
9696
97+extern "C" void BuffUpdateRect2(int XStart, int YStart, int XEnd, int YEnd);
98+
9799 // ウィンドウ最大化ボタンを有効にする (2005.1.15 yutaka)
98100 #define WINDOW_MAXMIMUM_ENABLED 1
99101
@@ -2655,7 +2657,7 @@
26552657
26562658 PaintWindow(PaintDC,ps.rcPaint,ps.fErase, &Xs,&Ys,&Xe,&Ye);
26572659 LockBuffer();
2658- BuffUpdateRect(Xs,Ys,Xe,Ye);
2660+ BuffUpdateRect2(Xs,Ys,Xe,Ye);
26592661 UnlockBuffer();
26602662 DispEndPaint();
26612663
Show on old repository browser