DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 557NwNDO4150328 Authentication-Results: delorie.com; dmarc=none (p=none dis=none) header.from=delorie.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=delorie.com X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 557NwMKA4150304 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=xs4all.nl Authentication-Results: delorie.com; spf=pass smtp.mailfrom=xs4all.nl DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 557NwMKA4150304 Authentication-Results: delorie.com; dkim=pass (2048-bit key, unprotected) header.d=xs4all.nl header.i=@xs4all.nl header.a=rsa-sha256 header.s=xs4all01 header.b=ZYyhM1aO X-Recipient: geda-user AT delorie DOT com X-KPN-MessageId: 68c17fbe-43fb-11f0-86cf-005056aba152 X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=xs4all01; h=content-type:from:to:subject:mime-version:date:message-id; bh=2zxvdWYGKEs7eSDRi6fpbPsSnb1ZW01u3hrGEOZpM3Y=; b=ZYyhM1aOQfwOfL37ZtTyfqquZdG/THZq79RqmkzTPm9qRPFi9Rlm2ttiewO9VAD8TiH+uYUTamGdu nEpxEA2JSOGUCTv/fcMPejl5Zq2Vwwip/oz8SHsmbx9UUVRdwXgr0k/aEEFSqcyNvq3UZbUduFJIuP ePiSK1k/yate4BrdNikSelMZ1jq957WHAOOGy4+5JHri9EYNMCDPOCMKGZBuBWreDmhCz5voKrFqO/ +tqn8yL5lR3TUyFMWwb4WeJvgTaiqy0ufbUkykPgCPUKo3idI4iR36T5Rx0v6ZzJZl9t487o5zI7bI 6cpKEEjJ/zyipMksw3vWFK+xBeeMmDw== X-KPN-MID: 33|23IOWrwrL2EcdGLIwwe/hdT7gthWLl8VY9ziSqNdqnvmVqnBE5Sv/M+g4/OtmUe Nf6OqXkMFpPDOyR6ODUMzs34dUSUKkWthTV2+8fORGJ4= X-KPN-VerifiedSender: Yes X-CMASSUN: 33|76FIfDYV/XaMFVE7swiQUh1PBnFRrob3V49RdYCAVZtZ5nT5xVgjs+eno93mxUK ELo3vcAVtU+UoCG4lTnunjA== X-Originating-IP: 213.197.39.252 Message-ID: <5649b184-bf2b-4e34-bb99-6fa0830abdd5@xs4all.nl> Date: Sun, 8 Jun 2025 01:58:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [geda-user] --bg-image crashes pcb (lesstif gui) To: geda-user AT delorie DOT com References: Content-Language: en-US From: "Bert Timmerman (ljh4timm AT xs4all DOT nl) [via geda-user AT delorie DOT com]" Organization: me organised ? In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Pushed to master on https://github.com/gEDA-pcb-developers/pcb kind regards, Bert Timmerman On 22-05-2025 03:54, Johann Klammer (klammerj AT a1 DOT net) [via geda-user AT delorie DOT com] wrote: > I tried loading a P6 pixmap as indicated in the documentation but got: > > Program received signal SIGSEGV, Segmentation fault. > 0x0000555555641742 in DrawBackgroundImage () at hid/lesstif/main.c:1155 > 1155 XPutPixel (bgi, x, y, bg[ir][ic]); > > ir=-190 > ic=0 > > very first iteration > x=0 > (gdb) p pr > $9 = -6946757 > > increasing the board height makes it load. but scaling seems off.. > zooming causes crash. > > scaling down the image does not help. > > This seems to fix things: > > static unsigned long PickBgPixel(Pixel **bg,int rows,int cols,int r,int c) > { > if((r=0)&&(c=0))return bg[r][c]; > else return bgcolor; > } > > static void > DrawBackgroundImage () > { > int x, y, w, h; > double xscale, yscale; > > if (!window || !bg) > return; > > if (!bgi || view_width != bgi_w || view_height != bgi_h) > { > if (bgi) > XDestroyImage (bgi); > /* Cheat - get the image, which sets up the format too. */ > bgi = XGetImage (XtDisplay(work_area), > window, > 0, 0, view_width, view_height, > -1, ZPixmap); > bgi_w = view_width; > bgi_h = view_height; > } > > w = view_width; > h = view_height; > > xscale = (double)bg_w / PCB->MaxWidth; > yscale = (double)bg_h / PCB->MaxHeight; > > for (y=0; y { > int pr = Py(y); > int ir = pr * yscale; > for (x=0; x { > int pc = Px(x); > int ic = pc * xscale; > XPutPixel (bgi, x, y, PickBgPixel(bg,bg_h,bg_w,ir,ic)); > } > } > XPutImage(display, main_pixmap, bg_gc, > bgi, > 0, 0, 0, 0, w, h); > } > > (my source tree is too hosed to be able to format a proper diff...)