[sapwood] cropping cleanup



commit 0396e7f3d93fb5c74d90e0489f658c02af52243b
Author: Sven Herzberg <herzi gnome-de org>
Date:   Thu Aug 12 10:54:09 2010 +0200

    cropping cleanup
    
    * engine/sapwood-pixmap.c: remove code disabled by #if 0; cleanup other
      unused passages as well

 engine/sapwood-pixmap.c |   49 +----------------------------------------------
 1 files changed, 1 insertions(+), 48 deletions(-)
---
diff --git a/engine/sapwood-pixmap.c b/engine/sapwood-pixmap.c
index b383375..a55af68 100644
--- a/engine/sapwood-pixmap.c
+++ b/engine/sapwood-pixmap.c
@@ -415,37 +415,15 @@ sapwood_crop_pixmap (cairo_surface_t* surface,
         }
       else
         {
-          cairo_matrix_t  matrix;
-          int             width = 1;
-          int             height = 1;
-
-          gdk_drawable_get_size (mask, &width, &height);
-
           cairo_t* tmp_cr = gdk_cairo_create (mask);
-          cairo_pattern_t* pattern = cairo_pattern_create_for_surface (cairo_get_target (tmp_cr));
 
-          cairo_matrix_init_translate (&matrix, (original_width - requested_width), 0);
-          cairo_pattern_set_matrix (pattern,
-                                    &matrix);
-
-#if 1
           cairo_paint (cr);
-#else
-          cairo_mask (cr, pattern);
-#endif
-#if 0
-          /* enable this to test the cropping of the right */
-          cairo_set_source_rgba (cr, 0.5, 0.0, 0.0, 0.5);
-          cairo_mask (cr, pattern);
-#endif
-          cairo_pattern_destroy (pattern);
 
           /* adjust the bitmap */
           cairo_set_source_surface (tmp_cr, cairo_get_target (tmp_cr), -(original_width - requested_width), 0);
           cairo_set_operator (tmp_cr, CAIRO_OPERATOR_SOURCE);
           cairo_rectangle (tmp_cr, left, 0, right, MAX (original_height, requested_height));
-          cairo_clip (tmp_cr);
-          cairo_paint (tmp_cr);
+          cairo_fill (tmp_cr);
 
           cairo_destroy (tmp_cr);
         }
@@ -470,28 +448,9 @@ sapwood_crop_pixmap (cairo_surface_t* surface,
         }
       else
         {
-          cairo_matrix_t  matrix;
-
           cairo_t* tmp_cr = gdk_cairo_create (mask);
-          cairo_pattern_t* pattern = cairo_pattern_create_for_surface (cairo_get_target (tmp_cr));
-
-          cairo_matrix_init_translate (&matrix, 0, (original_height - requested_height));
-          cairo_pattern_set_extend (pattern,
-                                    CAIRO_EXTEND_REPEAT);
-          cairo_pattern_set_matrix (pattern,
-                                    &matrix);
 
-#if 1
           cairo_paint (cr);
-#else
-          cairo_mask (cr, pattern);
-#endif
-#if 0
-          /* enable this to test the cropping of the bottom */
-          cairo_set_source_rgba (cr, 0.0, 0.0, 0.5, 0.5);
-          cairo_mask (cr, pattern);
-#endif
-          cairo_pattern_destroy (pattern);
 
           /* adjust the bitmap */
           cairo_set_source_surface (tmp_cr, cairo_get_target (tmp_cr), 0, -(original_height - requested_height));
@@ -504,12 +463,6 @@ sapwood_crop_pixmap (cairo_surface_t* surface,
       cairo_restore (cr);
     }
 
-#if 0
-  /* enable this to test the mask only */
-  cairo_set_source_rgb (cr, 0.0, 0.5, 0.0);
-  cairo_paint (cr);
-#endif
-
   cairo_destroy (cr);
 }
 



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