[OpenJDK 2D-Dev] Review: Remove private API from graphics code

Scott Kovatch scott.kovatch at oracle.com
Fri Aug 31 18:57:39 UTC 2012

On Aug 31, 2012, at 11:16 AM, Phil Race <philip.race at oracle.com> wrote:

> Scott,
> These files were added by Bino to support printing. Quartz isn't used
> except for printing in JDK 7, so as I understand it, testing on-screen in
> Java2Demo should not exercise this code. I'm surprised that you saw
> it being exercised. Did you do any printing testing ?

I tried printing from the 2d demo, and now I'm not so sure about the changes. I printed one image and it was inverted. :-\

> The matrix inversion seems unlikely to be applied to any non-invertible
> matrices, so that's fine, but I wonder if you have lost precision here
> due to floating point inaccuracies ?

I have to admit that I didn't go that deep into the code, since the main purpose of the changes were to get rid of the private API so we could submit something to the OS X app store.

> If you originally had a simple scale or identity, rotated it, and then
> applied the inverse to unrotate it, do you really end up with exactly
> the same results. The more you do this the more inaccuracies creep in,
> which may be part of the reason for the original approach.
> I find it a little hard to believe that there isn't a direct public way to
> restore a transform.

I was surprised by that, too, but for what it's worth CGContextSave/RestoreGState save and restore the current transform. I didn't dig deeply enough to see if they could/should be used instead.

> The changes for mountain lion are safe for snow leopard I presume?
> I believe the builds still happen on snow leopard.

I would think so, yes. I'm replacing private API with long-available public API.  The core JDK builds on Lion due to the need for APIs that arrived in 10.7.3.

> Also this should have been sent to 2d-dev, not awt-dev.
> These files, APIs, and printing are all 2D, not awt.

Okay. I didn't realize Quartz was only being used in printing, though in retrospect that makes sense now.  I see you moved the bug already.

-- Scott K.

More information about the 2d-dev mailing list