Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 290464
Collapse All | Expand All

(-)a/glib/poppler-page.cc (-10 / +10 lines)
Lines 609-636 create_surface_from_thumbnail_data (guchar *data, Link Here
609
				    gint    rowstride)
609
				    gint    rowstride)
610
{
610
{
611
  guchar *cairo_pixels;
611
  guchar *cairo_pixels;
612
  gint cairo_stride;
612
  cairo_surface_t *surface;
613
  cairo_surface_t *surface;
613
  static cairo_user_data_key_t key;
614
  int j;
614
  int j;
615
615
616
  cairo_pixels = (guchar *)g_malloc (4 * width * height);
616
  surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height);
617
  surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels,
617
  if (cairo_surface_status (surface))
618
						 CAIRO_FORMAT_RGB24,
618
    return NULL;
619
						 width, height, 4 * width);
619
620
  cairo_surface_set_user_data (surface, &key,
620
  cairo_pixels = cairo_image_surface_get_data (surface);
621
			       cairo_pixels, (cairo_destroy_func_t)g_free);
621
  cairo_stride = cairo_image_surface_get_stride (surface);
622
622
623
  for (j = height; j; j--) {
623
  for (j = height; j; j--) {
624
    guchar *p = data;
624
    guchar *p = data;
625
    guchar *q = cairo_pixels;
625
    guchar *q = cairo_pixels;
626
    guchar *end = p + 3 * width;
626
    guchar *end = p + 3 * width;
627
	  
627
628
    while (p < end) {
628
    while (p < end) {
629
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
629
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
630
      q[0] = p[2];
630
      q[0] = p[2];
631
      q[1] = p[1];
631
      q[1] = p[1];
632
      q[2] = p[0];
632
      q[2] = p[0];
633
#else	  
633
#else
634
      q[1] = p[0];
634
      q[1] = p[0];
635
      q[2] = p[1];
635
      q[2] = p[1];
636
      q[3] = p[2];
636
      q[3] = p[2];
Lines 640-646 create_surface_from_thumbnail_data (guchar *data, Link Here
640
    }
640
    }
641
641
642
    data += rowstride;
642
    data += rowstride;
643
    cairo_pixels += 4 * width;
643
    cairo_pixels += cairo_stride;
644
  }
644
  }
645
645
646
  return surface;
646
  return surface;

Return to bug 290464