Tk Source Code

View Ticket
Login
Ticket UUID: 701927
Title: extremely long, fat lines not displayed
Type: Bug Version: 8.4.2, 8.6.18, 9.0.5, 9.1b1
Submitter: dgp Created on: 2003-03-12 02:33:38
Subsystem: 05. Canvas Items Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Open Last Modified: 2026-09-22 08:53:08
Resolution: None Closed By:
    Closed on:
Description:
Tk user reports:

> extremely long
> lines still don't render if their width is bigger
than 1.  For example:
> 
>    canvas .c -width 100 -height 100 -bg white
>    pack .c
>    set xbig [expr {pow(2,31)-3}]
>    .c create line 0 30 $xbig 30 -fill red -width 1
>    .c create line 0 50 $xbig 50 -fill blue -width 2
> 
> The second line isn't visible.

Problem exists in both 8.4.2 and 8.4.1 on Win2K,
and in 8.3.4 on Linux/Alpha.

This is not a duplicate of 663981 or 630171.

Might be related to Tk Bug 559792 ?
User Comments: serhiy.storchaka added on 2026-09-22 08:53:08:

Still reproducible with 8.6 and 9.1 on X11 and Windows, and not only for lines: rectangles, ovals, polygons and arcs with such coordinates are not displayed either, and find overlapping does not find them.

The drawing itself is fine (the line clipper from [663981] handles the coordinates in double precision). The problem is the integer bounding box of the item: converting a coordinate near 2^31 to int and then enlarging the box by the width of the item overflows, so the box is garbage and the item is considered not to intersect the visible area. A line of width 1 survives by a few units, which is why only wider lines disappeared.

Fixed in [3ebfb22803] (branch canvas-bbox-overflow): coordinates are clamped to half the int range before the conversion, in all item types. Items partly within ±2^30 pixels are displayed and found as usual; only the part of an item beyond that is not covered by its box, which cannot be displayed anyway. Tests canvas-29.1 and 29.2.


dgp added on 2007-09-06 05:15:28:
Logged In: YES 
user_id=80530
Originator: YES


This appears to still be valid in 8.5a7