[OpenJDK 2D-Dev] [9] Review Request: 8167310 The graphics clip is incorrectly rounded for some fractional scales

Jim Graham james.graham at oracle.com
Tue Oct 11 19:49:00 UTC 2016


On 10/11/16 12:13 PM, Sergey Bylokhov wrote:
> On 11.10.16 21:54, Jim Graham wrote:
>> Additionally, for AA rendering, there is no such thing as
>> "setClip(someShape)" and "fill(sameShape)" being identical no matter how
>> much we predict which rules they may want because clips are inherently
>> non-AA and so the fuzzy pixels along the boundary of an AA shape will be
>> randomly clipped or included.
>>
>> When all is said and done I feel (not very strongly) it would be best to
>> have clipping remain unaffected by the biasing of STROKE hints, but part
>> of that is driven by the fact that I think it can be fixed with a couple
>> of lines of code in SG2D/LoopPipe...
>
> I guess a bottom line is that it is require an additional investigation. I am not exactly sure, but my expectation is
> that fillRect(x,y,w,h)/drawImage(x,y,w,h) + setClip(x,y,w,h) should work in a similar way(covers the same pixels). And
> the question should this behavior be exactly the same as fill(RectShape) + setClip(RectShape) is unclear (I am not sure
> is it a critical issue or not)

In STROKE_PURE, setClip/fillRect/drawImage(x,y,w,h) should all hit the same pixels.  I think we currently have a bug 
with drawImage() that needs to be investigated further, though.  The fact that it overlaps with itself is problematic 
and likely an indication that it won't match fillRect() either.

Under STROKE_NORMALIZE, fillRect() and fill(Rect) are affected due to their relationship to drawRect()/fill(Rect).  It's 
not clear if it should be identical to clipRect() and clip(Rect), though as I don't know where we'd have developers 
relying on that.  In particular, damage repair would usually involve clip(dmgxywh) followed by fill(compxywh) and so 
they wouldn't necessarily need to match.  drawImage() brings up additional questions.

For now I think we can ignore this issue for this fix, but I still have a question on the fix which I'll ask in response 
to webrev.04.  We should file the "clipRect() vs clip(RectShape)" bug for follow-on work.

> Right now I tried to fix overlapping, which produce visible artifacts and were considered as a bugs. The next issue
> which I would like to fix is a overlapping of drawImage().

Yes, that bears investigation...

			...jim




More information about the 2d-dev mailing list