gimp r28098 - in trunk: . app/core



Author: neo
Date: Tue Mar  3 15:00:14 2009
New Revision: 28098
URL: http://svn.gnome.org/viewvc/gimp?rev=28098&view=rev

Log:
2009-03-03  Sven Neumann  <sven gimp org>

	Bug 520078 â Rotate brushes

	* app/core/gimpbrush-transform.c: applied patch from Tal that
	improves bilinear interpolation for the brush transformations 
and
	fixes a bug in the calculation of the transformation matrix.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimpbrush-transform.c

Modified: trunk/app/core/gimpbrush-transform.c
==============================================================================
--- trunk/app/core/gimpbrush-transform.c	(original)
+++ trunk/app/core/gimpbrush-transform.c	Tue Mar  3 15:00:14 2009
@@ -126,7 +126,7 @@
    * tl, tr etc are used because it is easier to visualize top left, top right etc
    * corners of the forward transformed source image rectangle.
    */
-  const gint fraction_bits = 8;
+  const gint fraction_bits = 12;
   const gint int_multiple  = pow(2,fraction_bits);
 
   /* In inner loop's bilinear calculation, two numbers that were each previously multiplied by
@@ -165,11 +165,19 @@
   gimp_matrix3_translate (&matrix, -x, -y);
   gimp_matrix3_invert (&matrix);
 
-  result = temp_buf_new (dest_width, dest_height, 1, 0, 0, NULL); //3 instead of 1
+  result = temp_buf_new (dest_width, dest_height, 1, 0, 0, NULL);
 
   dest = temp_buf_get_data (result);
   src  = temp_buf_get_data (brush->mask);
 
+  /* prevent disappearance of 1x1 pixel brush at some rotations when scaling < 1 */
+  /*
+  if (src_width == 1 && src_height == 1 && scale_x < 1 && scale_y < 1 )
+    {
+      *dest = src[0];
+      return result;
+    }*/
+
   gimp_matrix3_transform_point (&matrix, 0,          0,           &tlx, &tly);
   gimp_matrix3_transform_point (&matrix, dest_width, 0,           &trx, &try);
   gimp_matrix3_transform_point (&matrix, 0,          dest_height, &blx, &bly);
@@ -220,9 +228,6 @@
               /* no corresponding pixel in source space */
             {
               *dest = 0;
-           /* dest[0] = 0;
-              dest[1] = 0;
-              dest[2] = 0;*/
             }
           else /* reverse transformed point hits source pixel */
             {
@@ -361,7 +366,7 @@
    * tl, tr etc are used because it is easier to visualize top left, top right etc
    * corners of the forward transformed source image rectangle.
    */
-  const gint fraction_bits = 8;
+  const gint fraction_bits = 12;
   const gint int_multiple  = pow(2,fraction_bits);
 
   /* In inner loop's bilinear calculation, two numbers that were each previously multiplied by
@@ -550,7 +555,7 @@
   const gdouble center_y = brush->mask->height / 2;
 
   gimp_matrix3_identity (matrix);
-  gimp_matrix3_translate (matrix, - center_x, - center_x);
+  gimp_matrix3_translate (matrix, - center_x, - center_y);
   gimp_matrix3_rotate (matrix, -2 * G_PI * angle);
   gimp_matrix3_translate (matrix, center_x, center_y);
   gimp_matrix3_scale (matrix, scale_x, scale_y);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]