diff options
| author | Po Lu | 2024-06-20 17:03:36 +0800 |
|---|---|---|
| committer | Po Lu | 2024-06-20 17:03:36 +0800 |
| commit | cebca072c33937b84995a62c35c16441d23bb86d (patch) | |
| tree | e1bf28f6453a63a4d0eafa4757e4f65230e2338f /src/androidfns.c | |
| parent | 374f4235d5e78def23d92b05f3d0257c1f609725 (diff) | |
| download | emacs-cebca072c33937b84995a62c35c16441d23bb86d.tar.gz emacs-cebca072c33937b84995a62c35c16441d23bb86d.zip | |
Correctly cache images when frames vary in their font metrics
* src/alloc.c (mark_frame): Mark this frame's image cache, if it
exist.
(mark_terminals): Cease marking T->image_cache.
* src/androidfns.c (unwind_create_frame, Fx_create_frame)
(android_create_tip_frame):
* src/haikufns.c (unwind_create_frame, haiku_create_frame)
(haiku_create_tip_frame):
* src/nsfns.m (unwind_create_frame):
* src/pgtkfns.c (unwind_create_frame, Fx_create_frame)
(x_create_tip_frame):
* src/xfns.c (unwind_create_frame, Fx_create_frame)
(x_create_tip_frame):
* src/w32fns.c (unwind_create_frame, Fx_create_frame)
(w32_create_tip_frame): Remove adjustments of the frame image
cache's reference count rendered redundant by the assignment of
image caches to individual frames rather than terminals.
* src/dispextern.h (struct image_cache) <scaling_col_width>: New
field.
* src/frame.c (gui_set_font): In lieu of clearing F's image
cache unconditionally, establish whether the column width as
considered by compute_image_size has changed, and if so, adjust
or reassign the frame's image cache.
(make_frame): Clear F->image_cache.
* src/frame.h (struct frame) <image_cache>: New field.
(FRAME_IMAGE_CACHE): Return F->image_cache.
* src/image.c (make_image_cache): Clear C->scaling_col_width.
(cache_image): Adjust to new means of assigning image caches to
frames.
* src/termhooks.h (struct terminal) <image_cache>: Delete field.
* src/xfaces.c (init_frame_faces): Do image cache assignment
with all new frames.
Diffstat (limited to 'src/androidfns.c')
| -rw-r--r-- | src/androidfns.c | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/src/androidfns.c b/src/androidfns.c index 84558350dc0..7595e176618 100644 --- a/src/androidfns.c +++ b/src/androidfns.c | |||
| @@ -32,9 +32,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 32 | 32 | ||
| 33 | #ifndef ANDROID_STUBIFY | 33 | #ifndef ANDROID_STUBIFY |
| 34 | 34 | ||
| 35 | /* Some kind of reference count for the image cache. */ | ||
| 36 | static ptrdiff_t image_cache_refcount; | ||
| 37 | |||
| 38 | /* The frame of the currently visible tooltip, or nil if none. */ | 35 | /* The frame of the currently visible tooltip, or nil if none. */ |
| 39 | static Lisp_Object tip_frame; | 36 | static Lisp_Object tip_frame; |
| 40 | 37 | ||
| @@ -654,17 +651,6 @@ unwind_create_frame (Lisp_Object frame) | |||
| 654 | /* If frame is ``official'', nothing to do. */ | 651 | /* If frame is ``official'', nothing to do. */ |
| 655 | if (NILP (Fmemq (frame, Vframe_list))) | 652 | if (NILP (Fmemq (frame, Vframe_list))) |
| 656 | { | 653 | { |
| 657 | /* If the frame's image cache refcount is still the same as our | ||
| 658 | private shadow variable, it means we are unwinding a frame | ||
| 659 | for which we didn't yet call init_frame_faces, where the | ||
| 660 | refcount is incremented. Therefore, we increment it here, so | ||
| 661 | that free_frame_faces, called in x_free_frame_resources | ||
| 662 | below, will not mistakenly decrement the counter that was not | ||
| 663 | incremented yet to account for this new frame. */ | ||
| 664 | if (FRAME_IMAGE_CACHE (f) != NULL | ||
| 665 | && FRAME_IMAGE_CACHE (f)->refcount == image_cache_refcount) | ||
| 666 | FRAME_IMAGE_CACHE (f)->refcount++; | ||
| 667 | |||
| 668 | android_free_frame_resources (f); | 654 | android_free_frame_resources (f); |
| 669 | free_glyphs (f); | 655 | free_glyphs (f); |
| 670 | return Qt; | 656 | return Qt; |
| @@ -944,10 +930,6 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | |||
| 944 | register_font_driver (&androidfont_driver, f); | 930 | register_font_driver (&androidfont_driver, f); |
| 945 | register_font_driver (&android_sfntfont_driver, f); | 931 | register_font_driver (&android_sfntfont_driver, f); |
| 946 | 932 | ||
| 947 | image_cache_refcount = (FRAME_IMAGE_CACHE (f) | ||
| 948 | ? FRAME_IMAGE_CACHE (f)->refcount | ||
| 949 | : 0); | ||
| 950 | |||
| 951 | gui_default_parameter (f, parms, Qfont_backend, Qnil, | 933 | gui_default_parameter (f, parms, Qfont_backend, Qnil, |
| 952 | "fontBackend", "FontBackend", RES_TYPE_STRING); | 934 | "fontBackend", "FontBackend", RES_TYPE_STRING); |
| 953 | 935 | ||
| @@ -2023,9 +2005,6 @@ android_create_tip_frame (struct android_display_info *dpyinfo, | |||
| 2023 | register_font_driver (&androidfont_driver, f); | 2005 | register_font_driver (&androidfont_driver, f); |
| 2024 | register_font_driver (&android_sfntfont_driver, f); | 2006 | register_font_driver (&android_sfntfont_driver, f); |
| 2025 | 2007 | ||
| 2026 | image_cache_refcount | ||
| 2027 | = FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0; | ||
| 2028 | |||
| 2029 | gui_default_parameter (f, parms, Qfont_backend, Qnil, | 2008 | gui_default_parameter (f, parms, Qfont_backend, Qnil, |
| 2030 | "fontBackend", "FontBackend", RES_TYPE_STRING); | 2009 | "fontBackend", "FontBackend", RES_TYPE_STRING); |
| 2031 | 2010 | ||