summaryrefslogtreecommitdiff
path: root/gdk/win32/gdkdrawable-win32.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@src.gnome.org>1999-08-16 04:45:01 +0000
committerTor Lillqvist <tml@src.gnome.org>1999-08-16 04:45:01 +0000
commit0455fa3029a4744fa40ab58bf4f837bfa1890509 (patch)
tree0312e5fec05cad870e9209af2ab541fdc97ae6da /gdk/win32/gdkdrawable-win32.c
parent0139b4a3dc5ca5e892534e9d9baae93e66a5b173 (diff)
downloadgtk+-0455fa3029a4744fa40ab58bf4f837bfa1890509.tar.gz
Fix start and end radial endpoint calculations which were totally wrong.
* gdk/win32/gdkdraw.c (gdk_draw_arc): Fix start and end radial endpoint calculations which were totally wrong. (A little RTFMing helps a lot ;-) * gtk/makefile.{cygwin,msc}: Use libintl extracted from glibc from a separate directory, not from gettext, because of licensing issues (we want to use the LGPL version). * README.win32: Mention the intl from glibc vs from gettext issue.
Diffstat (limited to 'gdk/win32/gdkdrawable-win32.c')
-rw-r--r--gdk/win32/gdkdrawable-win32.c41
1 files changed, 34 insertions, 7 deletions
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index 6acf1e488f..8cc0c4b7ce 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -30,8 +30,8 @@
#include <gdk/gdk.h>
#include "gdkprivate.h"
-#ifndef M_TWOPI
-#define M_TWOPI (2.0 * 3.14159265358979323846)
+#ifndef G_PI
+#define G_PI 3.14159265358979323846
#endif
void
@@ -203,22 +203,49 @@ gdk_draw_arc (GdkDrawable *drawable,
if (height == -1)
height = drawable_private->height;
- if (width != 0 && height != 0)
+ GDK_NOTE (MISC, g_print ("gdk_draw_arc: %#x %d,%d,%d,%d %d %d\n",
+ drawable_private->xwindow,
+ x, y, width, height, angle1, angle2));
+
+ if (width != 0 && height != 0 && angle2 != 0)
{
hdc = gdk_gc_predraw (drawable_private, gc_private);
- nXStartArc = x + width/2 + (int) (sin(angle1/64.*M_TWOPI)*width);
- nYStartArc = y + height/2 + (int) (cos(angle1/64.*M_TWOPI)*height);
- nXEndArc = x + width/2 + (int) (sin(angle2/64.*M_TWOPI)*width);
- nYEndArc = y + height/2 + (int) (cos(angle2/64.*M_TWOPI)*height);
+ if (angle2 >= 360*64)
+ {
+ nXStartArc = nYStartArc = nXEndArc = nYEndArc = 0;
+ }
+ else if (angle2 > 0)
+ {
+ /* The 100. is just an arbitrary value */
+ nXStartArc = x + width/2 + 100. * cos(angle1/64.*2.*G_PI/360.);
+ nYStartArc = y + height/2 + -100. * sin(angle1/64.*2.*G_PI/360.);
+ nXEndArc = x + width/2 + 100. * cos((angle1+angle2)/64.*2.*G_PI/360.);
+ nYEndArc = y + height/2 + -100. * sin((angle1+angle2)/64.*2.*G_PI/360.);
+ }
+ else
+ {
+ nXEndArc = x + width/2 + 100. * cos(angle1/64.*2.*G_PI/360.);
+ nYEndArc = y + height/2 + -100. * sin(angle1/64.*2.*G_PI/360.);
+ nXStartArc = x + width/2 + 100. * cos((angle1+angle2)/64.*2.*G_PI/360.);
+ nYStartArc = y + height/2 + -100. * sin((angle1+angle2)/64.*2.*G_PI/360.);
+ }
if (filled)
{
+ GDK_NOTE (MISC, g_print ("...Pie(hdc,%d,%d,%d,%d,%d,%d,%d,%d)\n",
+ x, y, x+width, y+height,
+ nXStartArc, nYStartArc,
+ nXEndArc, nYEndArc));
Pie (hdc, x, y, x+width, y+height,
nXStartArc, nYStartArc, nXEndArc, nYEndArc);
}
else
{
+ GDK_NOTE (MISC, g_print ("...Arc(hdc,%d,%d,%d,%d,%d,%d,%d,%d)\n",
+ x, y, x+width, y+height,
+ nXStartArc, nYStartArc,
+ nXEndArc, nYEndArc));
Arc (hdc, x, y, x+width, y+height,
nXStartArc, nYStartArc, nXEndArc, nYEndArc);
}