Subject: bug#32932: 27.0.50; render bugs on macOS Mojave

From: Alan Third <[email-masked]>
Date: Mon, 11 Nov 2019 18:16:22 +0000

Hi Robert,

In reference to our quick chat over on reddit here’s some information
on this work.

I have a branch on the Emacs git repo called scratch/ns/draw-to-bitmap
which contains my work on an alternative drawing scheme. It’s mostly
the same as it was before I introduced changes for Mojave, but with
the addition of drawing to a bitmap instead of directly to the frame.

It’s a little out of date and needs a merge from master to bring it up
to date.

The main bit of the code is around the method
createDrawingBufferWithRect in nsterm.m. It’s a simple bitmap and it’s
very slow to draw to the screen (drawRect:). I think that there are
things that can be done with layers and CGLayers, but I never managed
to work out how it’s supposed to work, or if it’s even plausible. I
don’t know if AppKit can draw directly to CGLayers.

The Mac port uses a similar design, but I didn’t think the actual code
was usable in the NS port, but I could be wrong.

Ultimately, if we get this working I’d be happy to use the same method
of drawing on pre‐Mojave macOS as GNUstep uses, so there are no
concerns with backwards compatibility. The biggest issue on that front
is that we can’t use clang features that aren’t also supported in GCC,
which means no ObjC ‘blocks’, which I think rules out using Metal.

Any questions, ask away, and thanks for offering to look at this, I
hope you have better luck than me!
-- 
Alan Third