Make it bitbake-able without the -b switch by correcting DEPENDS variables
[oespirit1] / gtkhtml / gtkhtml_150_image_magnification.diff
1 diff -r -U5 gtkhtml-3.24.4/gtkhtml/gtkhtml.c gtkhtml-3.24.4/gtkhtml/gtkhtml.c
2 --- gtkhtml-3.24.4/gtkhtml/gtkhtml.c    2008-10-16 11:45:07.000000000 +0200
3 +++ gtkhtml-3.24.4/gtkhtml/gtkhtml.c    2008-10-16 11:42:21.000000000 +0200
4 @@ -6048,12 +6048,14 @@
5                 html_font_manager_set_magnification (&GTK_HTML (HTML_FRAME (o)->html)->engine->painter->font_manager,
6                                                      *(gdouble *) data);
7         } else if (HTML_IS_IFRAME (o)) {
8                 html_font_manager_set_magnification (&GTK_HTML (HTML_IFRAME (o)->html)->engine->painter->font_manager,
9                                                      *(gdouble *) data);
10 -       } else if (HTML_IS_TEXT (o))
11 -               html_text_calc_font_size (HTML_TEXT (o), e);
12 +       } else if (HTML_IS_TEXT (o)) {
13 +               html_text_calc_font_size (HTML_TEXT (o), e); 
14 +       } else if (HTML_IS_IMAGE (o))
15 +               html_image_set_magnification (HTML_IMAGE (o), (*((gdouble *)data))) ;
16  }
17  
18  void
19  gtk_html_set_magnification (GtkHTML *html, gdouble magnification)
20  {
21 diff -r -U5 gtkhtml-3.24.4/gtkhtml/htmlimage.c gtkhtml-3.24.4/gtkhtml/htmlimage.c
22 --- gtkhtml-3.24.4/gtkhtml/htmlimage.c  2008-10-16 11:45:06.000000000 +0200
23 +++ gtkhtml-3.24.4/gtkhtml/htmlimage.c  2008-10-16 11:42:26.000000000 +0200
24 @@ -70,10 +70,17 @@
25  static gint                html_image_pointer_update            (HTMLImagePointer *ip);
26  static void                html_image_pointer_start_animation   (HTMLImagePointer *ip);
27  
28  static GdkPixbuf *         html_image_factory_get_missing       (HTMLImageFactory *factory);
29  
30 +void
31 +html_image_set_magnification (HTMLImage *image, gdouble new_magnification)
32 +{
33 +       if (NULL == image) return ;
34 +       image->magnification = new_magnification ;
35 +}
36 +
37  guint
38  html_image_get_actual_width (HTMLImage *image, HTMLPainter *painter)
39  {
40         GdkPixbufAnimation *anim = image->image_ptr->animation;
41         gint pixel_size = painter ? html_painter_get_pixel_size (painter) : 1;
42 @@ -81,17 +88,17 @@
43  
44         if (image->percent_width) {
45                 /* The cast to `gdouble' is to avoid overflow (eg. when
46                     printing).  */
47                 width = ((gdouble) HTML_OBJECT (image)->max_width
48 -                        * image->specified_width) / 100;
49 +                        * image->specified_width) / 100 * image->magnification;
50         } else if (image->specified_width > 0) {
51 -               width = image->specified_width * pixel_size;
52 +               width = image->specified_width * pixel_size * image->magnification;
53         } else if (image->image_ptr == NULL || anim == NULL) {
54 -               width = DEFAULT_SIZE * pixel_size;
55 +               width = DEFAULT_SIZE * pixel_size * image->magnification;
56         } else {
57 -               width = gdk_pixbuf_animation_get_width (anim) * pixel_size;
58 +               width = gdk_pixbuf_animation_get_width (anim) * pixel_size * image->magnification;
59  
60                 if (image->specified_height > 0 || image->percent_height) {
61                         double scale;
62  
63                         scale =  ((double) html_image_get_actual_height (image, painter))
64 @@ -114,17 +121,17 @@
65  
66         if (image->percent_height) {
67                 /* The cast to `gdouble' is to avoid overflow (eg. when
68                     printing).  */
69                 height = ((gdouble) html_engine_get_view_height (image->image_ptr->factory->engine)
70 -                         * image->specified_height) / 100;
71 +                         * image->specified_height) / 100 * image->magnification;
72         } else if (image->specified_height > 0) {
73 -               height = image->specified_height * pixel_size;
74 +               height = image->specified_height * pixel_size * image->magnification;
75         } else if (image->image_ptr == NULL || anim == NULL) {
76 -               height = DEFAULT_SIZE * pixel_size;
77 +               height = DEFAULT_SIZE * pixel_size * image->magnification;
78         } else {
79 -               height = gdk_pixbuf_animation_get_height (anim) * pixel_size;
80 +               height = gdk_pixbuf_animation_get_height (anim) * pixel_size * image->magnification;
81  
82                 if (image->specified_width > 0 || image->percent_width) {
83                         double scale;
84  
85                         scale = ((double) html_image_get_actual_width (image, painter))
86 @@ -852,11 +859,11 @@
87         image->vspace = 0;
88  
89         if (valign == HTML_VALIGN_NONE)
90                 valign = HTML_VALIGN_BOTTOM;
91         image->valign = valign;
92 -
93 +       image->magnification = 1.0 ;
94         image->image_ptr = html_image_factory_register (imf, image, filename, reload);
95  }
96  
97  HTMLObject *
98  html_image_new (HTMLImageFactory *imf,
99 diff -r -U5 gtkhtml-3.24.4/gtkhtml/htmlimage.h gtkhtml-3.24.4/gtkhtml/htmlimage.h
100 --- gtkhtml-3.24.4/gtkhtml/htmlimage.h  2008-06-13 05:05:58.000000000 +0200
101 +++ gtkhtml-3.24.4/gtkhtml/htmlimage.h  2008-10-16 11:44:16.000000000 +0200
102 @@ -71,10 +71,11 @@
103         gchar *url;
104         gchar *target;
105         gchar *alt;
106         gchar *usemap;
107         gchar *final_url;
108 +       gdouble magnification;
109  };
110  
111  struct _HTMLImageClass {
112         HTMLObjectClass parent_class;
113  };
114 @@ -139,10 +140,12 @@
115                                             const gchar     *url);
116  guint       html_image_get_actual_width    (HTMLImage       *image,
117                                             HTMLPainter     *painter);
118  guint       html_image_get_actual_height   (HTMLImage       *image,
119                                             HTMLPainter     *painter);
120 +void        html_image_set_magnification   (HTMLImage       *image,
121 +                                           gdouble new_magnification) ;
122  /* FIXME move to htmlimagefactory.c */
123  HTMLImageFactory *html_image_factory_new                    (HTMLEngine       *e);
124  void              html_image_factory_free                   (HTMLImageFactory *factory);
125  void              html_image_factory_cleanup                (HTMLImageFactory *factory); /* Does gc etc. - removes unused image entries */
126  void              html_image_factory_stop_animations        (HTMLImageFactory *factory);