aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Bargiacchi2016-09-07 18:38:24 -0500
committerandroid-build-merger2016-09-07 18:38:24 -0500
commit49e2aeb35346e59e4a7fa2aaf193ead309f3ba01 (patch)
tree3ccf544dd43ad2134efe11f3c7c4efd7c89900c4 /wear_ui.cpp
parentef674454a14049439f8cf455d6088418ebda8c5c (diff)
parent5e7cfb9af64d5f6bf616d9b6fa40bd0ae82e781a (diff)
downloadplatform-bootable-recovery-49e2aeb35346e59e4a7fa2aaf193ead309f3ba01.tar.gz
platform-bootable-recovery-49e2aeb35346e59e4a7fa2aaf193ead309f3ba01.tar.xz
platform-bootable-recovery-49e2aeb35346e59e4a7fa2aaf193ead309f3ba01.zip
Remove duplicate methods and variables from WearRecoveryUI
am: 5e7cfb9af6 Change-Id: I0f4dda0f92dcb6b3a230d2ad5d26f9855acb8c82
Diffstat (limited to 'wear_ui.cpp')
-rw-r--r--wear_ui.cpp313
1 files changed, 77 insertions, 236 deletions
diff --git a/wear_ui.cpp b/wear_ui.cpp
index 7ca879bc..e6937755 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -47,32 +47,13 @@ static double now() {
47} 47}
48 48
49WearRecoveryUI::WearRecoveryUI() : 49WearRecoveryUI::WearRecoveryUI() :
50 progress_bar_height(3),
51 progress_bar_width(200),
52 progress_bar_y(259), 50 progress_bar_y(259),
53 outer_height(0), 51 outer_height(0),
54 outer_width(0), 52 outer_width(0),
55 menu_unusable_rows(0), 53 menu_unusable_rows(0) {
56 intro_frames(22), 54 intro_frames = 22;
57 loop_frames(60), 55 loop_frames = 60;
58 animation_fps(30), 56 animation_fps = 30;
59 currentIcon(NONE),
60 intro_done(false),
61 current_frame(0),
62 progressBarType(EMPTY),
63 progressScopeStart(0),
64 progressScopeSize(0),
65 progress(0),
66 text_cols(0),
67 text_rows(0),
68 text_col(0),
69 text_row(0),
70 text_top(0),
71 show_text(false),
72 show_text_ever(false),
73 show_menu(false),
74 menu_items(0),
75 menu_sel(0) {
76 57
77 for (size_t i = 0; i < 5; i++) 58 for (size_t i = 0; i < 5; i++)
78 backgroundIcon[i] = NULL; 59 backgroundIcon[i] = NULL;
@@ -80,16 +61,22 @@ WearRecoveryUI::WearRecoveryUI() :
80 self = this; 61 self = this;
81} 62}
82 63
64int WearRecoveryUI::GetProgressBaseline() {
65 return progress_bar_y;
66}
67
83// Draw background frame on the screen. Does not flip pages. 68// Draw background frame on the screen. Does not flip pages.
84// Should only be called with updateMutex locked. 69// Should only be called with updateMutex locked.
85void WearRecoveryUI::draw_background_locked(Icon icon) 70// TODO merge drawing routines with screen_ui
71void WearRecoveryUI::draw_background_locked()
86{ 72{
73 pagesIdentical = false;
87 gr_color(0, 0, 0, 255); 74 gr_color(0, 0, 0, 255);
88 gr_fill(0, 0, gr_fb_width(), gr_fb_height()); 75 gr_fill(0, 0, gr_fb_width(), gr_fb_height());
89 76
90 if (icon) { 77 if (currentIcon != NONE) {
91 GRSurface* surface; 78 GRSurface* surface;
92 if (icon == INSTALLING_UPDATE || icon == ERASING) { 79 if (currentIcon == INSTALLING_UPDATE || currentIcon == ERASING) {
93 if (!intro_done) { 80 if (!intro_done) {
94 surface = introFrames[current_frame]; 81 surface = introFrames[current_frame];
95 } else { 82 } else {
@@ -97,7 +84,7 @@ void WearRecoveryUI::draw_background_locked(Icon icon)
97 } 84 }
98 } 85 }
99 else { 86 else {
100 surface = backgroundIcon[icon]; 87 surface = backgroundIcon[currentIcon];
101 } 88 }
102 89
103 int width = gr_get_width(surface); 90 int width = gr_get_width(surface);
@@ -110,36 +97,6 @@ void WearRecoveryUI::draw_background_locked(Icon icon)
110 } 97 }
111} 98}
112 99
113// Draw the progress bar (if any) on the screen. Does not flip pages.
114// Should only be called with updateMutex locked.
115void WearRecoveryUI::draw_progress_locked()
116{
117 if (currentIcon == ERROR) return;
118 if (progressBarType != DETERMINATE) return;
119
120 int width = progress_bar_width;
121 int height = progress_bar_height;
122 int dx = (gr_fb_width() - width)/2;
123 int dy = progress_bar_y;
124
125 float p = progressScopeStart + progress * progressScopeSize;
126 int pos = (int) (p * width);
127
128 gr_color(0x43, 0x43, 0x43, 0xff);
129 gr_fill(dx, dy, dx + width, dy + height);
130
131 if (pos > 0) {
132 gr_color(0x02, 0xa8, 0xf3, 255);
133 if (rtl_locale) {
134 // Fill the progress bar from right to left.
135 gr_fill(dx + width - pos, dy, dx + width, dy + height);
136 } else {
137 // Fill the progress bar from left to right.
138 gr_fill(dx, dy, dx + pos, dy + height);
139 }
140 }
141}
142
143static const char* HEADERS[] = { 100static const char* HEADERS[] = {
144 "Swipe up/down to move.", 101 "Swipe up/down to move.",
145 "Swipe left/right to select.", 102 "Swipe left/right to select.",
@@ -147,13 +104,15 @@ static const char* HEADERS[] = {
147 NULL 104 NULL
148}; 105};
149 106
107// TODO merge drawing routines with screen_ui
150void WearRecoveryUI::draw_screen_locked() 108void WearRecoveryUI::draw_screen_locked()
151{ 109{
152 draw_background_locked(currentIcon);
153 draw_progress_locked();
154 char cur_selection_str[50]; 110 char cur_selection_str[50];
155 111
156 if (show_text) { 112 draw_background_locked();
113 if (!show_text) {
114 draw_foreground_locked();
115 } else {
157 SetColor(TEXT_FILL); 116 SetColor(TEXT_FILL);
158 gr_fill(0, 0, gr_fb_width(), gr_fb_height()); 117 gr_fill(0, 0, gr_fb_width(), gr_fb_height());
159 118
@@ -192,10 +151,12 @@ void WearRecoveryUI::draw_screen_locked()
192 gr_fill(x, y-2, gr_fb_width()-x, y+char_height_+2); 151 gr_fill(x, y-2, gr_fb_width()-x, y+char_height_+2);
193 // white text of selected item 152 // white text of selected item
194 SetColor(MENU_SEL_FG); 153 SetColor(MENU_SEL_FG);
195 if (menu[i][0]) gr_text(gr_sys_font(), x+4, y, menu[i], 1); 154 if (menu_[i][0]) {
155 gr_text(gr_sys_font(), x + 4, y, menu_[i], 1);
156 }
196 SetColor(MENU); 157 SetColor(MENU);
197 } else if (menu[i][0]) { 158 } else if (menu_[i][0]) {
198 gr_text(gr_sys_font(), x+4, y, menu[i], 0); 159 gr_text(gr_sys_font(), x + 4, y, menu_[i], 0);
199 } 160 }
200 y += char_height_+4; 161 y += char_height_+4;
201 } 162 }
@@ -211,24 +172,18 @@ void WearRecoveryUI::draw_screen_locked()
211 // screen, the bottom of the menu, or we've displayed the 172 // screen, the bottom of the menu, or we've displayed the
212 // entire text buffer. 173 // entire text buffer.
213 int ty; 174 int ty;
214 int row = (text_top+text_rows-1) % text_rows; 175 int row = (text_top_ + text_rows_ - 1) % text_rows_;
215 size_t count = 0; 176 size_t count = 0;
216 for (int ty = gr_fb_height() - char_height_ - outer_height; 177 for (int ty = gr_fb_height() - char_height_ - outer_height;
217 ty > y+2 && count < text_rows; 178 ty > y + 2 && count < text_rows_;
218 ty -= char_height_, ++count) { 179 ty -= char_height_, ++count) {
219 gr_text(gr_sys_font(), x+4, ty, text[row], 0); 180 gr_text(gr_sys_font(), x+4, ty, text_[row], 0);
220 --row; 181 --row;
221 if (row < 0) row = text_rows-1; 182 if (row < 0) row = text_rows_ - 1;
222 } 183 }
223 } 184 }
224} 185}
225 186
226void WearRecoveryUI::update_screen_locked()
227{
228 draw_screen_locked();
229 gr_flip();
230}
231
232// Keeps the progress bar updated, even when the process is otherwise busy. 187// Keeps the progress bar updated, even when the process is otherwise busy.
233void* WearRecoveryUI::progress_thread(void *cookie) { 188void* WearRecoveryUI::progress_thread(void *cookie) {
234 self->progress_loop(); 189 self->progress_loop();
@@ -240,7 +195,7 @@ void WearRecoveryUI::progress_loop() {
240 for (;;) { 195 for (;;) {
241 double start = now(); 196 double start = now();
242 pthread_mutex_lock(&updateMutex); 197 pthread_mutex_lock(&updateMutex);
243 int redraw = 0; 198 bool redraw = false;
244 199
245 if ((currentIcon == INSTALLING_UPDATE || currentIcon == ERASING) 200 if ((currentIcon == INSTALLING_UPDATE || currentIcon == ERASING)
246 && !show_text) { 201 && !show_text) {
@@ -254,7 +209,7 @@ void WearRecoveryUI::progress_loop() {
254 } else { 209 } else {
255 current_frame = (current_frame + 1) % loop_frames; 210 current_frame = (current_frame + 1) % loop_frames;
256 } 211 }
257 redraw = 1; 212 redraw = true;
258 } 213 }
259 214
260 // move the progress bar forward on timed intervals, if configured 215 // move the progress bar forward on timed intervals, if configured
@@ -265,12 +220,11 @@ void WearRecoveryUI::progress_loop() {
265 if (p > 1.0) p = 1.0; 220 if (p > 1.0) p = 1.0;
266 if (p > progress) { 221 if (p > progress) {
267 progress = p; 222 progress = p;
268 redraw = 1; 223 redraw = true;
269 } 224 }
270 } 225 }
271 226
272 if (redraw) 227 if (redraw) update_screen_locked();
273 update_screen_locked();
274 228
275 pthread_mutex_unlock(&updateMutex); 229 pthread_mutex_unlock(&updateMutex);
276 double end = now(); 230 double end = now();
@@ -281,93 +235,27 @@ void WearRecoveryUI::progress_loop() {
281 } 235 }
282} 236}
283 237
284void WearRecoveryUI::Init() 238void WearRecoveryUI::InitTextParams() {
285{ 239 ScreenRecoveryUI::InitTextParams();
286 gr_init(); 240
241 text_cols_ = (gr_fb_width() - (outer_width * 2)) / char_width_;
287 242
288 gr_font_size(gr_sys_font(), &char_width_, &char_height_); 243 if (text_rows_ > kMaxRows) text_rows_ = kMaxRows;
244 if (text_cols_ > kMaxCols) text_cols_ = kMaxCols;
289 245
290 text_col = text_row = 0;
291 text_rows = (gr_fb_height()) / char_height_;
292 visible_text_rows = (gr_fb_height() - (outer_height * 2)) / char_height_; 246 visible_text_rows = (gr_fb_height() - (outer_height * 2)) / char_height_;
293 if (text_rows > kMaxRows) text_rows = kMaxRows; 247}
294 text_top = 1;
295 248
296 text_cols = (gr_fb_width() - (outer_width * 2)) / char_width_; 249void WearRecoveryUI::Init() {
297 if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1; 250 ScreenRecoveryUI::Init();
298 251
299 LoadBitmap("icon_installing", &backgroundIcon[INSTALLING_UPDATE]); 252 LoadBitmap("icon_installing", &backgroundIcon[INSTALLING_UPDATE]);
300 backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE]; 253 backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE];
301 LoadBitmap("icon_error", &backgroundIcon[ERROR]); 254 LoadBitmap("icon_error", &backgroundIcon[ERROR]);
302 backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR]; 255 backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR];
303 256
304 introFrames = (GRSurface**)malloc(intro_frames * sizeof(GRSurface*));
305 for (int i = 0; i < intro_frames; ++i) {
306 char filename[40];
307 sprintf(filename, "intro%02d", i);
308 LoadBitmap(filename, introFrames + i);
309 }
310
311 loopFrames = (GRSurface**)malloc(loop_frames * sizeof(GRSurface*));
312 for (int i = 0; i < loop_frames; ++i) {
313 char filename[40];
314 sprintf(filename, "loop%02d", i);
315 LoadBitmap(filename, loopFrames + i);
316 }
317
318 pthread_create(&progress_t, NULL, progress_thread, NULL); 257 pthread_create(&progress_t, NULL, progress_thread, NULL);
319 RecoveryUI::Init();
320}
321 258
322void WearRecoveryUI::SetBackground(Icon icon)
323{
324 pthread_mutex_lock(&updateMutex);
325 currentIcon = icon;
326 update_screen_locked();
327 pthread_mutex_unlock(&updateMutex);
328}
329
330void WearRecoveryUI::SetProgressType(ProgressType type)
331{
332 pthread_mutex_lock(&updateMutex);
333 if (progressBarType != type) {
334 progressBarType = type;
335 }
336 progressScopeStart = 0;
337 progressScopeSize = 0;
338 progress = 0;
339 update_screen_locked();
340 pthread_mutex_unlock(&updateMutex);
341}
342
343void WearRecoveryUI::ShowProgress(float portion, float seconds)
344{
345 pthread_mutex_lock(&updateMutex);
346 progressBarType = DETERMINATE;
347 progressScopeStart += progressScopeSize;
348 progressScopeSize = portion;
349 progressScopeTime = now();
350 progressScopeDuration = seconds;
351 progress = 0;
352 update_screen_locked();
353 pthread_mutex_unlock(&updateMutex);
354}
355
356void WearRecoveryUI::SetProgress(float fraction)
357{
358 pthread_mutex_lock(&updateMutex);
359 if (fraction < 0.0) fraction = 0.0;
360 if (fraction > 1.0) fraction = 1.0;
361 if (progressBarType == DETERMINATE && fraction > progress) {
362 // Skip updates that aren't visibly different.
363 int width = progress_bar_width;
364 float scale = width * progressScopeSize;
365 if ((int) (progress * scale) != (int) (fraction * scale)) {
366 progress = fraction;
367 update_screen_locked();
368 }
369 }
370 pthread_mutex_unlock(&updateMutex);
371} 259}
372 260
373void WearRecoveryUI::SetStage(int current, int max) 261void WearRecoveryUI::SetStage(int current, int max)
@@ -386,40 +274,40 @@ void WearRecoveryUI::Print(const char *fmt, ...)
386 274
387 // This can get called before ui_init(), so be careful. 275 // This can get called before ui_init(), so be careful.
388 pthread_mutex_lock(&updateMutex); 276 pthread_mutex_lock(&updateMutex);
389 if (text_rows > 0 && text_cols > 0) { 277 if (text_rows_ > 0 && text_cols_ > 0) {
390 char *ptr; 278 char *ptr;
391 for (ptr = buf; *ptr != '\0'; ++ptr) { 279 for (ptr = buf; *ptr != '\0'; ++ptr) {
392 if (*ptr == '\n' || text_col >= text_cols) { 280 if (*ptr == '\n' || text_col_ >= text_cols_) {
393 text[text_row][text_col] = '\0'; 281 text_[text_row_][text_col_] = '\0';
394 text_col = 0; 282 text_col_ = 0;
395 text_row = (text_row + 1) % text_rows; 283 text_row_ = (text_row_ + 1) % text_rows_;
396 if (text_row == text_top) text_top = (text_top + 1) % text_rows; 284 if (text_row_ == text_top_) text_top_ = (text_top_ + 1) % text_rows_;
397 } 285 }
398 if (*ptr != '\n') text[text_row][text_col++] = *ptr; 286 if (*ptr != '\n') text_[text_row_][text_col_++] = *ptr;
399 } 287 }
400 text[text_row][text_col] = '\0'; 288 text_[text_row_][text_col_] = '\0';
401 update_screen_locked(); 289 update_screen_locked();
402 } 290 }
403 pthread_mutex_unlock(&updateMutex); 291 pthread_mutex_unlock(&updateMutex);
404} 292}
405 293
406void WearRecoveryUI::StartMenu(const char* const * headers, const char* const * items, 294void WearRecoveryUI::StartMenu(const char* const * headers, const char* const * items,
407 int initial_selection) { 295 int initial_selection) {
408 pthread_mutex_lock(&updateMutex); 296 pthread_mutex_lock(&updateMutex);
409 if (text_rows > 0 && text_cols > 0) { 297 if (text_rows_ > 0 && text_cols_ > 0) {
410 menu_headers_ = headers; 298 menu_headers_ = headers;
411 size_t i = 0; 299 size_t i = 0;
412 // "i < text_rows" is removed from the loop termination condition, 300 // "i < text_rows_" is removed from the loop termination condition,
413 // which is different from the one in ScreenRecoveryUI::StartMenu(). 301 // which is different from the one in ScreenRecoveryUI::StartMenu().
414 // Because WearRecoveryUI supports scrollable menu, it's fine to have 302 // Because WearRecoveryUI supports scrollable menu, it's fine to have
415 // more entries than text_rows. The menu may be truncated otherwise. 303 // more entries than text_rows_. The menu may be truncated otherwise.
416 // Bug: 23752519 304 // Bug: 23752519
417 for (; items[i] != nullptr; i++) { 305 for (; items[i] != nullptr; i++) {
418 strncpy(menu[i], items[i], text_cols - 1); 306 strncpy(menu_[i], items[i], text_cols_ - 1);
419 menu[i][text_cols - 1] = '\0'; 307 menu_[i][text_cols_ - 1] = '\0';
420 } 308 }
421 menu_items = i; 309 menu_items = i;
422 show_menu = 1; 310 show_menu = true;
423 menu_sel = initial_selection; 311 menu_sel = initial_selection;
424 menu_start = 0; 312 menu_start = 0;
425 menu_end = visible_text_rows - 1 - menu_unusable_rows; 313 menu_end = visible_text_rows - 1 - menu_unusable_rows;
@@ -433,7 +321,7 @@ void WearRecoveryUI::StartMenu(const char* const * headers, const char* const *
433int WearRecoveryUI::SelectMenu(int sel) { 321int WearRecoveryUI::SelectMenu(int sel) {
434 int old_sel; 322 int old_sel;
435 pthread_mutex_lock(&updateMutex); 323 pthread_mutex_lock(&updateMutex);
436 if (show_menu > 0) { 324 if (show_menu) {
437 old_sel = menu_sel; 325 old_sel = menu_sel;
438 menu_sel = sel; 326 menu_sel = sel;
439 if (menu_sel < 0) menu_sel = 0; 327 if (menu_sel < 0) menu_sel = 0;
@@ -452,53 +340,6 @@ int WearRecoveryUI::SelectMenu(int sel) {
452 return sel; 340 return sel;
453} 341}
454 342
455void WearRecoveryUI::EndMenu() {
456 int i;
457 pthread_mutex_lock(&updateMutex);
458 if (show_menu > 0 && text_rows > 0 && text_cols > 0) {
459 show_menu = 0;
460 update_screen_locked();
461 }
462 pthread_mutex_unlock(&updateMutex);
463}
464
465bool WearRecoveryUI::IsTextVisible()
466{
467 pthread_mutex_lock(&updateMutex);
468 int visible = show_text;
469 pthread_mutex_unlock(&updateMutex);
470 return visible;
471}
472
473bool WearRecoveryUI::WasTextEverVisible()
474{
475 pthread_mutex_lock(&updateMutex);
476 int ever_visible = show_text_ever;
477 pthread_mutex_unlock(&updateMutex);
478 return ever_visible;
479}
480
481void WearRecoveryUI::ShowText(bool visible)
482{
483 pthread_mutex_lock(&updateMutex);
484 // Don't show text during ota install or factory reset
485 if (currentIcon == INSTALLING_UPDATE || currentIcon == ERASING) {
486 pthread_mutex_unlock(&updateMutex);
487 return;
488 }
489 show_text = visible;
490 if (show_text) show_text_ever = 1;
491 update_screen_locked();
492 pthread_mutex_unlock(&updateMutex);
493}
494
495void WearRecoveryUI::Redraw()
496{
497 pthread_mutex_lock(&updateMutex);
498 update_screen_locked();
499 pthread_mutex_unlock(&updateMutex);
500}
501
502void WearRecoveryUI::ShowFile(FILE* fp) { 343void WearRecoveryUI::ShowFile(FILE* fp) {
503 std::vector<off_t> offsets; 344 std::vector<off_t> offsets;
504 offsets.push_back(ftello(fp)); 345 offsets.push_back(ftello(fp));
@@ -538,12 +379,12 @@ void WearRecoveryUI::ShowFile(FILE* fp) {
538 379
539 int ch = getc(fp); 380 int ch = getc(fp);
540 if (ch == EOF) { 381 if (ch == EOF) {
541 text_row = text_top = text_rows - 2; 382 text_row_ = text_top_ = text_rows_ - 2;
542 show_prompt = true; 383 show_prompt = true;
543 } else { 384 } else {
544 PutChar(ch); 385 PutChar(ch);
545 if (text_col == 0 && text_row >= text_rows - 2) { 386 if (text_col_ == 0 && text_row_ >= text_rows_ - 2) {
546 text_top = text_row; 387 text_top_ = text_row_;
547 show_prompt = true; 388 show_prompt = true;
548 } 389 }
549 } 390 }
@@ -552,10 +393,10 @@ void WearRecoveryUI::ShowFile(FILE* fp) {
552 393
553void WearRecoveryUI::PutChar(char ch) { 394void WearRecoveryUI::PutChar(char ch) {
554 pthread_mutex_lock(&updateMutex); 395 pthread_mutex_lock(&updateMutex);
555 if (ch != '\n') text[text_row][text_col++] = ch; 396 if (ch != '\n') text_[text_row_][text_col_++] = ch;
556 if (ch == '\n' || text_col >= text_cols) { 397 if (ch == '\n' || text_col_ >= text_cols_) {
557 text_col = 0; 398 text_col_ = 0;
558 ++text_row; 399 ++text_row_;
559 } 400 }
560 pthread_mutex_unlock(&updateMutex); 401 pthread_mutex_unlock(&updateMutex);
561} 402}
@@ -572,11 +413,11 @@ void WearRecoveryUI::ShowFile(const char* filename) {
572 413
573void WearRecoveryUI::ClearText() { 414void WearRecoveryUI::ClearText() {
574 pthread_mutex_lock(&updateMutex); 415 pthread_mutex_lock(&updateMutex);
575 text_col = 0; 416 text_col_ = 0;
576 text_row = 0; 417 text_row_ = 0;
577 text_top = 1; 418 text_top_ = 1;
578 for (size_t i = 0; i < text_rows; ++i) { 419 for (size_t i = 0; i < text_rows_; ++i) {
579 memset(text[i], 0, text_cols + 1); 420 memset(text_[i], 0, text_cols_ + 1);
580 } 421 }
581 pthread_mutex_unlock(&updateMutex); 422 pthread_mutex_unlock(&updateMutex);
582} 423}
@@ -597,17 +438,17 @@ void WearRecoveryUI::PrintV(const char* fmt, bool copy_to_stdout, va_list ap) {
597 } 438 }
598 439
599 pthread_mutex_lock(&updateMutex); 440 pthread_mutex_lock(&updateMutex);
600 if (text_rows > 0 && text_cols > 0) { 441 if (text_rows_ > 0 && text_cols_ > 0) {
601 for (const char* ptr = str.c_str(); *ptr != '\0'; ++ptr) { 442 for (const char* ptr = str.c_str(); *ptr != '\0'; ++ptr) {
602 if (*ptr == '\n' || text_col >= text_cols) { 443 if (*ptr == '\n' || text_col_ >= text_cols_) {
603 text[text_row][text_col] = '\0'; 444 text_[text_row_][text_col_] = '\0';
604 text_col = 0; 445 text_col_ = 0;
605 text_row = (text_row + 1) % text_rows; 446 text_row_ = (text_row_ + 1) % text_rows_;
606 if (text_row == text_top) text_top = (text_top + 1) % text_rows; 447 if (text_row_ == text_top_) text_top_ = (text_top_ + 1) % text_rows_;
607 } 448 }
608 if (*ptr != '\n') text[text_row][text_col++] = *ptr; 449 if (*ptr != '\n') text_[text_row_][text_col_++] = *ptr;
609 } 450 }
610 text[text_row][text_col] = '\0'; 451 text_[text_row_][text_col_] = '\0';
611 update_screen_locked(); 452 update_screen_locked();
612 } 453 }
613 pthread_mutex_unlock(&updateMutex); 454 pthread_mutex_unlock(&updateMutex);