Commit 53f3d1f9 authored by Alan Third's avatar Alan Third Committed by Alan Third

Draw to offscreen buffer on macOS

* src/nsfns.m (x_set_background_color): Clear the frame after changing
the background color, not before.
* src/nsterm.h (drawingBuffer): New variable.
([EmacsView focusOnDrawingBuffer]):
([EmacsView copyRect:to:]):
([EmacsView createDrawingBufferWithRect:]): New methods.
* src/nsterm.m (ns_update_begin):
(ns_update_end):
(ns_focus):
(ns_unfocus): Handle drawing to offscreen buffer.
(ns_clip_to_row): Use ns_row_rect.
(ns_copy_bits): Remove unused function.
(ns_scroll_run):
(ns_shift_glyphs_for_insert): Use new scrolling method.
(ns_draw_fringe_bitmap):
(ns_dumpglyphs_image): When drawing to the offscreen buffer, flip
images so they appear the right way up.
(ns_dumpglyphs_stretch): Remove unnecessary code.
(ns_draw_window_cursor): Don't disable screen updates.
([EmacsView updateFrameSize:]): Update the size of the offscreen
buffer.
([EmacsView initFrameFromEmacs:]): Create offscreen buffer.
([EmacsView windowDidChangeBackingProperties:]):
([EmacsView createDrawingBufferWithRect:]):
([EmacsView focusOnDrawingBuffer]):
([EmacsView copyRect]): New methods.
([EmacsView viewWillDraw]): Remove method as it no longer does
anything useful.
([EmacsView drawRect:]): Handle drawing from offscreen buffer.
parent f0128667
Pipeline #4435 failed with stage
in 57 minutes and 15 seconds
......@@ -287,12 +287,6 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side.
error ("Unknown color");
}
/* Clear the frame; in some instances the NS-internal GC appears not
to update, or it does update and cannot clear old text
properly. */
if (FRAME_VISIBLE_P (f))
ns_clear_frame (f);
[col retain];
[f->output_data.ns->background_color release];
f->output_data.ns->background_color = col;
......@@ -324,7 +318,10 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side.
}
if (FRAME_VISIBLE_P (f))
SET_FRAME_GARBAGED (f);
{
SET_FRAME_GARBAGED (f);
ns_clear_frame (f);
}
}
unblock_input ();
}
......
......@@ -417,6 +417,9 @@ typedef id instancetype;
int maximized_width, maximized_height;
NSWindow *nonfs_window;
BOOL fs_is_native;
#ifdef NS_IMPL_COCOA
NSBitmapImageRep *drawingBuffer;
#endif
@public
struct frame *emacsframe;
int rows, cols;
......@@ -457,7 +460,13 @@ typedef id instancetype;
#endif
- (int)fullscreenState;
/* Non-notification versions of NSView methods. Used for direct calls. */
#ifdef NS_IMPL_COCOA
- (void)focusOnDrawingBuffer;
#endif
- (void)copyRect:(NSRect)srcRect to:(NSRect)dstRect;
- (void)createDrawingBufferWithRect:(NSRect)rect;
/* Non-notification versions of NSView methods. Used for direct calls. */
- (void)windowWillEnterFullScreen;
- (void)windowDidEnterFullScreen;
- (void)windowWillExitFullScreen;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment