OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.4 KiB

  1. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # T2 SDE: package/.../libtiff/thumbnail-fixup.patch
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- T2-COPYRIGHT-NOTE-END ---
  16. The box filter bit masking is broken in several ways - I wonder it ever worked
  17. for anyone ...
  18. Marked clamp inline, just in case.
  19. - Rene Rebe <rene@exactcode.de> for Archivista GmbH Z�rich
  20. --- tiff-3.7.3/tools/thumbnail.c 2005-07-05 18:38:16.000000000 +0200
  21. +++ tiff-3.7.3-hackery/tools/thumbnail.c 2005-09-30 20:36:44.000000000 +0200
  22. @@ -369,7 +369,7 @@
  23. }
  24. }
  25. -static int clamp(float v, int low, int high)
  26. +static int inline clamp(float v, int low, int high)
  27. { return (v < low ? low : v > high ? high : (int)v); }
  28. #ifndef M_E
  29. @@ -453,13 +453,15 @@
  30. }
  31. rowoff[x] = sx0 >> 3;
  32. fw = sx - sx0; /* width */
  33. + if (fw == 0) fw = 1;
  34. +
  35. + src1[x] = fw;
  36. b = (fw < 8) ? 0xff<<(8-fw) : 0xff;
  37. src0[x] = b >> (sx0&7);
  38. fw -= 8 - (sx0&7);
  39. if (fw < 0)
  40. fw = 0;
  41. - src1[x] = fw >> 3;
  42. - fw -= (fw>>3)<<3;
  43. + fw %= 8;
  44. src2[x] = 0xff << (8-fw);
  45. }
  46. stepSrcWidth = sw;
  47. @@ -471,20 +473,20 @@
  48. setrow(uint8* row, uint32 nrows, const uint8* rows[])
  49. {
  50. uint32 x;
  51. - uint32 area = nrows * filterWidth;
  52. for (x = 0; x < tnw; x++) {
  53. uint32 mask0 = src0[x];
  54. uint32 fw = src1[x];
  55. - uint32 mask1 = src1[x];
  56. + uint32 mask1 = src2[x];
  57. uint32 off = rowoff[x];
  58. uint32 acc = 0;
  59. uint32 y, i;
  60. for (y = 0; y < nrows; y++) {
  61. const uint8* src = rows[y] + off;
  62. + uint32 _fw = fw - bits[mask0] - bits[mask1];
  63. acc += bits[*src++ & mask0];
  64. - switch (fw) {
  65. + switch (_fw) {
  66. default:
  67. - for (i = fw; i > 8; i--)
  68. + for (i = _fw; i > 8; i--)
  69. acc += bits[*src++];
  70. /* fall thru... */
  71. case 8: acc += bits[*src++];
  72. @@ -499,8 +507,9 @@
  73. }
  74. acc += bits[*src & mask1];
  75. }
  76. + uint32 area = nrows * fw;
  77. *row++ = cmap[(255*acc)/area];
  78. }
  79. }
  80. /*