~ubuntu-branches/debian/stretch/gpaint/stretch

« back to all changes in this revision

Viewing changes to debian/patches/11_fix_image_rotation.diff

  • Committer: Bazaar Package Importer
  • Author(s): Goedson Teixeira Paixao
  • Date: 2009-12-29 23:04:23 UTC
  • Revision ID: james.westby@ubuntu.com-20091229230423-x1foh5o43h0xxztj
Tags: 0.3.3-6
* debian/patches/26_fix_toolbar.diff: don't set the style for the toolbar,
  allowing gpaint to follow the user's preferences (Closes: #497488)
  (LP: #127296)
* debian/patches/21_fix_crash_on_fill_button_click.dpatch: fixed the check
  for null drawing_area.
* debian/patches/*.dpatch: renamed to *.diff since we're not using dpatch
  anymore
* debian/control: added ${misc:Depends} to the binary package Depends
* debian/patches/*.diff: Added meta information tags compliant with DEP-3
  recommendations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Author: Goedson Teixeira Paixao <goedson@debian.org>
 
2
Description: Fixes rotation operations
 
3
 Implement the rotation in multiples of 90 degrees using the
 
4
 gdk_pixbuf_rotate_simple function instead of the custom (and broken)
 
5
 rotation algorithm
 
6
Bug-Debian: http://bugs.debian.org/497487
 
7
Bug-Ubuntu: https://bugs.edge.launchpad.net/ubuntu/+source/gpaint/+bug/262942
 
8
Forwarded: https://savannah.gnu.org/patch/?6643
 
9
 
 
10
Index: b/src/drawing.c
 
11
===================================================================
 
12
--- a/src/drawing.c     2009-12-19 17:12:10.000000000 -0200
 
13
+++ b/src/drawing.c     2009-12-19 17:12:11.000000000 -0200
 
14
@@ -462,12 +462,23 @@
 
15
 }
 
16
 
 
17
 void
 
18
-drawing_rotate(gpaint_drawing *drawing, double degrees)
 
19
+drawing_rotate(gpaint_drawing *drawing, int degrees)
 
20
 {
 
21
     gpaint_image *image = drawing_create_image(drawing);
 
22
     if (image)
 
23
     {
 
24
-        image_rotate(image, degrees);    
 
25
+        switch (degrees)
 
26
+        {
 
27
+            case 0:
 
28
+            case 90:
 
29
+            case 180:
 
30
+            case 270:
 
31
+                image_rotate_simple(image, degrees);
 
32
+                break;
 
33
+            default:
 
34
+                image_rotate(image, degrees);
 
35
+                break;
 
36
+        }
 
37
         
 
38
         /* copy rotated image on the pixmap */
 
39
         gdk_pixmap_unref(drawing->backing_pixmap);
 
40
Index: b/src/drawing.h
 
41
===================================================================
 
42
--- a/src/drawing.h     2009-12-19 17:11:48.000000000 -0200
 
43
+++ b/src/drawing.h     2009-12-19 17:12:11.000000000 -0200
 
44
@@ -58,6 +58,6 @@
 
45
 void drawing_clear(gpaint_drawing *drawing);
 
46
 void drawing_clear_selection(gpaint_drawing *drawing, gpaint_point_array *points);
 
47
 gboolean drawing_prompt_to_save(gpaint_drawing *drawing);
 
48
-void drawing_rotate(gpaint_drawing *drawing, double degrees);
 
49
+void drawing_rotate(gpaint_drawing *drawing, int degrees);
 
50
 
 
51
 #endif
 
52
Index: b/src/image.c
 
53
===================================================================
 
54
--- a/src/image.c       2009-12-19 17:11:48.000000000 -0200
 
55
+++ b/src/image.c       2009-12-19 17:12:11.000000000 -0200
 
56
@@ -628,6 +628,27 @@
 
57
     return 0;
 
58
 }
 
59
 
 
60
+int
 
61
+image_rotate_simple (gpaint_image *image, int degrees)
 
62
+{
 
63
+       GdkPixbuf *newpixbuf;
 
64
+       
 
65
+       switch (degrees)
 
66
+       {
 
67
+        case GDK_PIXBUF_ROTATE_NONE:
 
68
+        case GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE:
 
69
+        case GDK_PIXBUF_ROTATE_UPSIDEDOWN:
 
70
+        case GDK_PIXBUF_ROTATE_CLOCKWISE:
 
71
+            newpixbuf = gdk_pixbuf_rotate_simple (image->pixbuf, degrees);
 
72
+            gdk_pixbuf_unref (image->pixbuf);
 
73
+            image->pixbuf = newpixbuf;
 
74
+            return 0;
 
75
+            break;
 
76
+        default:
 
77
+            return 1;
 
78
+    }
 
79
+}
 
80
+
 
81
 
 
82
 GdkPixbuf* image_pixbuf(gpaint_image* image) {
 
83
     return image->pixbuf;
 
84
Index: b/src/image.h
 
85
===================================================================
 
86
--- a/src/image.h       2009-12-19 17:11:48.000000000 -0200
 
87
+++ b/src/image.h       2009-12-19 17:12:11.000000000 -0200
 
88
@@ -45,5 +45,6 @@
 
89
 int            image_flip_x(gpaint_image *image);
 
90
 int            image_flip_y(gpaint_image *image);
 
91
 int            image_rotate(gpaint_image *image, double radians);
 
92
+int            image_rotate_simple(gpaint_image *image, int degrees);
 
93
 GdkPixbuf*     image_pixbuf(gpaint_image *image);
 
94
 #endif
 
95
Index: b/src/menu.c
 
96
===================================================================
 
97
--- a/src/menu.c        2009-12-19 17:12:10.000000000 -0200
 
98
+++ b/src/menu.c        2009-12-19 17:12:11.000000000 -0200
 
99
@@ -486,9 +486,9 @@
 
100
 
 
101
     sscanf(name, "rotate_%c%d_menu", &sign, &degrees);
 
102
     debug2("sign = %c  degrees = %d", sign, degrees);
 
103
-    if (sign=='n')
 
104
+    if (sign=='p')
 
105
     {
 
106
-        degrees *= -1;
 
107
+        degrees = 360 - degrees;
 
108
     }
 
109
     canvas_focus_lost(canvas);
 
110
     drawing_rotate(canvas->drawing, degrees);