~ubuntu-branches/ubuntu/wily/epiphany-browser/wily

« back to all changes in this revision

Viewing changes to lib/ephy-snapshot-service.c

Tags: upstream-3.10.1
ImportĀ upstreamĀ versionĀ 3.10.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include "config.h"
22
22
#include "ephy-snapshot-service.h"
23
23
 
 
24
#include "ephy-favicon-helpers.h"
 
25
 
24
26
#ifndef GNOME_DESKTOP_USE_UNSTABLE_API
25
27
#define GNOME_DESKTOP_USE_UNSTABLE_API
26
28
#endif
170
172
  EphySnapshotService *service;
171
173
 
172
174
  data = (SnapshotAsyncData *)g_simple_async_result_get_op_res_gpointer (result);
173
 
  data->snapshot = ephy_snapshot_service_crop_snapshot (surface);
 
175
  data->snapshot = ephy_snapshot_service_prepare_snapshot (surface,
 
176
                                                           webkit_web_view_get_favicon (data->web_view));
174
177
 
175
178
  service = (EphySnapshotService *)g_async_result_get_source_object (G_ASYNC_RESULT (result));
176
179
  ephy_snapshot_service_save_snapshot_async (service, data->snapshot,
613
616
}
614
617
 
615
618
GdkPixbuf *
616
 
ephy_snapshot_service_crop_snapshot (cairo_surface_t *surface)
 
619
ephy_snapshot_service_prepare_snapshot (cairo_surface_t *surface,
 
620
                                        cairo_surface_t *favicon)
617
621
{
618
622
  GdkPixbuf *snapshot, *scaled;
619
623
  int orig_width, orig_height;
656
660
 
657
661
  g_object_unref (snapshot);
658
662
 
 
663
  if (favicon) {
 
664
    GdkPixbuf* fav_pixbuf;
 
665
    int favicon_size = 16;
 
666
    int x_offset = 6;
 
667
    int y_offset = gdk_pixbuf_get_height (scaled) - favicon_size - x_offset;
 
668
    fav_pixbuf = ephy_pixbuf_get_from_surface_scaled (favicon, favicon_size, favicon_size);
 
669
    gdk_pixbuf_composite (fav_pixbuf, scaled,
 
670
                          x_offset, y_offset, favicon_size, favicon_size,
 
671
                          x_offset, y_offset, 1, 1,
 
672
                          GDK_INTERP_NEAREST, 255);
 
673
    g_object_unref (fav_pixbuf);
 
674
  }
 
675
 
659
676
  return scaled;
660
677
}