diff options
| author | Po Lu | 2023-09-26 09:35:51 +0800 |
|---|---|---|
| committer | Po Lu | 2023-09-26 09:35:51 +0800 |
| commit | 719f8a51be64acce91aa638b3f065dae25ba23cf (patch) | |
| tree | 5eb9cd5144c5b39332273fe8181405fcdc740191 /src/androidterm.c | |
| parent | 50281b4007062533ca18f98deeac6b7d923d1922 (diff) | |
| download | emacs-719f8a51be64acce91aa638b3f065dae25ba23cf.tar.gz emacs-719f8a51be64acce91aa638b3f065dae25ba23cf.zip | |
Update Android port
* src/androidterm.c (android_clip_to_row)
(android_draw_fringe_bitmap, android_draw_hollow_cursor)
(android_draw_bar_cursor): Sync with xterm.c.
* src/xterm.c (x_draw_fringe_bitmap): Delete unused variables.
Diffstat (limited to 'src/androidterm.c')
| -rw-r--r-- | src/androidterm.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/src/androidterm.c b/src/androidterm.c index a60dd50e5db..8940baa286b 100644 --- a/src/androidterm.c +++ b/src/androidterm.c | |||
| @@ -2440,7 +2440,8 @@ android_reset_clip_rectangles (struct frame *f, struct android_gc *gc) | |||
| 2440 | 2440 | ||
| 2441 | static void | 2441 | static void |
| 2442 | android_clip_to_row (struct window *w, struct glyph_row *row, | 2442 | android_clip_to_row (struct window *w, struct glyph_row *row, |
| 2443 | enum glyph_row_area area, struct android_gc *gc) | 2443 | enum glyph_row_area area, struct android_gc *gc, |
| 2444 | struct android_rectangle *rect_return) | ||
| 2444 | { | 2445 | { |
| 2445 | struct android_rectangle clip_rect; | 2446 | struct android_rectangle clip_rect; |
| 2446 | int window_x, window_y, window_width; | 2447 | int window_x, window_y, window_width; |
| @@ -2454,6 +2455,9 @@ android_clip_to_row (struct window *w, struct glyph_row *row, | |||
| 2454 | clip_rect.height = row->visible_height; | 2455 | clip_rect.height = row->visible_height; |
| 2455 | 2456 | ||
| 2456 | android_set_clip_rectangles (gc, 0, 0, &clip_rect, 1); | 2457 | android_set_clip_rectangles (gc, 0, 0, &clip_rect, 1); |
| 2458 | |||
| 2459 | if (rect_return) | ||
| 2460 | *rect_return = clip_rect; | ||
| 2457 | } | 2461 | } |
| 2458 | 2462 | ||
| 2459 | static void | 2463 | static void |
| @@ -2463,9 +2467,10 @@ android_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2463 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 2467 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 2464 | struct android_gc *gc = f->output_data.android->normal_gc; | 2468 | struct android_gc *gc = f->output_data.android->normal_gc; |
| 2465 | struct face *face = p->face; | 2469 | struct face *face = p->face; |
| 2470 | struct android_rectangle clip_rect; | ||
| 2466 | 2471 | ||
| 2467 | /* Must clip because of partially visible lines. */ | 2472 | /* Must clip because of partially visible lines. */ |
| 2468 | android_clip_to_row (w, row, ANY_AREA, gc); | 2473 | android_clip_to_row (w, row, ANY_AREA, gc, &clip_rect); |
| 2469 | 2474 | ||
| 2470 | if (p->bx >= 0 && !p->overlay_p) | 2475 | if (p->bx >= 0 && !p->overlay_p) |
| 2471 | { | 2476 | { |
| @@ -2499,6 +2504,8 @@ android_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2499 | struct android_gc_values gcv; | 2504 | struct android_gc_values gcv; |
| 2500 | unsigned long background, cursor_pixel; | 2505 | unsigned long background, cursor_pixel; |
| 2501 | int depth; | 2506 | int depth; |
| 2507 | struct android_rectangle image_rect, dest; | ||
| 2508 | int px, py, pwidth, pheight; | ||
| 2502 | 2509 | ||
| 2503 | drawable = FRAME_ANDROID_DRAWABLE (f); | 2510 | drawable = FRAME_ANDROID_DRAWABLE (f); |
| 2504 | clipmask = ANDROID_NONE; | 2511 | clipmask = ANDROID_NONE; |
| @@ -2506,6 +2513,27 @@ android_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2506 | cursor_pixel = f->output_data.android->cursor_pixel; | 2513 | cursor_pixel = f->output_data.android->cursor_pixel; |
| 2507 | depth = FRAME_DISPLAY_INFO (f)->n_planes; | 2514 | depth = FRAME_DISPLAY_INFO (f)->n_planes; |
| 2508 | 2515 | ||
| 2516 | /* Intersect the destination rectangle with that of the row. | ||
| 2517 | Setting a clip mask overrides the clip rectangles provided by | ||
| 2518 | x_clip_to_row, so clipping must be performed by hand. */ | ||
| 2519 | |||
| 2520 | image_rect.x = p->x; | ||
| 2521 | image_rect.y = p->y; | ||
| 2522 | image_rect.width = p->wd; | ||
| 2523 | image_rect.height = p->h; | ||
| 2524 | |||
| 2525 | if (!gui_intersect_rectangles (&clip_rect, &image_rect, &dest)) | ||
| 2526 | /* The entire destination rectangle falls outside the row. */ | ||
| 2527 | goto undo_clip; | ||
| 2528 | |||
| 2529 | /* Extrapolate the source rectangle from the difference between | ||
| 2530 | the destination and image rectangles. */ | ||
| 2531 | |||
| 2532 | px = dest.x - image_rect.x; | ||
| 2533 | py = dest.y - image_rect.y; | ||
| 2534 | pwidth = dest.width; | ||
| 2535 | pheight = dest.height; | ||
| 2536 | |||
| 2509 | if (p->wd > 8) | 2537 | if (p->wd > 8) |
| 2510 | bits = (char *) (p->bits + p->dh); | 2538 | bits = (char *) (p->bits + p->dh); |
| 2511 | else | 2539 | else |
| @@ -2533,8 +2561,8 @@ android_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2533 | &gcv); | 2561 | &gcv); |
| 2534 | } | 2562 | } |
| 2535 | 2563 | ||
| 2536 | android_copy_area (pixmap, drawable, gc, 0, 0, p->wd, p->h, | 2564 | android_copy_area (pixmap, drawable, gc, px, py, |
| 2537 | p->x, p->y); | 2565 | pwidth, pheight, dest.x, dest.y); |
| 2538 | android_free_pixmap (pixmap); | 2566 | android_free_pixmap (pixmap); |
| 2539 | 2567 | ||
| 2540 | if (p->overlay_p) | 2568 | if (p->overlay_p) |
| @@ -4327,7 +4355,7 @@ android_draw_hollow_cursor (struct window *w, struct glyph_row *row) | |||
| 4327 | wd -= 1; | 4355 | wd -= 1; |
| 4328 | } | 4356 | } |
| 4329 | /* Set clipping, draw the rectangle, and reset clipping again. */ | 4357 | /* Set clipping, draw the rectangle, and reset clipping again. */ |
| 4330 | android_clip_to_row (w, row, TEXT_AREA, gc); | 4358 | android_clip_to_row (w, row, TEXT_AREA, gc, NULL); |
| 4331 | android_draw_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, x, y, wd, h - 1); | 4359 | android_draw_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, x, y, wd, h - 1); |
| 4332 | android_reset_clip_rectangles (f, gc); | 4360 | android_reset_clip_rectangles (f, gc); |
| 4333 | } | 4361 | } |
| @@ -4385,7 +4413,7 @@ android_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, | |||
| 4385 | FRAME_DISPLAY_INFO (f)->scratch_cursor_gc = gc; | 4413 | FRAME_DISPLAY_INFO (f)->scratch_cursor_gc = gc; |
| 4386 | } | 4414 | } |
| 4387 | 4415 | ||
| 4388 | android_clip_to_row (w, row, TEXT_AREA, gc); | 4416 | android_clip_to_row (w, row, TEXT_AREA, gc, NULL); |
| 4389 | 4417 | ||
| 4390 | if (kind == BAR_CURSOR) | 4418 | if (kind == BAR_CURSOR) |
| 4391 | { | 4419 | { |