FLTK logo

STR #3134

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]

STR #3134

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:2 - Specific to an operating system
Subsystem:X11
Summary:fl_clip_box fails on X11 with large coordinates
Version:1.3-current
Created By:ajapted
Assigned To:AlbrechtS
Fix Version:1.4.0
Fix Commit:12c050980692c05fb3eb59acd7aba6a46bea4bf8
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:


Name/Time/Date Filename/Size  
 
#1 AlbrechtS
06:41 May 26, 2021
clip_box.cxx
2k
 
     

Trouble Report Comments:


Name/Time/Date Text  
 
#1 ajapted
22:30 Sep 16, 2014
fl_clip_box() does not work properly when the input coordinates
are outside of 16-bit values.  For example, I passed sy=-70000
and sh=9000 and got a valid output Y range, even though it should
have rejected the rectangle completely.

This is probably because of 16-bit limitations of X11 formats
(like the Region structure).  But I think FLTK can work around
that limitation fairly easily (e.g. pre-clipping to a rectangle
of 0,0 to 32767,32767).

STR #1929 is related, it required that 32-bit coordinates work
with all FLTK drawing functions.
 
 
#2 AlbrechtS
06:41 May 26, 2021
Thanks to ajapted for the report, and sorry for the late reply and fix.

As suggested, the given rectangle is now "pre-clipped" to the X11 16-bit coordinate range and then used internally to calculate the clipping box.

Uploaded demo program clip_box.cxx shows the effect with some example clipping values. See example code for details.

FTR, output on Linux/X11, clipped to 16-bit coordinates:

---  NO CLIPPING  ---
fl_clip_box(    100,     100,    200,    200) => 0 (    100,     100,    200,    200)
fl_clip_box(-100000, -100000, 200000, 200000) => 1 ( -32760,  -32760,  65520,  65520)
fl_clip_box( -33000,  -33000,   2000,   2000) => 1 ( -32760,  -32760,   1760,   1760)
fl_clip_box(   -100,    -100,    180,    100) => 0 (   -100,    -100,    180,    100)
fl_clip_box(   -100,    -100,    180,    200) => 0 (   -100,    -100,    180,    200)

---  CLIP TO BOX (20, 20, 80, 25)  ---
fl_clip_box(    100,     100,    200,    200) => 2 (    100,     100,      0,      0)
fl_clip_box(-100000, -100000, 200000, 200000) => 1 (     20,      20,     80,     25)
fl_clip_box( -33000,  -33000,   2000,   2000) => 2 ( -32760,  -32760,      0,      0)
fl_clip_box(   -100,    -100,    180,    100) => 2 (   -100,    -100,      0,      0)
fl_clip_box(   -100,    -100,    180,    200) => 1 (     20,      20,     60,     25)

For comparison, output on Windows, using full 32-bit coordinate space:

---  NO CLIPPING  ---
fl_clip_box(    100,     100,    200,    200) => 0 (    100,     100,    200,    200)
fl_clip_box(-100000, -100000, 200000, 200000) => 0 (-100000, -100000, 200000, 200000)
fl_clip_box( -33000,  -33000,   2000,   2000) => 0 ( -33000,  -33000,   2000,   2000)
fl_clip_box(   -100,    -100,    180,    100) => 0 (   -100,    -100,    180,    100)
fl_clip_box(   -100,    -100,    180,    200) => 0 (   -100,    -100,    180,    200)

---  CLIP TO BOX (20, 20, 80, 25)  ---
fl_clip_box(    100,     100,    200,    200) => 2 (    100,     100,      0,      0)
fl_clip_box(-100000, -100000, 200000, 200000) => 1 (     20,      20,     80,     25)
fl_clip_box( -33000,  -33000,   2000,   2000) => 2 ( -33000,  -33000,      0,      0)
fl_clip_box(   -100,    -100,    180,    100) => 2 (   -100,    -100,      0,      0)
fl_clip_box(   -100,    -100,    180,    200) => 1 (     20,      20,     60,     25)
 
     

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.