GNU bug report logs -
#73384
[PATCH] Draw coloured stipples on NS
Previous Next
Reported by: Ben Simms <bsimms.simms <at> gmail.com>
Date: Fri, 20 Sep 2024 13:34:02 UTC
Severity: normal
Tags: confirmed, patch
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73384 in the body.
You can then email your comments to 73384 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Fri, 20 Sep 2024 13:34:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ben Simms <bsimms.simms <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 20 Sep 2024 13:34:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello, I've been advised to submit my patch adding support for drawing
coloured stipples on NS Emacs here:
From 87c143b1b77ae02a08b9e1bbe27da57859e28a8d Mon Sep 17 00:00:00 2001
From: Ben Simms <ben <at> bensimms.moe>
Date: Fri, 20 Sep 2024 09:50:47 +0200
Subject: [PATCH] Support drawing coloured stipples
This makes use of CoreGraphics, while this works fine on macos systems,
I'm unsure how to test this on a GNUStep or other supported NS
implementation.
---
src/nsimage.m | 17 +++++++++++++---
src/nsterm.h | 4 ++--
src/nsterm.m | 56 +++++++++++++++++++++++++++++++++++++++++++++------
3 files changed, 66 insertions(+), 11 deletions(-)
diff --git a/src/nsimage.m b/src/nsimage.m
index ee72d6e0ea..100af5c3e9 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -28,6 +28,7 @@ Updated by Christian Limpach (chris <at> nice.ch)
/* This should be the first include, as it may set up #defines affecting
interpretation of even the system includes. */
#include <config.h>
+#include <CoreGraphics/CoreGraphics.h>
#include "lisp.h"
#include "dispextern.h"
@@ -510,10 +511,20 @@ - (void) setAlphaAtX: (int) x Y: (int) y to:
(unsigned char) a
}
/* Returns a pattern color, which is cached here. */
-- (NSColor *)stippleMask
+- (CGImageRef)stippleMask
{
- if (stippleMask == nil)
- stippleMask = [[NSColor colorWithPatternImage: self] retain];
+ if (stippleMask == nil) {
+ CGDataProviderRef provider = CGDataProviderCreateWithData (NULL,
[bmRep bitmapData],
+ [self
sizeInBytes], NULL);
+ id mask = (id)CGImageMaskCreate(
+ [self size].width,
+ [self size].height,
+ 8, 8, [self size].width,
+ provider, NULL, 0);
+
+ CGDataProviderRelease(provider);
+ stippleMask = (CGImageRef)[mask retain];
+ }
return stippleMask;
}
diff --git a/src/nsterm.h b/src/nsterm.h
index 3a713f8e8c..7ec851966f 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -670,7 +670,7 @@ #define NSTRACE_UNSILENCE()
{
NSBitmapImageRep *bmRep; /* used for accessing pixel data */
unsigned char *pixmapData[5]; /* shortcut to access pixel data */
- NSColor *stippleMask;
+ CGImageRef stippleMask;
@public
NSAffineTransform *transform;
BOOL smoothing;
@@ -687,7 +687,7 @@ #define NSTRACE_UNSILENCE()
green: (unsigned char)g blue: (unsigned char)b
alpha:(unsigned char)a;
- (void)setAlphaAtX: (int)x Y: (int)y to: (unsigned char)a;
-- (NSColor *)stippleMask;
+- (CGImageRef)stippleMask;
- (Lisp_Object)getMetadata;
- (BOOL)setFrame: (unsigned int) index;
- (void)setTransform: (double[3][3]) m;
diff --git a/src/nsterm.m b/src/nsterm.m
index 794630de1c..84084f12a4 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3826,9 +3826,28 @@ Function modeled after x_draw_glyph_string_box ().
if (s->stippled_p)
{
+ [[NSColor colorWithUnsignedLong:face->background] set];
+ r = NSMakeRect (s->x, s->y + box_line_width,
+ s->background_width,
+ s->height - 2 * box_line_width);
+ NSRectFill (r);
+ s->background_filled_p = 1;
struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (s->f);
- [[dpyinfo->bitmaps[face->stipple-1].img stippleMask] set];
- goto fill;
+ CGImageRef mask =
+ [dpyinfo->bitmaps[face->stipple - 1].img stippleMask];
+ CGRect bounds = CGRectMake (s->x, s->y + box_line_width,
+ s->background_width,
+ s->height - 2 * box_line_width);
+ NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
+ [ctx saveGraphicsState];
+ CGContextRef context = [ctx CGContext];
+ CGContextClipToRect (context, bounds);
+ CGContextScaleCTM (context, 1, -1);
+ [[NSColor colorWithUnsignedLong:face->foreground] set];
+ CGRect imageSize = CGRectMake (0, 0, CGImageGetWidth (mask),
+ CGImageGetHeight (mask));
+ CGContextDrawTiledImage (context, imageSize, mask);
+ [[NSGraphicsContext currentContext] restoreGraphicsState];
}
else if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
/* When xdisp.c ignores FONT_HEIGHT, we cannot trust font
@@ -3851,7 +3870,6 @@ Function modeled after x_draw_glyph_string_box ().
else
[FRAME_CURSOR_COLOR (s->f) set];
- fill:
r = NSMakeRect (s->x, s->y + box_line_width,
s->background_width,
s->height - 2 * box_line_width);
@@ -4175,10 +4193,36 @@ Function modeled after x_draw_glyph_string_box ().
dpyinfo = FRAME_DISPLAY_INFO (s->f);
if (s->hl == DRAW_CURSOR)
[FRAME_CURSOR_COLOR (s->f) set];
- else if (s->stippled_p)
- [[dpyinfo->bitmaps[s->face->stipple - 1].img stippleMask] set];
- else
+ else if (s->stippled_p) {
+ [[NSColor colorWithUnsignedLong:s->face->background]
+ set];
+ NSRectFill (
+ NSMakeRect (x, s->y, background_width, s->height));
+ CGImageRef mask =
+ [dpyinfo->bitmaps[s->face->stipple - 1]
+ .img stippleMask];
+ CGRect bounds
+ = CGRectMake (s->x, s->y, s->background_width,
+ s->height);
+ NSGraphicsContext *ctx =
+ [NSGraphicsContext currentContext];
+ [ctx saveGraphicsState];
+ CGContextRef context = [ctx CGContext];
+ CGContextClipToRect(context, bounds);
+ CGContextScaleCTM (context, 1, -1);
+ [[NSColor colorWithUnsignedLong:s->face->foreground]
+ set];
+ CGRect imageSize
+ = CGRectMake (0, 0, CGImageGetWidth (mask),
+ CGImageGetHeight (mask));
+ CGContextDrawTiledImage (context, imageSize, mask);
+ [[NSGraphicsContext currentContext]
+ restoreGraphicsState];
+ }
+ else {
[[NSColor colorWithUnsignedLong: s->face->background] set];
+ NSRectFill (NSMakeRect (x, s->y, background_width, s->height));
+ }
NSRectFill (NSMakeRect (x, s->y, background_width, s->height));
}
--
2.45.2
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sat, 21 Sep 2024 11:43:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 73384 <at> debbugs.gnu.org (full text, mbox):
Ben Simms <bsimms.simms <at> gmail.com> writes:
> Hello, I've been advised to submit my patch adding support for drawing
> coloured stipples on NS Emacs here:
Thanks for the patch.
Could you please also provide a simple recipe for testing this change?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sat, 21 Sep 2024 15:12:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 73384 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefankangas <at> gmail.com> writes:
> Could you please also provide a simple recipe for testing this change?
You could try the one provided here:
https://github.com/jdtsmith/indent-bars?tab=readme-ov-file#testing-stipples
Here is how it currently looks:
https://lists.gnu.org/archive/html/bug-gnu-emacs/2024-09/msg00304.html
Best, Arash
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sat, 28 Sep 2024 18:33:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 73384 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> On Sep 21, 2024, at 11:08 AM, Arash Esbati <arash <at> gnu.org> wrote:
>
> Stefan Kangas <stefankangas <at> gmail.com> writes:
>
>> Could you please also provide a simple recipe for testing this change?
It would be good to move quickly to assess and integrate this patch in time for Emacs 30, since it fixes an existing bug in the display of :stipple face attributes on the NS port, which will likely confuse users. Po I believe implemented the partial fix to NS stipples in ef6ffbdc79.
See bug#73082 for more (and a test recipe).
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sun, 29 Sep 2024 00:11:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 73384 <at> debbugs.gnu.org (full text, mbox):
JD Smith <jdtsmith <at> gmail.com> writes:
> On Sep 21, 2024, at 11:08 AM, Arash Esbati <arash <at> gnu.org>
> wrote:
>
> Stefan Kangas <stefankangas <at> gmail.com> writes:
>
> Could you please also provide a simple recipe for testing this
> change?
>
> It would be good to move quickly to assess and integrate this patch in
> time for Emacs 30, since it fixes an existing bug in the display of :stipple
> face attributes on the NS port, which will likely confuse users. Po I
> believe implemented the partial fix to NS stipples in ef6ffbdc79.
>
> See bug#73082 for more (and a test recipe).
We cannot install changes for Mac OS that use Mac-specific graphics
features, and in consequence, break the GNUstep build.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sun, 29 Sep 2024 17:53:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 73384 <at> debbugs.gnu.org (full text, mbox):
> On Sep 28, 2024, at 7:49 PM, Po Lu <luangruo <at> yahoo.com> wrote:
>
> JD Smith <jdtsmith <at> gmail.com> writes:
>
>> On Sep 21, 2024, at 11:08 AM, Arash Esbati <arash <at> gnu.org>
>> wrote:
>>
>> Stefan Kangas <stefankangas <at> gmail.com> writes:
>>
>> Could you please also provide a simple recipe for testing this
>> change?
>>
>> It would be good to move quickly to assess and integrate this patch in
>> time for Emacs 30, since it fixes an existing bug in the display of :stipple
>> face attributes on the NS port, which will likely confuse users. Po I
>> believe implemented the partial fix to NS stipples in ef6ffbdc79.
>>
>> See bug#73082 for more (and a test recipe).
>
> We cannot install changes for Mac OS that use Mac-specific graphics
> features, and in consequence, break the GNUstep build.
I see. Are there generic GNUstep analogs that could be substituted?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sun, 29 Sep 2024 20:36:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 73384 <at> debbugs.gnu.org (full text, mbox):
Po Lu <luangruo <at> yahoo.com> writes:
> JD Smith <jdtsmith <at> gmail.com> writes:
>
>> On Sep 21, 2024, at 11:08 AM, Arash Esbati <arash <at> gnu.org>
>> wrote:
>>
>> Stefan Kangas <stefankangas <at> gmail.com> writes:
>>
>> Could you please also provide a simple recipe for testing this
>> change?
>>
>> It would be good to move quickly to assess and integrate this patch in
>> time for Emacs 30, since it fixes an existing bug in the display of :stipple
>> face attributes on the NS port, which will likely confuse users. Po I
>> believe implemented the partial fix to NS stipples in ef6ffbdc79.
>>
>> See bug#73082 for more (and a test recipe).
>
> We cannot install changes for Mac OS that use Mac-specific graphics
> features, and in consequence, break the GNUstep build.
We can make them conditional on macOS though, right?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sun, 29 Sep 2024 23:33:09 GMT)
Full text and
rfc822 format available.
Message #26 received at 73384 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefankangas <at> gmail.com> writes:
>> We cannot install changes for Mac OS that use Mac-specific graphics
>> features, and in consequence, break the GNUstep build.
>
> We can make them conditional on macOS though, right?
I'll be very unsatisfied with such a solution, because it implies more
NS code that is impossible to test for Emacs developers in the Free
world.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Mon, 30 Sep 2024 00:15:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 73384 <at> debbugs.gnu.org (full text, mbox):
Po Lu <luangruo <at> yahoo.com> writes:
> Stefan Kangas <stefankangas <at> gmail.com> writes:
>
>>> We cannot install changes for Mac OS that use Mac-specific graphics
>>> features, and in consequence, break the GNUstep build.
>>
>> We can make them conditional on macOS though, right?
>
> I'll be very unsatisfied with such a solution, because it implies more
> NS code that is impossible to test for Emacs developers in the Free
> world.
That would be the drawback, indeed.
Can anyone see a way to fix this bug using APIs that are also
implemented by GNUstep?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Mon, 30 Sep 2024 11:25:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 73384 <at> debbugs.gnu.org (full text, mbox):
> Cc: Ben Simms <bsimms.simms <at> gmail.com>, 73384 <at> debbugs.gnu.org,
> Arash Esbati <arash <at> gnu.org>, JD Smith <jdtsmith <at> gmail.com>
> Date: Mon, 30 Sep 2024 07:31:31 +0800
> From: Po Lu via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> Stefan Kangas <stefankangas <at> gmail.com> writes:
>
> >> We cannot install changes for Mac OS that use Mac-specific graphics
> >> features, and in consequence, break the GNUstep build.
> >
> > We can make them conditional on macOS though, right?
>
> I'll be very unsatisfied with such a solution, because it implies more
> NS code that is impossible to test for Emacs developers in the Free
> world.
The macOS port is full of those, so I don't think one more should make
a difference.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Tue, 08 Oct 2024 05:06:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 73384 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> Cc: Ben Simms <bsimms.simms <at> gmail.com>, 73384 <at> debbugs.gnu.org,
>> Arash Esbati <arash <at> gnu.org>, JD Smith <jdtsmith <at> gmail.com>
>> Date: Mon, 30 Sep 2024 07:31:31 +0800
>> From: Po Lu via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> Stefan Kangas <stefankangas <at> gmail.com> writes:
>>
>> >> We cannot install changes for Mac OS that use Mac-specific graphics
>> >> features, and in consequence, break the GNUstep build.
>> >
>> > We can make them conditional on macOS though, right?
>>
>> I'll be very unsatisfied with such a solution, because it implies more
>> NS code that is impossible to test for Emacs developers in the Free
>> world.
>
> The macOS port is full of those, so I don't think one more should make
> a difference.
Ben, do you see a chance to update your patch after Eli's comment? TIA.
Best, Arash
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Mon, 14 Oct 2024 01:30:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 73384 <at> debbugs.gnu.org (full text, mbox):
Arash Esbati <arash <at> gnu.org> writes:
> Here is how it currently looks:
>
> https://lists.gnu.org/archive/html/bug-gnu-emacs/2024-09/msg00304.html
OMG, this explains my recent troubles with Indent Bars on macOS.
+1 for merging!
Rudy
--
"The whole science is nothing more than a refinement of everyday
thinking." --- Albert Einstein, 1879-1955
Rudolf Adamkovič <rudolf <at> adamkovic.org> [he/him]
http://adamkovic.org
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Tue, 15 Oct 2024 00:08:02 GMT)
Full text and
rfc822 format available.
Message #41 received at 73384 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hey all, I've gone ahead and put my changes behind NS_IMPL_COCA ifdefs:
From fb1ceddc6385bcefc3fb31f2c96652448298df77 Mon Sep 17 00:00:00 2001
From: Ben Simms <ben <at> bensimms.moe>
Date: Mon, 14 Oct 2024 19:32:53 +0100
Subject: [PATCH] Use masked coregraphics images on cocoa NS
---
src/nsimage.m | 31 +++++++++++++++++++++++++++++++
src/nsterm.h | 8 ++++++++
src/nsterm.m | 47 +++++++++++++++++++++++++++++++++++++++++++++--
3 files changed, 84 insertions(+), 2 deletions(-)
diff --git a/src/nsimage.m b/src/nsimage.m
index ee72d6e0ea1..e36cbe5dc87 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -35,6 +35,9 @@ Updated by Christian Limpach (chris <at> nice.ch)
#include "frame.h"
#include "coding.h"
+#ifdef NS_IMPL_COCOA
+#include <CoreGraphics/CoreGraphics.h>
+#endif
#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MAX_ALLOWED < 1070
# define COLORSPACE_NAME NSCalibratedRGBColorSpace
@@ -289,7 +292,11 @@ + (instancetype)allocInitFromFile: (Lisp_Object)file
- (void)dealloc
{
+#ifdef NS_IMPL_COCOA
+ CGImageRelease(stippleMask);
+#else
[stippleMask release];
+#endif
[bmRep release];
[transform release];
[super dealloc];
@@ -300,7 +307,11 @@ - (id)copyWithZone:(NSZone *)zone
{
EmacsImage *copy = [super copyWithZone:zone];
+#ifdef NS_IMPL_COCOA
+ copy->stippleMask = CGImageCreateCopy(stippleMask);
+#else
copy->stippleMask = [stippleMask copyWithZone:zone];
+#endif /* NS_IMPL_COCOA */
copy->bmRep = [bmRep copyWithZone:zone];
copy->transform = [transform copyWithZone:zone];
@@ -509,6 +520,25 @@ - (void) setAlphaAtX: (int) x Y: (int) y to: (unsigned
char) a
}
}
+#ifdef NS_IMPL_COCOA
+/* Returns a cached CGImageMask of the stipple pattern */
+- (CGImageRef)stippleMask
+{
+ if (stippleMask == nil) {
+ CGDataProviderRef provider = CGDataProviderCreateWithData (NULL,
[bmRep bitmapData],
+ [self
sizeInBytes], NULL);
+ CGImageRef mask = CGImageMaskCreate(
+ [self size].width,
+ [self size].height,
+ 8, 8, [self size].width,
+ provider, NULL, 0);
+
+ CGDataProviderRelease(provider);
+ stippleMask = CGImageRetain(mask);
+ }
+ return stippleMask;
+}
+#else
/* Returns a pattern color, which is cached here. */
- (NSColor *)stippleMask
{
@@ -516,6 +546,7 @@ - (NSColor *)stippleMask
stippleMask = [[NSColor colorWithPatternImage: self] retain];
return stippleMask;
}
+#endif /* NS_IMPL_COCOA */
/* Find the first NSBitmapImageRep which has multiple frames. */
- (NSBitmapImageRep *)getAnimatedBitmapImageRep
diff --git a/src/nsterm.h b/src/nsterm.h
index 6c67653705e..2370f6ea3fb 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -671,7 +671,11 @@ #define NSTRACE_UNSILENCE()
{
NSBitmapImageRep *bmRep; /* used for accessing pixel data */
unsigned char *pixmapData[5]; /* shortcut to access pixel data */
+#ifdef NS_IMPL_COCOA
+ CGImageRef stippleMask;
+#else
NSColor *stippleMask;
+#endif // NS_IMPL_COCOA
@public
NSAffineTransform *transform;
BOOL smoothing;
@@ -688,7 +692,11 @@ #define NSTRACE_UNSILENCE()
green: (unsigned char)g blue: (unsigned char)b
alpha:(unsigned char)a;
- (void)setAlphaAtX: (int)x Y: (int)y to: (unsigned char)a;
+#ifdef NS_IMPL_COCOA
+- (CGImageRef)stippleMask;
+#else
- (NSColor *)stippleMask;
+#endif // NS_IMPL_COCOA
- (Lisp_Object)getMetadata;
- (BOOL)setFrame: (unsigned int) index;
- (void)setTransform: (double[3][3]) m;
diff --git a/src/nsterm.m b/src/nsterm.m
index f68a22d9fbc..a617669cb4d 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3823,8 +3823,31 @@ Function modeled after x_draw_glyph_string_box ().
if (s->stippled_p)
{
struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (s->f);
+#ifdef NS_IMPL_COCOA
+ [[NSColor colorWithUnsignedLong:face->background] set];
+ r = NSMakeRect (s->x, s->y + box_line_width,
+ s->background_width,
+ s->height - 2 * box_line_width);
+ NSRectFill (r);
+ s->background_filled_p = 1;
+ CGImageRef mask = [dpyinfo->bitmaps[face->stipple - 1].img
stippleMask];
+ CGRect bounds = CGRectMake (s->x, s->y + box_line_width,
+ s->background_width,
+ s->height - 2 * box_line_width);
+ NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
+ [ctx saveGraphicsState];
+ CGContextRef context = [ctx CGContext];
+ CGContextClipToRect (context, bounds);
+ CGContextScaleCTM (context, 1, -1);
+ [[NSColor colorWithUnsignedLong:face->foreground] set];
+ CGRect imageSize = CGRectMake (0, 0, CGImageGetWidth (mask),
CGImageGetHeight (mask));
+ CGContextDrawTiledImage (context, imageSize, mask);
+ [[NSGraphicsContext currentContext] restoreGraphicsState];
+#else
[[dpyinfo->bitmaps[face->stipple-1].img stippleMask] set];
goto fill;
+#endif /* NS_IMPL_COCOA */
+
}
else if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
/* When xdisp.c ignores FONT_HEIGHT, we cannot trust font
@@ -3847,7 +3870,9 @@ Function modeled after x_draw_glyph_string_box ().
else
[FRAME_CURSOR_COLOR (s->f) set];
+#ifndef NS_IMPL_COCOA
fill:
+#endif /* !NS_IMPL_COCOA */
r = NSMakeRect (s->x, s->y + box_line_width,
s->background_width,
s->height - 2 * box_line_width);
@@ -4171,8 +4196,26 @@ Function modeled after x_draw_glyph_string_box ().
dpyinfo = FRAME_DISPLAY_INFO (s->f);
if (s->hl == DRAW_CURSOR)
[FRAME_CURSOR_COLOR (s->f) set];
- else if (s->stippled_p)
- [[dpyinfo->bitmaps[s->face->stipple - 1].img stippleMask] set];
+ else if (s->stippled_p) {
+#ifdef NS_IMPL_COCOA
+ [[NSColor colorWithUnsignedLong:s->face->background] set];
+ NSRectFill (NSMakeRect (x, s->y, background_width, s->height));
+ CGImageRef mask = [dpyinfo->bitmaps[s->face->stipple - 1].img
stippleMask];
+ CGRect bounds = CGRectMake (s->x, s->y, s->background_width,
s->height);
+ NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
+ [ctx saveGraphicsState];
+ CGContextRef context = [ctx CGContext];
+ CGContextClipToRect(context, bounds);
+ CGContextScaleCTM (context, 1, -1);
+ [[NSColor colorWithUnsignedLong:s->face->foreground] set];
+ CGRect imageSize = CGRectMake (0, 0, CGImageGetWidth (mask),
+ CGImageGetHeight (mask));
+ CGContextDrawTiledImage (context, imageSize, mask);
+ [[NSGraphicsContext currentContext] restoreGraphicsState];
+#else
+ [[dpyinfo->bitmaps[s->face->stipple - 1].img stippleMask] set];
+#endif /* NS_IMPL_COCOA */
+ }
else
[[NSColor colorWithUnsignedLong: s->face->background] set];
--
2.46.0
On Mon, 14 Oct 2024 at 02:29, Rudolf Adamkovič <rudolf <at> adamkovic.org> wrote:
> Arash Esbati <arash <at> gnu.org> writes:
>
> > Here is how it currently looks:
> >
> > https://lists.gnu.org/archive/html/bug-gnu-emacs/2024-09/msg00304.html
>
> OMG, this explains my recent troubles with Indent Bars on macOS.
>
> +1 for merging!
>
> Rudy
> --
> "The whole science is nothing more than a refinement of everyday
> thinking." --- Albert Einstein, 1879-1955
>
> Rudolf Adamkovič <rudolf <at> adamkovic.org> [he/him]
> http://adamkovic.org
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Thu, 17 Oct 2024 10:47:02 GMT)
Full text and
rfc822 format available.
Message #44 received at 73384 <at> debbugs.gnu.org (full text, mbox):
Ben Simms <bsimms.simms <at> gmail.com> writes:
> Hey all, I've gone ahead and put my changes behind NS_IMPL_COCA ifdefs:
Thanks. I tried to test this but the patch doesn't apply:
$ git apply --check 00stipple.patch
error: patch failed: src/nsterm.m:3823
error: src/nsterm.m: patch does not apply
This is with Emacs from master 6213ca44. Do you have the chance to
check and resend?
Best, Arash
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sat, 19 Oct 2024 14:26:05 GMT)
Full text and
rfc822 format available.
Message #47 received at 73384 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Sure, this is the patch from 6213ca44
From 1c4b8efb82bd0e35c91d98f2759217702f3a7c65 Mon Sep 17 00:00:00 2001
From: Ben Simms <ben <at> bensimms.moe>
Date: Mon, 14 Oct 2024 19:32:53 +0100
Subject: [PATCH] Use masked coregraphics images on cocoa NS
---
src/nsimage.m | 31 +++++++++++++++++++++++++++++++
src/nsterm.h | 8 ++++++++
src/nsterm.m | 47 +++++++++++++++++++++++++++++++++++++++++++++--
3 files changed, 84 insertions(+), 2 deletions(-)
diff --git a/src/nsimage.m b/src/nsimage.m
index ee72d6e0ea1..e36cbe5dc87 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -35,6 +35,9 @@ Updated by Christian Limpach (chris <at> nice.ch)
#include "frame.h"
#include "coding.h"
+#ifdef NS_IMPL_COCOA
+#include <CoreGraphics/CoreGraphics.h>
+#endif
#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MAX_ALLOWED < 1070
# define COLORSPACE_NAME NSCalibratedRGBColorSpace
@@ -289,7 +292,11 @@ + (instancetype)allocInitFromFile: (Lisp_Object)file
- (void)dealloc
{
+#ifdef NS_IMPL_COCOA
+ CGImageRelease(stippleMask);
+#else
[stippleMask release];
+#endif
[bmRep release];
[transform release];
[super dealloc];
@@ -300,7 +307,11 @@ - (id)copyWithZone:(NSZone *)zone
{
EmacsImage *copy = [super copyWithZone:zone];
+#ifdef NS_IMPL_COCOA
+ copy->stippleMask = CGImageCreateCopy(stippleMask);
+#else
copy->stippleMask = [stippleMask copyWithZone:zone];
+#endif /* NS_IMPL_COCOA */
copy->bmRep = [bmRep copyWithZone:zone];
copy->transform = [transform copyWithZone:zone];
@@ -509,6 +520,25 @@ - (void) setAlphaAtX: (int) x Y: (int) y to: (unsigned
char) a
}
}
+#ifdef NS_IMPL_COCOA
+/* Returns a cached CGImageMask of the stipple pattern */
+- (CGImageRef)stippleMask
+{
+ if (stippleMask == nil) {
+ CGDataProviderRef provider = CGDataProviderCreateWithData (NULL,
[bmRep bitmapData],
+ [self
sizeInBytes], NULL);
+ CGImageRef mask = CGImageMaskCreate(
+ [self size].width,
+ [self size].height,
+ 8, 8, [self size].width,
+ provider, NULL, 0);
+
+ CGDataProviderRelease(provider);
+ stippleMask = CGImageRetain(mask);
+ }
+ return stippleMask;
+}
+#else
/* Returns a pattern color, which is cached here. */
- (NSColor *)stippleMask
{
@@ -516,6 +546,7 @@ - (NSColor *)stippleMask
stippleMask = [[NSColor colorWithPatternImage: self] retain];
return stippleMask;
}
+#endif /* NS_IMPL_COCOA */
/* Find the first NSBitmapImageRep which has multiple frames. */
- (NSBitmapImageRep *)getAnimatedBitmapImageRep
diff --git a/src/nsterm.h b/src/nsterm.h
index 6c67653705e..2370f6ea3fb 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -671,7 +671,11 @@ #define NSTRACE_UNSILENCE()
{
NSBitmapImageRep *bmRep; /* used for accessing pixel data */
unsigned char *pixmapData[5]; /* shortcut to access pixel data */
+#ifdef NS_IMPL_COCOA
+ CGImageRef stippleMask;
+#else
NSColor *stippleMask;
+#endif // NS_IMPL_COCOA
@public
NSAffineTransform *transform;
BOOL smoothing;
@@ -688,7 +692,11 @@ #define NSTRACE_UNSILENCE()
green: (unsigned char)g blue: (unsigned char)b
alpha:(unsigned char)a;
- (void)setAlphaAtX: (int)x Y: (int)y to: (unsigned char)a;
+#ifdef NS_IMPL_COCOA
+- (CGImageRef)stippleMask;
+#else
- (NSColor *)stippleMask;
+#endif // NS_IMPL_COCOA
- (Lisp_Object)getMetadata;
- (BOOL)setFrame: (unsigned int) index;
- (void)setTransform: (double[3][3]) m;
diff --git a/src/nsterm.m b/src/nsterm.m
index f68a22d9fbc..a617669cb4d 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3823,8 +3823,31 @@ Function modeled after x_draw_glyph_string_box ().
if (s->stippled_p)
{
struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (s->f);
+#ifdef NS_IMPL_COCOA
+ [[NSColor colorWithUnsignedLong:face->background] set];
+ r = NSMakeRect (s->x, s->y + box_line_width,
+ s->background_width,
+ s->height - 2 * box_line_width);
+ NSRectFill (r);
+ s->background_filled_p = 1;
+ CGImageRef mask = [dpyinfo->bitmaps[face->stipple - 1].img
stippleMask];
+ CGRect bounds = CGRectMake (s->x, s->y + box_line_width,
+ s->background_width,
+ s->height - 2 * box_line_width);
+ NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
+ [ctx saveGraphicsState];
+ CGContextRef context = [ctx CGContext];
+ CGContextClipToRect (context, bounds);
+ CGContextScaleCTM (context, 1, -1);
+ [[NSColor colorWithUnsignedLong:face->foreground] set];
+ CGRect imageSize = CGRectMake (0, 0, CGImageGetWidth (mask),
CGImageGetHeight (mask));
+ CGContextDrawTiledImage (context, imageSize, mask);
+ [[NSGraphicsContext currentContext] restoreGraphicsState];
+#else
[[dpyinfo->bitmaps[face->stipple-1].img stippleMask] set];
goto fill;
+#endif /* NS_IMPL_COCOA */
+
}
else if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
/* When xdisp.c ignores FONT_HEIGHT, we cannot trust font
@@ -3847,7 +3870,9 @@ Function modeled after x_draw_glyph_string_box ().
else
[FRAME_CURSOR_COLOR (s->f) set];
+#ifndef NS_IMPL_COCOA
fill:
+#endif /* !NS_IMPL_COCOA */
r = NSMakeRect (s->x, s->y + box_line_width,
s->background_width,
s->height - 2 * box_line_width);
@@ -4171,8 +4196,26 @@ Function modeled after x_draw_glyph_string_box ().
dpyinfo = FRAME_DISPLAY_INFO (s->f);
if (s->hl == DRAW_CURSOR)
[FRAME_CURSOR_COLOR (s->f) set];
- else if (s->stippled_p)
- [[dpyinfo->bitmaps[s->face->stipple - 1].img stippleMask] set];
+ else if (s->stippled_p) {
+#ifdef NS_IMPL_COCOA
+ [[NSColor colorWithUnsignedLong:s->face->background] set];
+ NSRectFill (NSMakeRect (x, s->y, background_width, s->height));
+ CGImageRef mask = [dpyinfo->bitmaps[s->face->stipple - 1].img
stippleMask];
+ CGRect bounds = CGRectMake (s->x, s->y, s->background_width,
s->height);
+ NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
+ [ctx saveGraphicsState];
+ CGContextRef context = [ctx CGContext];
+ CGContextClipToRect(context, bounds);
+ CGContextScaleCTM (context, 1, -1);
+ [[NSColor colorWithUnsignedLong:s->face->foreground] set];
+ CGRect imageSize = CGRectMake (0, 0, CGImageGetWidth (mask),
+ CGImageGetHeight (mask));
+ CGContextDrawTiledImage (context, imageSize, mask);
+ [[NSGraphicsContext currentContext] restoreGraphicsState];
+#else
+ [[dpyinfo->bitmaps[s->face->stipple - 1].img stippleMask] set];
+#endif /* NS_IMPL_COCOA */
+ }
else
[[NSColor colorWithUnsignedLong: s->face->background] set];
--
2.46.0
On Thu, 17 Oct 2024 at 12:43, Arash Esbati <arash <at> gnu.org> wrote:
> Ben Simms <bsimms.simms <at> gmail.com> writes:
>
> > Hey all, I've gone ahead and put my changes behind NS_IMPL_COCA ifdefs:
>
> Thanks. I tried to test this but the patch doesn't apply:
>
> $ git apply --check 00stipple.patch
> error: patch failed: src/nsterm.m:3823
> error: src/nsterm.m: patch does not apply
>
> This is with Emacs from master 6213ca44. Do you have the chance to
> check and resend?
>
> Best, Arash
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Mon, 21 Oct 2024 18:25:02 GMT)
Full text and
rfc822 format available.
Message #50 received at 73384 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Ben Simms <bsimms.simms <at> gmail.com> writes:
> Sure, this is the patch from 6213ca44
Thanks. I copied the patch into the file attached and tried it again,
but still no avail:
$ git apply 00stipple.patch
00stipple.patch:179: trailing whitespace.
#else
error: patch failed: src/nsterm.m:3823
error: src/nsterm.m: patch does not apply
What am I missing?
Best, Arash
[00stipple.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Mon, 21 Oct 2024 19:28:02 GMT)
Full text and
rfc822 format available.
Message #53 received at 73384 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Ben Simms <bsimms.simms <at> gmail.com> writes:
> I'm not sure, I've attached the patch instead of including it in the
> email body, perhaps this is better.
Yes, thanks, now it works. I think it was due to a trailing whitespace
after else in this part:
+ [[NSGraphicsContext currentContext] restoreGraphicsState];
+#else
+ [[dpyinfo->bitmaps[s->face->stipple - 1].img stippleMask] set];
which was removed in the body. At any rate, I applied your change,
built emacs anew from scratch, and it looks like this:
[stipples-patch.png (image/png, inline)]
[Message part 3 (text/plain, inline)]
I'd say it works. What do others think? Many thanks for this.
Best, Arash
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Tue, 29 Oct 2024 10:33:02 GMT)
Full text and
rfc822 format available.
Message #56 received at 73384 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Arash Esbati <arash <at> gnu.org> writes:
> I'd say it works. What do others think? Many thanks for this.
Stefan, did you have a chance to look at this again? I'm attaching the
patch Ben sent me off-list. Maybe you can advise how to proceed and get
this installed. TIA.
Best, Arash
[0001-Use-masked-coregraphics-images-on-cocoa-NS.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Wed, 11 Dec 2024 06:21:01 GMT)
Full text and
rfc822 format available.
Message #59 received at 73384 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Arash Esbati <arash <at> gnu.org> writes:
> Stefan, did you have a chance to look at this again? I'm attaching the
> patch Ben sent me off-list. Maybe you can advise how to proceed and get
> this installed. TIA.
Ping!
Do you see a chance to install this change? Or should I ask Alan Third
if he can kindly have a look?
Best, Arash
[0001-Use-masked-coregraphics-images-on-cocoa-NS.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sun, 15 Dec 2024 14:23:02 GMT)
Full text and
rfc822 format available.
Message #62 received at 73384 <at> debbugs.gnu.org (full text, mbox):
Alan, do you have any comments on the below patch? Thanks in advance.
Arash Esbati <arash <at> gnu.org> writes:
> Arash Esbati <arash <at> gnu.org> writes:
>
>> Stefan, did you have a chance to look at this again? I'm attaching the
>> patch Ben sent me off-list. Maybe you can advise how to proceed and get
>> this installed. TIA.
>
> Ping!
>
> Do you see a chance to install this change? Or should I ask Alan Third
> if he can kindly have a look?
>
> From 1c4b8efb82bd0e35c91d98f2759217702f3a7c65 Mon Sep 17 00:00:00 2001
> From: Ben Simms <ben <at> bensimms.moe>
> Date: Mon, 14 Oct 2024 19:32:53 +0100
> Subject: [PATCH] Use masked coregraphics images on cocoa NS
>
> ---
> src/nsimage.m | 31 +++++++++++++++++++++++++++++++
> src/nsterm.h | 8 ++++++++
> src/nsterm.m | 47 +++++++++++++++++++++++++++++++++++++++++++++--
> 3 files changed, 84 insertions(+), 2 deletions(-)
>
> diff --git a/src/nsimage.m b/src/nsimage.m
> index ee72d6e0ea1..e36cbe5dc87 100644
> --- a/src/nsimage.m
> +++ b/src/nsimage.m
> @@ -35,6 +35,9 @@ Updated by Christian Limpach (chris <at> nice.ch)
> #include "frame.h"
> #include "coding.h"
>
> +#ifdef NS_IMPL_COCOA
> +#include <CoreGraphics/CoreGraphics.h>
> +#endif
>
> #if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MAX_ALLOWED < 1070
> # define COLORSPACE_NAME NSCalibratedRGBColorSpace
> @@ -289,7 +292,11 @@ + (instancetype)allocInitFromFile: (Lisp_Object)file
>
> - (void)dealloc
> {
> +#ifdef NS_IMPL_COCOA
> + CGImageRelease(stippleMask);
> +#else
> [stippleMask release];
> +#endif
> [bmRep release];
> [transform release];
> [super dealloc];
> @@ -300,7 +307,11 @@ - (id)copyWithZone:(NSZone *)zone
> {
> EmacsImage *copy = [super copyWithZone:zone];
>
> +#ifdef NS_IMPL_COCOA
> + copy->stippleMask = CGImageCreateCopy(stippleMask);
> +#else
> copy->stippleMask = [stippleMask copyWithZone:zone];
> +#endif /* NS_IMPL_COCOA */
> copy->bmRep = [bmRep copyWithZone:zone];
> copy->transform = [transform copyWithZone:zone];
>
> @@ -509,6 +520,25 @@ - (void) setAlphaAtX: (int) x Y: (int) y to: (unsigned char) a
> }
> }
>
> +#ifdef NS_IMPL_COCOA
> +/* Returns a cached CGImageMask of the stipple pattern */
> +- (CGImageRef)stippleMask
> +{
> + if (stippleMask == nil) {
> + CGDataProviderRef provider = CGDataProviderCreateWithData (NULL, [bmRep bitmapData],
> + [self sizeInBytes], NULL);
> + CGImageRef mask = CGImageMaskCreate(
> + [self size].width,
> + [self size].height,
> + 8, 8, [self size].width,
> + provider, NULL, 0);
> +
> + CGDataProviderRelease(provider);
> + stippleMask = CGImageRetain(mask);
> + }
> + return stippleMask;
> +}
> +#else
> /* Returns a pattern color, which is cached here. */
> - (NSColor *)stippleMask
> {
> @@ -516,6 +546,7 @@ - (NSColor *)stippleMask
> stippleMask = [[NSColor colorWithPatternImage: self] retain];
> return stippleMask;
> }
> +#endif /* NS_IMPL_COCOA */
>
> /* Find the first NSBitmapImageRep which has multiple frames. */
> - (NSBitmapImageRep *)getAnimatedBitmapImageRep
> diff --git a/src/nsterm.h b/src/nsterm.h
> index 6c67653705e..2370f6ea3fb 100644
> --- a/src/nsterm.h
> +++ b/src/nsterm.h
> @@ -671,7 +671,11 @@ #define NSTRACE_UNSILENCE()
> {
> NSBitmapImageRep *bmRep; /* used for accessing pixel data */
> unsigned char *pixmapData[5]; /* shortcut to access pixel data */
> +#ifdef NS_IMPL_COCOA
> + CGImageRef stippleMask;
> +#else
> NSColor *stippleMask;
> +#endif // NS_IMPL_COCOA
> @public
> NSAffineTransform *transform;
> BOOL smoothing;
> @@ -688,7 +692,11 @@ #define NSTRACE_UNSILENCE()
> green: (unsigned char)g blue: (unsigned char)b
> alpha:(unsigned char)a;
> - (void)setAlphaAtX: (int)x Y: (int)y to: (unsigned char)a;
> +#ifdef NS_IMPL_COCOA
> +- (CGImageRef)stippleMask;
> +#else
> - (NSColor *)stippleMask;
> +#endif // NS_IMPL_COCOA
> - (Lisp_Object)getMetadata;
> - (BOOL)setFrame: (unsigned int) index;
> - (void)setTransform: (double[3][3]) m;
> diff --git a/src/nsterm.m b/src/nsterm.m
> index f68a22d9fbc..a617669cb4d 100644
> --- a/src/nsterm.m
> +++ b/src/nsterm.m
> @@ -3823,8 +3823,31 @@ Function modeled after x_draw_glyph_string_box ().
> if (s->stippled_p)
> {
> struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (s->f);
> +#ifdef NS_IMPL_COCOA
> + [[NSColor colorWithUnsignedLong:face->background] set];
> + r = NSMakeRect (s->x, s->y + box_line_width,
> + s->background_width,
> + s->height - 2 * box_line_width);
> + NSRectFill (r);
> + s->background_filled_p = 1;
> + CGImageRef mask = [dpyinfo->bitmaps[face->stipple - 1].img stippleMask];
> + CGRect bounds = CGRectMake (s->x, s->y + box_line_width,
> + s->background_width,
> + s->height - 2 * box_line_width);
> + NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
> + [ctx saveGraphicsState];
> + CGContextRef context = [ctx CGContext];
> + CGContextClipToRect (context, bounds);
> + CGContextScaleCTM (context, 1, -1);
> + [[NSColor colorWithUnsignedLong:face->foreground] set];
> + CGRect imageSize = CGRectMake (0, 0, CGImageGetWidth (mask), CGImageGetHeight (mask));
> + CGContextDrawTiledImage (context, imageSize, mask);
> + [[NSGraphicsContext currentContext] restoreGraphicsState];
> +#else
> [[dpyinfo->bitmaps[face->stipple-1].img stippleMask] set];
> goto fill;
> +#endif /* NS_IMPL_COCOA */
> +
> }
> else if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
> /* When xdisp.c ignores FONT_HEIGHT, we cannot trust font
> @@ -3847,7 +3870,9 @@ Function modeled after x_draw_glyph_string_box ().
> else
> [FRAME_CURSOR_COLOR (s->f) set];
>
> +#ifndef NS_IMPL_COCOA
> fill:
> +#endif /* !NS_IMPL_COCOA */
> r = NSMakeRect (s->x, s->y + box_line_width,
> s->background_width,
> s->height - 2 * box_line_width);
> @@ -4171,8 +4196,26 @@ Function modeled after x_draw_glyph_string_box ().
> dpyinfo = FRAME_DISPLAY_INFO (s->f);
> if (s->hl == DRAW_CURSOR)
> [FRAME_CURSOR_COLOR (s->f) set];
> - else if (s->stippled_p)
> - [[dpyinfo->bitmaps[s->face->stipple - 1].img stippleMask] set];
> + else if (s->stippled_p) {
> +#ifdef NS_IMPL_COCOA
> + [[NSColor colorWithUnsignedLong:s->face->background] set];
> + NSRectFill (NSMakeRect (x, s->y, background_width, s->height));
> + CGImageRef mask = [dpyinfo->bitmaps[s->face->stipple - 1].img stippleMask];
> + CGRect bounds = CGRectMake (s->x, s->y, s->background_width, s->height);
> + NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
> + [ctx saveGraphicsState];
> + CGContextRef context = [ctx CGContext];
> + CGContextClipToRect(context, bounds);
> + CGContextScaleCTM (context, 1, -1);
> + [[NSColor colorWithUnsignedLong:s->face->foreground] set];
> + CGRect imageSize = CGRectMake (0, 0, CGImageGetWidth (mask),
> + CGImageGetHeight (mask));
> + CGContextDrawTiledImage (context, imageSize, mask);
> + [[NSGraphicsContext currentContext] restoreGraphicsState];
> +#else
> + [[dpyinfo->bitmaps[s->face->stipple - 1].img stippleMask] set];
> +#endif /* NS_IMPL_COCOA */
> + }
> else
> [[NSColor colorWithUnsignedLong: s->face->background] set];
>
> --
> 2.46.0
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Wed, 18 Dec 2024 21:56:02 GMT)
Full text and
rfc822 format available.
Message #65 received at 73384 <at> debbugs.gnu.org (full text, mbox):
> +#ifdef NS_IMPL_COCOA
> +/* Returns a cached CGImageMask of the stipple pattern */
> +- (CGImageRef)stippleMask
> +{
> + if (stippleMask == nil) {
> + CGDataProviderRef provider = CGDataProviderCreateWithData (NULL, [bmRep bitmapData],
> + [self sizeInBytes], NULL);
> + CGImageRef mask = CGImageMaskCreate(
> + [self size].width,
> + [self size].height,
> + 8, 8, [self size].width,
> + provider, NULL, 0);
There's some weird formatting in this patch. Some of it looks like
it's perhaps due to email, but other bits, like the above, just look
wrong.
Other things I've noticed include C++ comments, //, instead of C
comments, /* */. Large blocks of code with no whitespace that is a bit
hard to follow. It would be nicer if it was broken up into logical
blocks.
> + r = NSMakeRect (s->x, s->y + box_line_width,
> + s->background_width,
> + s->height - 2 * box_line_width);
<snip>
> + NSRectFill (r);
> + s->background_filled_p = 1;
> + CGImageRef mask = [dpyinfo->bitmaps[face->stipple - 1].img stippleMask];
> + CGRect bounds = CGRectMake (s->x, s->y + box_line_width,
> + s->background_width,
> + s->height - 2 * box_line_width);
NSRect and CGRect are the same thing, so here "r" and "bounds" are
identical. It might be worth just having one variable.
> + else if (s->stippled_p) {
Opening braces go on new lines.
Really that's it, Just some polishing required and a proper commit
message. Otherwise it looks OK to me.
I take it this doesn't require the addition of any extra build flags
to bring in CoreGraphics?
--
Alan Third
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sat, 04 Jan 2025 08:50:01 GMT)
Full text and
rfc822 format available.
Message #68 received at 73384 <at> debbugs.gnu.org (full text, mbox):
Many thanks for your comments Alan. Since I'm only the messenger here,
I'm kindly asking Ben if he can incorporate your comments and post a new
patch.
Reg. your question:
> I take it this doesn't require the addition of any extra build flags
> to bring in CoreGraphics?
I don't think so, the patch just worked for me.
Best, Arash
Alan Third <alan <at> idiocy.org> writes:
>> +#ifdef NS_IMPL_COCOA
>> +/* Returns a cached CGImageMask of the stipple pattern */
>> +- (CGImageRef)stippleMask
>> +{
>> + if (stippleMask == nil) {
>> + CGDataProviderRef provider = CGDataProviderCreateWithData (NULL, [bmRep bitmapData],
>> + [self sizeInBytes], NULL);
>> + CGImageRef mask = CGImageMaskCreate(
>> + [self size].width,
>> + [self size].height,
>> + 8, 8, [self size].width,
>> + provider, NULL, 0);
>
> There's some weird formatting in this patch. Some of it looks like
> it's perhaps due to email, but other bits, like the above, just look
> wrong.
>
> Other things I've noticed include C++ comments, //, instead of C
> comments, /* */. Large blocks of code with no whitespace that is a bit
> hard to follow. It would be nicer if it was broken up into logical
> blocks.
>
>
>> + r = NSMakeRect (s->x, s->y + box_line_width,
>> + s->background_width,
>> + s->height - 2 * box_line_width);
> <snip>
>> + NSRectFill (r);
>> + s->background_filled_p = 1;
>> + CGImageRef mask = [dpyinfo->bitmaps[face->stipple - 1].img stippleMask];
>> + CGRect bounds = CGRectMake (s->x, s->y + box_line_width,
>> + s->background_width,
>> + s->height - 2 * box_line_width);
>
> NSRect and CGRect are the same thing, so here "r" and "bounds" are
> identical. It might be worth just having one variable.
>
>> + else if (s->stippled_p) {
>
> Opening braces go on new lines.
>
> Really that's it, Just some polishing required and a proper commit
> message. Otherwise it looks OK to me.
>
> I take it this doesn't require the addition of any extra build flags
> to bring in CoreGraphics?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Mon, 06 Jan 2025 09:09:04 GMT)
Full text and
rfc822 format available.
Message #71 received at 73384 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi all, I've revised my patch from Alan's feedback.
You can find it attached.
On Sat, 4 Jan 2025 at 09:49, Arash Esbati <arash <at> gnu.org> wrote:
> Many thanks for your comments Alan. Since I'm only the messenger here,
> I'm kindly asking Ben if he can incorporate your comments and post a new
> patch.
>
> Reg. your question:
>
> > I take it this doesn't require the addition of any extra build flags
> > to bring in CoreGraphics?
>
> I don't think so, the patch just worked for me.
>
> Best, Arash
>
> Alan Third <alan <at> idiocy.org> writes:
>
> >> +#ifdef NS_IMPL_COCOA
> >> +/* Returns a cached CGImageMask of the stipple pattern */
> >> +- (CGImageRef)stippleMask
> >> +{
> >> + if (stippleMask == nil) {
> >> + CGDataProviderRef provider = CGDataProviderCreateWithData (NULL,
> [bmRep bitmapData],
> >> + [self
> sizeInBytes], NULL);
> >> + CGImageRef mask = CGImageMaskCreate(
> >> + [self size].width,
> >> + [self size].height,
> >> + 8, 8, [self size].width,
> >> + provider, NULL, 0);
> >
> > There's some weird formatting in this patch. Some of it looks like
> > it's perhaps due to email, but other bits, like the above, just look
> > wrong.
> >
> > Other things I've noticed include C++ comments, //, instead of C
> > comments, /* */. Large blocks of code with no whitespace that is a bit
> > hard to follow. It would be nicer if it was broken up into logical
> > blocks.
> >
> >
> >> + r = NSMakeRect (s->x, s->y + box_line_width,
> >> + s->background_width,
> >> + s->height - 2 * box_line_width);
> > <snip>
> >> + NSRectFill (r);
> >> + s->background_filled_p = 1;
> >> + CGImageRef mask = [dpyinfo->bitmaps[face->stipple - 1].img
> stippleMask];
> >> + CGRect bounds = CGRectMake (s->x, s->y + box_line_width,
> >> + s->background_width,
> >> + s->height - 2 * box_line_width);
> >
> > NSRect and CGRect are the same thing, so here "r" and "bounds" are
> > identical. It might be worth just having one variable.
> >
> >> + else if (s->stippled_p) {
> >
> > Opening braces go on new lines.
> >
> > Really that's it, Just some polishing required and a proper commit
> > message. Otherwise it looks OK to me.
> >
> > I take it this doesn't require the addition of any extra build flags
> > to bring in CoreGraphics?
>
[Message part 2 (text/html, inline)]
[0001-Support-coloured-stipples-on-Cocoa-NS.patch (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sun, 12 Jan 2025 11:00:02 GMT)
Full text and
rfc822 format available.
Message #74 received at 73384 <at> debbugs.gnu.org (full text, mbox):
On Sun, Jan 05, 2025 at 08:17:42PM +0100, Ben Simms wrote:
> Hi all, I've revised my patch from Alan's feedback.
> You can find it attached.
LGTM. What's the situation with copyright assignment here? Has it
already been done?
--
Alan Third
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sat, 18 Jan 2025 09:38:01 GMT)
Full text and
rfc822 format available.
Message #77 received at 73384 <at> debbugs.gnu.org (full text, mbox):
> Cc: Rudolf Adamkovič <rudolf <at> adamkovic.org>,
> Arash Esbati <arash <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
> JD Smith <jdtsmith <at> gmail.com>, 73384 <at> debbugs.gnu.org
> Date: Sun, 12 Jan 2025 10:59:17 +0000
> From: Alan Third <alan <at> idiocy.org>
>
> On Sun, Jan 05, 2025 at 08:17:42PM +0100, Ben Simms wrote:
> > Hi all, I've revised my patch from Alan's feedback.
> > You can find it attached.
>
> LGTM. What's the situation with copyright assignment here? Has it
> already been done?
Ben, did you start your assignment paperwork? If not, would you like
to start it now, so we could install your changes?
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sat, 18 Jan 2025 17:04:04 GMT)
Full text and
rfc822 format available.
Message #80 received at 73384 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello, I sent off the request last week, I'm currently waiting on a reply
from assign <at> gnu.org
On Sat, 18 Jan 2025, 10:37 Eli Zaretskii, <eliz <at> gnu.org> wrote:
> > Cc: Rudolf Adamkovič <rudolf <at> adamkovic.org>,
> > Arash Esbati <arash <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
> > JD Smith <jdtsmith <at> gmail.com>, 73384 <at> debbugs.gnu.org
> > Date: Sun, 12 Jan 2025 10:59:17 +0000
> > From: Alan Third <alan <at> idiocy.org>
> >
> > On Sun, Jan 05, 2025 at 08:17:42PM +0100, Ben Simms wrote:
> > > Hi all, I've revised my patch from Alan's feedback.
> > > You can find it attached.
> >
> > LGTM. What's the situation with copyright assignment here? Has it
> > already been done?
>
> Ben, did you start your assignment paperwork? If not, would you like
> to start it now, so we could install your changes?
>
> Thanks.
>
[Message part 2 (text/html, inline)]
Added tag(s) pending.
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 13 Feb 2025 10:28:02 GMT)
Full text and
rfc822 format available.
Added tag(s) confirmed.
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 13 Feb 2025 10:29:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Fri, 14 Feb 2025 13:56:02 GMT)
Full text and
rfc822 format available.
Message #87 received at 73384 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi all, the copyright assignment is complete.
On Sat, 18 Jan 2025 at 11:29, Ben Simms <bsimms.simms <at> gmail.com> wrote:
> Hello, I sent off the request last week, I'm currently waiting on a reply
> from assign <at> gnu.org
>
> On Sat, 18 Jan 2025, 10:37 Eli Zaretskii, <eliz <at> gnu.org> wrote:
>
>> > Cc: Rudolf Adamkovič <rudolf <at> adamkovic.org>,
>> > Arash Esbati <arash <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
>> > JD Smith <jdtsmith <at> gmail.com>, 73384 <at> debbugs.gnu.org
>> > Date: Sun, 12 Jan 2025 10:59:17 +0000
>> > From: Alan Third <alan <at> idiocy.org>
>> >
>> > On Sun, Jan 05, 2025 at 08:17:42PM +0100, Ben Simms wrote:
>> > > Hi all, I've revised my patch from Alan's feedback.
>> > > You can find it attached.
>> >
>> > LGTM. What's the situation with copyright assignment here? Has it
>> > already been done?
>>
>> Ben, did you start your assignment paperwork? If not, would you like
>> to start it now, so we could install your changes?
>>
>> Thanks.
>>
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Fri, 14 Feb 2025 14:10:01 GMT)
Full text and
rfc822 format available.
Message #90 received at 73384 <at> debbugs.gnu.org (full text, mbox):
> From: Ben Simms <bsimms.simms <at> gmail.com>
> Date: Fri, 14 Feb 2025 14:55:22 +0100
> Cc: Alan Third <alan <at> idiocy.org>, arash <at> gnu.org, stefankangas <at> gmail.com,
> rudolf <at> adamkovic.org, 73384 <at> debbugs.gnu.org, jdtsmith <at> gmail.com
>
> Hi all, the copyright assignment is complete.
Almost. I know you received an email saying the paperwork is
complete, but we should wait until your assignment actually appears on
file, and that could take a few more days.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Sat, 22 Feb 2025 09:55:02 GMT)
Full text and
rfc822 format available.
Message #93 received at 73384 <at> debbugs.gnu.org (full text, mbox):
> Cc: rudolf <at> adamkovic.org, alan <at> idiocy.org, 73384 <at> debbugs.gnu.org, arash <at> gnu.org,
> stefankangas <at> gmail.com, jdtsmith <at> gmail.com
> Date: Fri, 14 Feb 2025 16:09:03 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
>
> > From: Ben Simms <bsimms.simms <at> gmail.com>
> > Date: Fri, 14 Feb 2025 14:55:22 +0100
> > Cc: Alan Third <alan <at> idiocy.org>, arash <at> gnu.org, stefankangas <at> gmail.com,
> > rudolf <at> adamkovic.org, 73384 <at> debbugs.gnu.org, jdtsmith <at> gmail.com
> >
> > Hi all, the copyright assignment is complete.
>
> Almost. I know you received an email saying the paperwork is
> complete, but we should wait until your assignment actually appears on
> file, and that could take a few more days.
Ok, your assignment is on file now, so we can proceed with installing
the patch.
However, I now see that you didn't include the commit log message in
the format according to our conventions (see CONTRIBUTE for the
details). Could you please post the commit log message formatted
according to what we use? Than I will install the changes.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Mon, 03 Mar 2025 11:57:02 GMT)
Full text and
rfc822 format available.
Message #96 received at 73384 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Okay, I've read the contributing guide. Here attached is the patch with the
correct commit log message.
Thanks.
On Sat, 22 Feb 2025 at 10:54, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > Cc: rudolf <at> adamkovic.org, alan <at> idiocy.org, 73384 <at> debbugs.gnu.org,
> arash <at> gnu.org,
> > stefankangas <at> gmail.com, jdtsmith <at> gmail.com
> > Date: Fri, 14 Feb 2025 16:09:03 +0200
> > From: Eli Zaretskii <eliz <at> gnu.org>
> >
> > > From: Ben Simms <bsimms.simms <at> gmail.com>
> > > Date: Fri, 14 Feb 2025 14:55:22 +0100
> > > Cc: Alan Third <alan <at> idiocy.org>, arash <at> gnu.org,
> stefankangas <at> gmail.com,
> > > rudolf <at> adamkovic.org, 73384 <at> debbugs.gnu.org, jdtsmith <at> gmail.com
> > >
> > > Hi all, the copyright assignment is complete.
> >
> > Almost. I know you received an email saying the paperwork is
> > complete, but we should wait until your assignment actually appears on
> > file, and that could take a few more days.
>
> Ok, your assignment is on file now, so we can proceed with installing
> the patch.
>
> However, I now see that you didn't include the commit log message in
> the format according to our conventions (see CONTRIBUTE for the
> details). Could you please post the commit log message formatted
> according to what we use? Than I will install the changes.
>
> Thanks.
>
[Message part 2 (text/html, inline)]
[0001-Support-colored-stipples-on-Cocoa-NS-Bug-73384.patch (application/octet-stream, attachment)]
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Tue, 04 Mar 2025 12:33:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Ben Simms <bsimms.simms <at> gmail.com>
:
bug acknowledged by developer.
(Tue, 04 Mar 2025 12:33:02 GMT)
Full text and
rfc822 format available.
Message #101 received at 73384-done <at> debbugs.gnu.org (full text, mbox):
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Tue, 04 Mar 2025 12:34:01 GMT)
Full text and
rfc822 format available.
Message #104 received at 73384-done <at> debbugs.gnu.org (full text, mbox):
> From: Ben Simms <bsimms.simms <at> gmail.com>
> Date: Mon, 3 Mar 2025 12:56:33 +0100
> Cc: rudolf <at> adamkovic.org, alan <at> idiocy.org, 73384 <at> debbugs.gnu.org,
> arash <at> gnu.org, stefankangas <at> gmail.com, jdtsmith <at> gmail.com
>
> Okay, I've read the contributing guide. Here attached is the patch with the correct commit log message.
Thanks, installed on the master branch, and closing the bug.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73384
; Package
emacs
.
(Tue, 04 Mar 2025 16:54:01 GMT)
Full text and
rfc822 format available.
Message #107 received at 73384 <at> debbugs.gnu.org (full text, mbox):
Ben Simms <bsimms.simms <at> gmail.com> writes:
> Hi all, I've revised my patch from Alan's feedback.
> You can find it attached.
Thank you! indent-bars works now: https://github.com/jdtsmith/indent-bars
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 02 Apr 2025 11:24:31 GMT)
Full text and
rfc822 format available.
This bug report was last modified 76 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.