summaryrefslogtreecommitdiffstats
path: root/graphics/gpaint/patches/11_fix_image_rotation.patch
diff options
context:
space:
mode:
author Petar Petrov2013-06-03 23:27:37 +0200
committer Robby Workman2013-06-04 07:11:33 +0200
commit9a1f447dfc912da1dbb9c656ee1ab54cbb8af686 (patch)
treebc879b2ab623028224152b9220dc3958633e8a8f /graphics/gpaint/patches/11_fix_image_rotation.patch
parentbf4ab6962d0aa471d1906c66041b0f45f8e0391f (diff)
downloadslackbuilds-9a1f447dfc912da1dbb9c656ee1ab54cbb8af686.tar.gz
graphics/gpaint: Added (GNU Paint: a small-scale GTK2 painting program)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'graphics/gpaint/patches/11_fix_image_rotation.patch')
-rw-r--r--graphics/gpaint/patches/11_fix_image_rotation.patch110
1 files changed, 110 insertions, 0 deletions
diff --git a/graphics/gpaint/patches/11_fix_image_rotation.patch b/graphics/gpaint/patches/11_fix_image_rotation.patch
new file mode 100644
index 0000000000..4990b52c28
--- /dev/null
+++ b/graphics/gpaint/patches/11_fix_image_rotation.patch
@@ -0,0 +1,110 @@
+Author: Goedson Teixeira Paixao <goedson@debian.org>
+Description: Fixes rotation operations
+ Implement the rotation in multiples of 90 degrees using the
+ gdk_pixbuf_rotate_simple function instead of the custom (and broken)
+ rotation algorithm
+Bug-Debian: http://bugs.debian.org/497487
+Bug-Ubuntu: https://bugs.edge.launchpad.net/ubuntu/+source/gpaint/+bug/262942
+Forwarded: https://savannah.gnu.org/patch/?6643
+
+Index: b/src/drawing.c
+===================================================================
+--- a/src/drawing.c 2009-12-19 17:12:10.000000000 -0200
++++ b/src/drawing.c 2009-12-19 17:12:11.000000000 -0200
+@@ -462,12 +462,23 @@
+ }
+
+ void
+-drawing_rotate(gpaint_drawing *drawing, double degrees)
++drawing_rotate(gpaint_drawing *drawing, int degrees)
+ {
+ gpaint_image *image = drawing_create_image(drawing);
+ if (image)
+ {
+- image_rotate(image, degrees);
++ switch (degrees)
++ {
++ case 0:
++ case 90:
++ case 180:
++ case 270:
++ image_rotate_simple(image, degrees);
++ break;
++ default:
++ image_rotate(image, degrees);
++ break;
++ }
+
+ /* copy rotated image on the pixmap */
+ gdk_pixmap_unref(drawing->backing_pixmap);
+Index: b/src/drawing.h
+===================================================================
+--- a/src/drawing.h 2009-12-19 17:11:48.000000000 -0200
++++ b/src/drawing.h 2009-12-19 17:12:11.000000000 -0200
+@@ -58,6 +58,6 @@
+ void drawing_clear(gpaint_drawing *drawing);
+ void drawing_clear_selection(gpaint_drawing *drawing, gpaint_point_array *points);
+ gboolean drawing_prompt_to_save(gpaint_drawing *drawing);
+-void drawing_rotate(gpaint_drawing *drawing, double degrees);
++void drawing_rotate(gpaint_drawing *drawing, int degrees);
+
+ #endif
+Index: b/src/image.c
+===================================================================
+--- a/src/image.c 2009-12-19 17:11:48.000000000 -0200
++++ b/src/image.c 2009-12-19 17:12:11.000000000 -0200
+@@ -628,6 +628,27 @@
+ return 0;
+ }
+
++int
++image_rotate_simple (gpaint_image *image, int degrees)
++{
++ GdkPixbuf *newpixbuf;
++
++ switch (degrees)
++ {
++ case GDK_PIXBUF_ROTATE_NONE:
++ case GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE:
++ case GDK_PIXBUF_ROTATE_UPSIDEDOWN:
++ case GDK_PIXBUF_ROTATE_CLOCKWISE:
++ newpixbuf = gdk_pixbuf_rotate_simple (image->pixbuf, degrees);
++ gdk_pixbuf_unref (image->pixbuf);
++ image->pixbuf = newpixbuf;
++ return 0;
++ break;
++ default:
++ return 1;
++ }
++}
++
+
+ GdkPixbuf* image_pixbuf(gpaint_image* image) {
+ return image->pixbuf;
+Index: b/src/image.h
+===================================================================
+--- a/src/image.h 2009-12-19 17:11:48.000000000 -0200
++++ b/src/image.h 2009-12-19 17:12:11.000000000 -0200
+@@ -45,5 +45,6 @@
+ int image_flip_x(gpaint_image *image);
+ int image_flip_y(gpaint_image *image);
+ int image_rotate(gpaint_image *image, double radians);
++int image_rotate_simple(gpaint_image *image, int degrees);
+ GdkPixbuf* image_pixbuf(gpaint_image *image);
+ #endif
+Index: b/src/menu.c
+===================================================================
+--- a/src/menu.c 2009-12-19 17:12:10.000000000 -0200
++++ b/src/menu.c 2009-12-19 17:12:11.000000000 -0200
+@@ -486,9 +486,9 @@
+
+ sscanf(name, "rotate_%c%d_menu", &sign, &degrees);
+ debug2("sign = %c degrees = %d", sign, degrees);
+- if (sign=='n')
++ if (sign=='p')
+ {
+- degrees *= -1;
++ degrees = 360 - degrees;
+ }
+ canvas_focus_lost(canvas);
+ drawing_rotate(canvas->drawing, degrees);