~ubuntu-branches/ubuntu/saucy/goffice/saucy-proposed

« back to all changes in this revision

Viewing changes to goffice/utils/go-image.c

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-08-30 14:03:56 UTC
  • mfrom: (1.2.35)
  • Revision ID: package-import@ubuntu.com-20130830140356-a1e30nbdku8kg4q0
Tags: 0.10.6-1
* New upstream release [August 2013].
* Dropped backported "pixbuf-fixes.patch".

Show diffs side-by-side

added added

removed removed

Lines of Context:
418
418
static void
419
419
go_image_draw_fb (GOImage *image, cairo_t *cr)
420
420
{
 
421
#ifdef GOFFICE_WITH_GTK
421
422
        if (image->pixbuf) {
422
423
                cairo_rectangle (cr, 0., 0., image->width, image->height);
423
424
                gdk_cairo_set_source_pixbuf (cr, image->pixbuf, 0, 0);
428
429
                                                                                         "unknown_image", 100, 0, NULL);
429
430
                double dx, dy;
430
431
                int n;
 
432
                if (placeholder == NULL)
 
433
                        return;
431
434
                n = go_fake_floor (image->width / gdk_pixbuf_get_width (placeholder));
432
435
                dx = (image->width - n * gdk_pixbuf_get_width (placeholder)) / 2.;
433
436
                n = go_fake_floor (image->height / gdk_pixbuf_get_height (placeholder));
440
443
                cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
441
444
                cairo_fill (cr);
442
445
                cairo_restore (cr);
 
446
                g_object_unref (placeholder);
443
447
        }
 
448
#endif
444
449
}
445
450
 
446
451
static GdkPixbuf *
447
452
go_image_get_pixbuf_fb (GOImage *image)
448
453
{
 
454
#ifdef GOFFICE_WITH_GTK
449
455
        cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
450
456
                                                                    image->width,
451
457
                                                                    image->height);
479
485
                                                       gdk_pixbuf_get_rowstride (ret));
480
486
        cairo_surface_destroy (surface);
481
487
        return ret;
 
488
#else
 
489
        return NULL;
 
490
#endif
482
491
}
483
492
 
484
493
static GdkPixbuf *
660
669
                }
661
670
        }
662
671
        if (image == NULL) {
 
672
#ifdef GOFFICE_WITH_GTK
663
673
                GdkScreen *screen = gdk_screen_get_default ();
664
674
                GtkIconTheme *theme = screen
665
675
                        ? gtk_icon_theme_get_default()
667
677
                GdkPixbuf *placeholder;
668
678
                const char *icon_name;
669
679
 
670
 
                if (gtk_icon_theme_has_icon (theme,"unknown_image"))
671
 
                        icon_name = "unknown_image";
672
 
                else if (gtk_icon_theme_has_icon (theme,"unknown"))
673
 
                        icon_name = "unknown";
674
 
                else
675
 
                        icon_name = gtk_icon_theme_get_example_icon_name (theme);
676
 
 
677
 
                placeholder = gtk_icon_theme_load_icon (theme, icon_name, 100, 0, NULL);
678
 
                image = go_pixbuf_new_from_pixbuf (placeholder);
679
 
                g_object_unref (placeholder);
680
 
 
681
 
                if (!screen)
682
 
                        g_object_unref (theme);
 
680
                if (theme) {
 
681
                        if (gtk_icon_theme_has_icon (theme, "unknown_image"))
 
682
                                icon_name = "unknown_image";
 
683
                        else if (gtk_icon_theme_has_icon (theme, "unknown"))
 
684
                                icon_name = "unknown";
 
685
                        else
 
686
                                icon_name = gtk_icon_theme_get_example_icon_name (theme);
 
687
 
 
688
                        placeholder = gtk_icon_theme_load_icon (theme, icon_name, 100, 0, NULL);
 
689
                        image = go_pixbuf_new_from_pixbuf (placeholder);
 
690
                        g_object_unref (placeholder);
 
691
 
 
692
                        if (!screen)
 
693
                                g_object_unref (theme);
 
694
                }
 
695
#endif
683
696
        }
684
697
        if (format)
685
698
                *format = g_strdup (type);