[Webkit-unassigned] [Bug 28308] allow down-sampling images during decoding
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Aug 14 16:09:02 PDT 2009
https://bugs.webkit.org/show_bug.cgi?id=28308
--- Comment #7 from Yong Li <yong.li at torchmobile.com> 2009-08-14 16:09:02 PDT ---
(In reply to comment #6)
> (From update of attachment 34867 [details])
> 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:
for this 1./x ? I think that's sick
> 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.
"good" means the size is good.
r- with all these tiny things?
BTW, after it's modified to be what you want above, are you going to accept it?
--
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