From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arash Esbati Newsgroups: gmane.emacs.bugs Subject: bug#73384: [PATCH] Draw coloured stipples on NS Date: Sat, 04 Jan 2025 09:49:37 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31128"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Rudolf =?UTF-8?Q?Adamkovi=C4=8D?= , 73384@debbugs.gnu.org, Stefan Kangas , JD Smith To: Alan Third , Ben Simms Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 04 09:50:17 2025 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tTzrL-0007vl-JB for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Jan 2025 09:50:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTzrD-0003BL-IP; Sat, 04 Jan 2025 03:50:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTzr9-00038b-Gb for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 03:50:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTzr8-0003QR-3X for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 03:50:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=SCLa/pht+D1niCayjnMvdMWumAy3gxL0V+PhW7QGCQo=; b=fXbMIGhnGU1JfQiyXbH3RTo7aGX6j5q5vji1yqpwKhejSIPmude0MeQJbGAVyw9ca8QUMDW9NJhbzLE3779QU0omM5UEx1kE/kpRcva/dfMlsssKhvdTdl/MNJe+tsNSyKxt7vIlmqDdbvfTM7wNRkFkfH3u4jea4rbz9ciYcy3krhIX1ggtpPK6Ecz5jxbRJ56QKYQQSjsgLEhJ3P97ib+WB85bVzWY4yDEZVxLNmzmjaH+4FIvcoER5Spp8810C5L+lAKgB5OOM+sirlOwFlvUgnIhSynNMSJosveCypsNIAwYOBk9b8zUEqG4+gBmHds0I3aAez8VF2NW0ddwJw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tTzr7-0003Ub-U7 for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 03:50:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Arash Esbati Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Jan 2025 08:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73384 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 73384-submit@debbugs.gnu.org id=B73384.173598059013400 (code B ref 73384); Sat, 04 Jan 2025 08:50:01 +0000 Original-Received: (at 73384) by debbugs.gnu.org; 4 Jan 2025 08:49:50 +0000 Original-Received: from localhost ([127.0.0.1]:53329 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tTzqv-0003U3-Mr for submit@debbugs.gnu.org; Sat, 04 Jan 2025 03:49:50 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36594) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tTzqt-0003Tr-U6 for 73384@debbugs.gnu.org; Sat, 04 Jan 2025 03:49:48 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTzqm-0003Nr-V6; Sat, 04 Jan 2025 03:49:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=SCLa/pht+D1niCayjnMvdMWumAy3gxL0V+PhW7QGCQo=; b=RtJpnvsa0wSwfQOWib3c oEquPqoo/Sz0Yq7T+e3LmOJfhKmC8HA5iv4Gsnr8e7VDMsnFfTmYKOxZVSGGvmuuuKw0GOGbuH64B xiUGiK9V+VK/FZxFAXja4xNOSLTcNqQQ8XNtV6Zlk6BPa9yG9kMYzioo/QopvED7cYaw7S4OATNfB etlpImA3vXC4H/pnIlmC8nvSevHEVGsUuCCsq4zS1aaW/aDKUNomhc63uGczw/YsD6FqZALfuFhox SGRpBugx9oPEQm8RaX5yOtOled5mBMV3sYod6mk/ORGI2cJwRpfU2aK5z8GBA3twgI2BMuPrsNvyo JQrtNGrpqHfp4Q==; In-Reply-To: (Alan Third's message of "Wed, 18 Dec 2024 21:55:44 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298344 Archived-At: 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 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); > >> + 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?