[gimp] app: move adding an arc path out to a utility function
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: move adding an arc path out to a utility function
- Date: Fri, 24 Sep 2010 11:14:16 +0000 (UTC)
commit 74fe162f934ce1a23184e7f6bdae705e7ccb6701
Author: Michael Natterer <mitch gimp org>
Date: Fri Sep 24 13:12:34 2010 +0200
app: move adding an arc path out to a utility function
app/display/gimpcanvashandle.c | 32 ++++++++------------------------
app/widgets/gimpcairo.c | 24 ++++++++++++++++++++++++
app/widgets/gimpcairo.h | 6 ++++++
3 files changed, 38 insertions(+), 24 deletions(-)
---
diff --git a/app/display/gimpcanvashandle.c b/app/display/gimpcanvashandle.c
index 534a91a..e77034d 100644
--- a/app/display/gimpcanvashandle.c
+++ b/app/display/gimpcanvashandle.c
@@ -28,6 +28,8 @@
#include "display-types.h"
+#include "widgets/gimpcairo.h"
+
#include "gimpcanvashandle.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-transform.h"
@@ -430,18 +432,9 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
break;
case GIMP_HANDLE_CIRCLE:
- if (private->slice_angle >= 0)
- {
- cairo_arc_negative (cr, x, y, private->width / 2,
- - private->start_angle,
- - private->start_angle - private->slice_angle);
- }
- else
- {
- cairo_arc (cr, x, y, private->width / 2,
- - private->start_angle,
- - private->start_angle - private->slice_angle);
- }
+ gimp_cairo_add_arc (cr, x, y, private->width / 2,
+ private->start_angle,
+ private->slice_angle);
_gimp_canvas_item_stroke (item, shell, cr);
break;
@@ -449,18 +442,9 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
case GIMP_HANDLE_FILLED_CIRCLE:
cairo_move_to (cr, x, y);
- if (private->slice_angle >= 0)
- {
- cairo_arc_negative (cr, x, y, (gdouble) private->width / 2.0,
- - private->start_angle,
- - private->start_angle - private->slice_angle);
- }
- else
- {
- cairo_arc (cr, x, y, (gdouble) private->width / 2.0,
- - private->start_angle,
- - private->start_angle - private->slice_angle);
- }
+ gimp_cairo_add_arc (cr, x, y, (gdouble) private->width / 2.0,
+ private->start_angle,
+ private->slice_angle);
_gimp_canvas_item_fill (item, shell, cr);
break;
diff --git a/app/widgets/gimpcairo.c b/app/widgets/gimpcairo.c
index 86738ba..e8276e7 100644
--- a/app/widgets/gimpcairo.c
+++ b/app/widgets/gimpcairo.c
@@ -88,6 +88,30 @@ gimp_cairo_stipple_pattern_create (const GimpRGB *fg,
}
void
+gimp_cairo_add_arc (cairo_t *cr,
+ gdouble center_x,
+ gdouble center_y,
+ gdouble radius,
+ gdouble start_angle,
+ gdouble slice_angle)
+{
+ g_return_if_fail (cr != NULL);
+
+ if (slice_angle >= 0)
+ {
+ cairo_arc_negative (cr, center_x, center_y, radius,
+ - start_angle,
+ - start_angle - slice_angle);
+ }
+ else
+ {
+ cairo_arc (cr, center_x, center_y, radius,
+ - start_angle,
+ - start_angle - slice_angle);
+ }
+}
+
+void
gimp_cairo_add_segments (cairo_t *cr,
GdkSegment *segs,
gint n_segs)
diff --git a/app/widgets/gimpcairo.h b/app/widgets/gimpcairo.h
index 52cb071..9328d95 100644
--- a/app/widgets/gimpcairo.h
+++ b/app/widgets/gimpcairo.h
@@ -29,6 +29,12 @@ cairo_pattern_t * gimp_cairo_stipple_pattern_create (const GimpRGB *fg,
const GimpRGB *bg,
gint index);
+void gimp_cairo_add_arc (cairo_t *cr,
+ gdouble center_x,
+ gdouble center_y,
+ gdouble radius,
+ gdouble start_angle,
+ gdouble slice_angle);
void gimp_cairo_add_segments (cairo_t *cr,
GdkSegment *segs,
gint n_segs);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]