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.5 KiB

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