diff options
author | Alan Third <alan@idiocy.org> | 2020-12-16 21:12:04 +0000 |
---|---|---|
committer | Alan Third <alan@idiocy.org> | 2021-01-01 22:41:26 +0000 |
commit | 107978365e17ede02d85b52fcbd99512dcc87428 (patch) | |
tree | 8762b5d7634d86f46634ccbd7833258c53cca0f5 /src/nsterm.h | |
parent | aac17c9dca21462df57367123301b7c940f9243a (diff) | |
download | emacs-107978365e17ede02d85b52fcbd99512dcc87428.tar.gz |
Improve drawing performance on macOS
* configure.ac: Require IOSurface framework.
* src/nsterm.h: New EmacsSurface class and update EmacsView
definitions.
* src/nsterm.m (ns_update_end):
(ns_unfocus): Use new unfocusDrawingBuffer method.
(ns_draw_window_cursor): Move ns_focus to before we set colors.
([EmacsView dealloc]):
([EmacsView viewDidResize:]): Handle new EmacsSurface class.
([EmacsView initFrameFromEmacs:]): Remove reference to old method.
([EmacsView createDrawingBuffer]): Remove method.
([EmacsView focusOnDrawingBuffer]):
([EmacsView windowDidChangeBackingProperties:]): Use new EmacsSurface
class.
([EmacsView unfocusDrawingBuffer]): New method.
([EmacsView copyRect:to:]): Get information from the context instead
of direct from the IOSurface.
([EmacsView updateLayer]): Use new EmacsSurface class.
([EmacsView copyRect:to:]): Use memcpy to copy bits around instead of
using NS image functions.
([EmacsSurface initWithSize:ColorSpace:]):
([EmacsSurface dealloc]):
([EmacsSurface getSize]):
([EmacsSurface getContext]):
([EmacsSurface releaseContext]):
([EmacsSurface getSurface]):
([EmacsSurface copyContentsTo:]): New class and methods.
Diffstat (limited to 'src/nsterm.h')
-rw-r--r-- | src/nsterm.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/nsterm.h b/src/nsterm.h index c17a0c0135e..9d3ac75caf3 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -414,6 +414,7 @@ typedef id instancetype; ========================================================================== */ @class EmacsToolbar; +@class EmacsSurface; #ifdef NS_IMPL_COCOA @interface EmacsView : NSView <NSTextInput, NSWindowDelegate> @@ -435,7 +436,7 @@ typedef id instancetype; BOOL fs_is_native; BOOL in_fullscreen_transition; #ifdef NS_DRAW_TO_BUFFER - CGContextRef drawingBuffer; + EmacsSurface *surface; #endif @public struct frame *emacsframe; @@ -478,7 +479,7 @@ typedef id instancetype; #ifdef NS_DRAW_TO_BUFFER - (void)focusOnDrawingBuffer; -- (void)createDrawingBuffer; +- (void)unfocusDrawingBuffer; #endif - (void)copyRect:(NSRect)srcRect to:(NSRect)dstRect; @@ -705,6 +706,24 @@ typedef id instancetype; @end +@interface EmacsSurface : NSObject +{ + NSMutableArray *cache; + NSSize size; + CGColorSpaceRef colorSpace; + IOSurfaceRef currentSurface; + IOSurfaceRef lastSurface; + CGContextRef context; +} +- (id) initWithSize: (NSSize)s ColorSpace: (CGColorSpaceRef)cs; +- (void) dealloc; +- (NSSize) getSize; +- (CGContextRef) getContext; +- (void) releaseContext; +- (IOSurfaceRef) getSurface; +@end + + /* ========================================================================== Rendering |