[Webkit-unassigned] [Bug 19243] Make SVG Masking platform aware
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Feb 12 10:56:26 PST 2009
https://bugs.webkit.org/show_bug.cgi?id=19243
------- Comment #7 from krit at webkit.org 2009-02-12 10:56 PDT -------
(In reply to comment #6)
> (From update of attachment 27230 [review])
> There has to be a nice way to get the dat than this:
> + sourceImageData->data()->get((i * 4), r);
> + sourceImageData->data()->get((i * 4 + 1), g);
> + sourceImageData->data()->get((i * 4 + 2), b);
> + sourceImageData->data()->get((i * 4 + 3), a);
> don't we have a getPixel function or something that will fill an int or 4 chars
> or something?
No, there isn't. If you give a wrong index, you'll get the colors of one and
another pixel. e.g index=2 you'll get b,a of the first pixel and r,g of the
next one. Sure, it can happen if you take every color apart too. But calling
for rgba could give you a wrong feeling of safety.
> Won't this doe the wrong thing for alpha = 0 ?
>
> + if (a != 0 && a != 255) {
> + double alpha = a;
> + luma = luma * (alpha / 255);
> + }
>
> shouldn't that set luma to 0 when alpha is 0?
Well, it shoulf, normaly. But we only need the alpha for masking, and if alpha
is already 0, we don't need further calculation.
> Also, I think the whole for contents shoudl be abstracted into a static
> function. Something like:
>
> int rgbaValue;
> sourceImageData->data()->getPixel(i*4, rgbaValue);
> applyLuminecenceFilterToPixel(destImageData, i);
>
> Since destImageData is already a copy of source going into the for loop (which
> could possibly be avoided), no need to even pass the source into your inline.
I have a patch to use the pixelarray instead of calling srcImageData. I'll
update it soon. But why abstracting this short peace of code?
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the webkit-unassigned
mailing list