[Webkit-unassigned] [Bug 28308] allow down-sampling images during decoding

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 14 15:19:30 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=28308


Eric Seidel <eric at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #34867|review?                     |review-
               Flag|                            |




--- Comment #6 from Eric Seidel <eric at webkit.org>  2009-08-14 15:19:29 PDT ---
(From update of attachment 34867)
 126 #ifdef IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS
 127            
m_decoder->setMaxNumPixels(IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS);
 128 #else
 129             m_decoder->setMaxNumPixels(1024 * 1024);
 130 #endif

Would be better to check #ifdef
IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS at the top fo the file, and
define IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS to 1024 * 1024 if not
defined.

Seems we'd benifit from some nicely named local variables:
47     case Exact:
 48         return pos != dataEnd && *pos == orig ? pos - dataStart : -1;
 49     case LowerBound:
 50         return pos != dataEnd && *pos == orig ? pos - dataStart : pos -
dataStart - 1;
 51     case UpperBound:
 52     default:
 53         return pos != dataEnd ? pos - dataStart : -1;

Style:
 84     double zoom = 1. /shrink;

I would have made this a static inline function to prevent copy/paste:
94     m_scaledRows.reserveCapacity(height * shrink + 0.5);
 95     for (int scaledY = 0;;) {
 96         int y = scaledY * zoom + 0.5;
 97         if (y < height) {
 98             m_scaledRows.append(y);
 99             ++scaledY;
 100         } else
 101             break;
 102     }

 64             bool good = ImageDecoder::setSize(width, height);

good is not the word you want.  success would be better.  setSizeOK would be
another option.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list