mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 16:12:13 +08:00
Avoiding problems with some platforms that don't implement hypot() (STR #1366)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5349 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
CHANGES IN FLTK 1.1.8
|
CHANGES IN FLTK 1.1.8
|
||||||
|
|
||||||
|
- Avoiding problems with some platforms that don't
|
||||||
|
implement hypot() (STR #1366)
|
||||||
- Fixed floating point value formatting
|
- Fixed floating point value formatting
|
||||||
for Fl_Spinner (STR #1331)
|
for Fl_Spinner (STR #1331)
|
||||||
- Fixed Fl_Positioner callback
|
- Fixed Fl_Positioner callback
|
||||||
|
|||||||
+8
-7
@@ -32,11 +32,12 @@
|
|||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
#include <FL/math.h>
|
#include <FL/math.h>
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
// avoid problems with some platforms that don't
|
||||||
// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
|
// implement hypot.
|
||||||
// on Windows, which is supposed to be POSIX compliant...
|
static double _fl_hypot(double x, double y) {
|
||||||
# define hypot _hypot
|
return sqrt(x*x + y*y);
|
||||||
#endif // WIN32 && !__CYGWIN__
|
}
|
||||||
|
|
||||||
|
|
||||||
void fl_arc(double x, double y, double r, double start, double end) {
|
void fl_arc(double x, double y, double r, double start, double end) {
|
||||||
|
|
||||||
@@ -50,9 +51,9 @@ void fl_arc(double x, double y, double r, double start, double end) {
|
|||||||
// Maximum arc length to approximate with chord with error <= 0.125
|
// Maximum arc length to approximate with chord with error <= 0.125
|
||||||
|
|
||||||
double epsilon; {
|
double epsilon; {
|
||||||
double r1 = hypot(fl_transform_dx(r,0), // Horizontal "radius"
|
double r1 = _fl_hypot(fl_transform_dx(r,0), // Horizontal "radius"
|
||||||
fl_transform_dy(r,0));
|
fl_transform_dy(r,0));
|
||||||
double r2 = hypot(fl_transform_dx(0,r), // Vertical "radius"
|
double r2 = _fl_hypot(fl_transform_dx(0,r), // Vertical "radius"
|
||||||
fl_transform_dy(0,r));
|
fl_transform_dy(0,r));
|
||||||
|
|
||||||
if (r1 > r2) r1 = r2; // r1 = minimum "radius"
|
if (r1 > r2) r1 = r2; // r1 = minimum "radius"
|
||||||
|
|||||||
Reference in New Issue
Block a user