pango r2745 - in trunk: . examples
- From: behdad svn gnome org
- To: svn-commits-list gnome org
- Subject: pango r2745 - in trunk: . examples
- Date: Wed, 26 Nov 2008 18:05:39 +0000 (UTC)
Author: behdad
Date: Wed Nov 26 18:05:39 2008
New Revision: 2745
URL: http://svn.gnome.org/viewvc/pango?rev=2745&view=rev
Log:
2008-11-26 Behdad Esfahbod <behdad gnome org>
* examples/cairotwisted.c (parametrize_path), (point_on_path):
Handle close_path correctly.
Modified:
trunk/ChangeLog
trunk/examples/cairotwisted.c
Modified: trunk/examples/cairotwisted.c
==============================================================================
--- trunk/examples/cairotwisted.c (original)
+++ trunk/examples/cairotwisted.c Wed Nov 26 18:05:39 2008
@@ -216,7 +216,7 @@
parametrize_path (cairo_path_t *path)
{
int i;
- cairo_path_data_t *data, current_point;
+ cairo_path_data_t *data, last_move_to, current_point;
parametrization_t *parametrization;
parametrization = malloc (path->num_data * sizeof (parametrization[0]));
@@ -226,8 +226,13 @@
parametrization[i] = 0.0;
switch (data->header.type) {
case CAIRO_PATH_MOVE_TO:
+ last_move_to = data[1];
current_point = data[1];
break;
+ case CAIRO_PATH_CLOSE_PATH:
+ /* Make it look like it's a line_to to last_move_to */
+ data = (&last_move_to) - 1;
+ /* fall through */
case CAIRO_PATH_LINE_TO:
parametrization[i] = two_points_distance (¤t_point, &data[1]);
current_point = data[1];
@@ -245,8 +250,6 @@
current_point = data[3];
break;
- case CAIRO_PATH_CLOSE_PATH:
- break;
default:
g_assert_not_reached ();
}
@@ -320,7 +323,7 @@
{
int i;
double ratio, the_y = *y, the_x = *x, dx, dy;
- cairo_path_data_t *data, current_point;
+ cairo_path_data_t *data, last_move_to, current_point;
cairo_path_t *path = param->path;
parametrization_t *parametrization = param->parametrization;
@@ -333,6 +336,7 @@
switch (data->header.type) {
case CAIRO_PATH_MOVE_TO:
current_point = data[1];
+ last_move_to = data[1];
break;
case CAIRO_PATH_LINE_TO:
current_point = data[1];
@@ -352,6 +356,10 @@
case CAIRO_PATH_MOVE_TO:
break;
+ case CAIRO_PATH_CLOSE_PATH:
+ /* Make it look like it's a line_to to last_move_to */
+ data = (&last_move_to) - 1;
+ /* fall through */
case CAIRO_PATH_LINE_TO:
{
ratio = the_x / parametrization[i];
@@ -424,8 +432,6 @@
*y += dx * ratio;
}
break;
- case CAIRO_PATH_CLOSE_PATH:
- break;
default:
g_assert_not_reached ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]