Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 426352 | Differences between
and this patch

Collapse All | Expand All

(-)../htmldoc-orig-with-patches/htmldoc/image.cxx (-14 / +16 lines)
Lines 1475-1481 Link Here
1475
  png_bytep trans_alpha;
1475
  png_bytep trans_alpha;
1476
  int num_trans;
1476
  int num_trans;
1477
  png_color_16p trans_color;
1477
  png_color_16p trans_color;
1478
1478
  int color_type;		
1479
1479
1480
 /*
1480
 /*
1481
  * Setup the PNG data structures...
1481
  * Setup the PNG data structures...
Lines 1528-1535 Link Here
1528
  */
1528
  */
1529
1529
1530
  png_read_info(pp, info);
1530
  png_read_info(pp, info);
1531
1531
  
1532
  if (png_get_color_type(pp, info) & PNG_COLOR_MASK_PALETTE)
1532
  color_type = png_get_color_type(pp, info);
1533
  gray = color_type == PNG_COLOR_TYPE_GRAY;
1534
  
1535
  if (color_type & PNG_COLOR_MASK_PALETTE)
1533
  {
1536
  {
1534
    png_set_expand(pp);
1537
    png_set_expand(pp);
1535
1538
Lines 1543-1552 Link Here
1543
    png_set_packing(pp);
1546
    png_set_packing(pp);
1544
    png_set_expand(pp);
1547
    png_set_expand(pp);
1545
  }
1548
  }
1546
  else if (png_get_bit_depth(pp, info) == 16)
1549
  else if (png_get_bit_depth(pp, info) == 16) {
1547
    png_set_strip_16(pp);
1550
    png_set_strip_16(pp);
1548
1551
  }
1549
  if (png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
1552
  if (color_type & PNG_COLOR_MASK_COLOR)
1550
  {
1553
  {
1551
    depth      = 3;
1554
    depth      = 3;
1552
    img->depth = gray ? 1 : 3;
1555
    img->depth = gray ? 1 : 3;
Lines 1561-1567 Link Here
1561
  img->height = png_get_image_height(pp, info);
1564
  img->height = png_get_image_height(pp, info);
1562
1565
1563
  png_get_tRNS(pp, info, &trans_alpha, &num_trans, &trans_color);
1566
  png_get_tRNS(pp, info, &trans_alpha, &num_trans, &trans_color);
1564
  if ((png_get_color_type(pp, info) & PNG_COLOR_MASK_ALPHA) || num_trans)
1567
  if ((color_type & PNG_COLOR_MASK_ALPHA) || num_trans)
1565
  {
1568
  {
1566
    if ((PSLevel == 0 && PDFVersion >= 14) || PSLevel == 3)
1569
    if ((PSLevel == 0 && PDFVersion >= 14) || PSLevel == 3)
1567
      image_need_mask(img, 8);
1570
      image_need_mask(img, 8);
Lines 1575-1588 Link Here
1575
1578
1576
#ifdef DEBUG
1579
#ifdef DEBUG
1577
  printf("color_type=0x%04x, depth=%d, img->width=%d, img->height=%d, img->depth=%d\n",
1580
  printf("color_type=0x%04x, depth=%d, img->width=%d, img->height=%d, img->depth=%d\n",
1578
         png_get_color_type(pp, info), depth, img->width, img->height, img->depth);
1581
         color_type, depth, img->width, img->height, img->depth);
1579
  if (png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
1582
  if (color_type & PNG_COLOR_MASK_COLOR)
1580
    puts("    COLOR");
1583
    puts("    COLOR");
1581
  else
1584
  else
1582
    puts("    GRAYSCALE");
1585
    puts("    GRAYSCALE");
1583
  if ((png_get_color_type(pp, info) & PNG_COLOR_MASK_ALPHA) || num_trans)
1586
  if (color_type & PNG_COLOR_MASK_ALPHA) || num_trans)
1584
    puts("    ALPHA");
1587
    puts("    ALPHA");
1585
  if (png_get_color_type(pp, info) & PNG_COLOR_MASK_PALETTE)
1588
  if (color_type & PNG_COLOR_MASK_PALETTE)
1586
    puts("    PALETTE");
1589
    puts("    PALETTE");
1587
#endif // DEBUG
1590
#endif // DEBUG
1588
1591
Lines 1614-1620 Link Here
1614
  * Generate the alpha mask as necessary...
1617
  * Generate the alpha mask as necessary...
1615
  */
1618
  */
1616
1619
1617
  if ((png_get_color_type(pp, info) & PNG_COLOR_MASK_ALPHA) || num_trans)
1620
  if ((color_type & PNG_COLOR_MASK_ALPHA) || num_trans)
1618
  {
1621
  {
1619
#ifdef DEBUG
1622
#ifdef DEBUG
1620
    for (inptr = img->pixels, i = 0; i < img->height; i ++)
1623
    for (inptr = img->pixels, i = 0; i < img->height; i ++)
Lines 1643-1654 Link Here
1643
  * Reformat the data as necessary for the reader...
1646
  * Reformat the data as necessary for the reader...
1644
  */
1647
  */
1645
1648
1646
  if (gray && png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
1649
  if (gray && color_type & PNG_COLOR_MASK_COLOR)
1647
  {
1650
  {
1648
   /*
1651
   /*
1649
    * Greyscale output needed...
1652
    * Greyscale output needed...
1650
    */
1653
    */
1651
1652
    for (inptr = img->pixels, outptr = img->pixels, i = img->width * img->height;
1654
    for (inptr = img->pixels, outptr = img->pixels, i = img->width * img->height;
1653
         i > 0;
1655
         i > 0;
1654
         inptr += depth, outptr ++, i --)
1656
         inptr += depth, outptr ++, i --)

Return to bug 426352