Deutsch English Français Italiano |
<utd76v$2e7rj$1@i2pn2.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder6.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail From: fir <fir@grunge.pl> Newsgroups: comp.lang.c Subject: Re: filling area by color atack safety Date: Wed, 20 Mar 2024 00:30:56 +0100 Organization: i2pn2 (i2pn.org) Message-ID: <utd76v$2e7rj$1@i2pn2.org> References: <ut3669$21eur$1@i2pn2.org> <ut4020$2s8ov$1@dont-email.me> <ut4b09$2uhpm$1@dont-email.me> <ut4cnc$2ut2t$1@dont-email.me> <ut70b4$3itvb$1@dont-email.me> <20240317182520.00002390@yahoo.com> <utd5in$2e5ok$1@i2pn2.org> <20240320011759.00005e2d@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 19 Mar 2024 23:30:40 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="2563955"; mail-complaints-to="usenet@i2pn2.org"; posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0"; User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24 In-Reply-To: <20240320011759.00005e2d@yahoo.com> X-Spam-Checker-Version: SpamAssassin 4.0.0 Bytes: 2588 Lines: 39 Michael S wrote: > On Wed, 20 Mar 2024 00:03:04 +0100 > fir <fir@grunge.pl> wrote: >> im not quite sure what you do here.. pass the structure? in fact >> the thing you name context you may not pass at all just make is >> standalone static variables becouse they/it is the same for whole >> "branch" (given recursive branch of recolorisation) >> >> something like >> >> int old_color = 0xff0000; >> int new_color = 0x00ff00; >> >> void RecolorizePixelAndAdjacentPixels(int x, int y) >> { >> //... >> } >> >> > > Not thred-safe. > some thread safe as previous, and i just say that thiose new_color and old_color in arguments i add for convenience - as those all was functional test if the operation of recolorisation visibly works and how in my lowres (bigpixel) graphics editor - its no need to pass it down the stack..also the test if old_color = new color then return is strictly probably not needed to populate i also made unnecesary GetPixelSafe - i use two metods liek SetPixelSafe just checks if x,y is in array at all ans SetPixelUnsafe simply frame[y*frame_width+x] = color so if you were interested in speed comparsions you wouldnt need to pass structure at all and that will be faster i agree generally with bot mclean and brown in this discusion 1) its not optimal so its kinda wrong 2) it is simple so its kinda usable and for some uses its handy so not all accusations of this being wring are justified