Hello Phil,
at the moment, I failed to get acceptable results for rendering to
translucent destination.
I am playing with an idea to fall back to grayscale AA on non-opaque
pixels (or pixels with
opacity less than a certain threshold) directly in the lcd shader program.
For now, there is an updated version of the fix which supports lcd
text in OGL pipeline
for a case of alpha paint and default composite. However, the case of
translucent
destination is not supported yet, that makes lcd text unavailable in
swing apps
on macosx.
All changes specific for this version are in OGLSurfaceData.java and
OGLTextRenderer.c.
Rest of the fix is unchanged.
http://cr.openjdk.java.net/~bae/8023794/9/webrev.04/
Of course, this version may affect the performance of lcd text
rendering, but
I have no numbers to estimate the effect at the moment. In the worst case,
we can consider to use two different programs: one for opaque paint
(in order
to preserve performance), and another (like published now) for the
case of alpha
paint.
Please take a look.
Thanks,
Andrew
On 10/25/2014 12:03 AM, Phil Race wrote:
On 10/24/2014 10:56 AM, Andrew Brygin wrote:
Hello,
please take a look to updated version of the fix:
http://cr.openjdk.java.net/~bae/8023794/9/webrev.03/
TODOs were removed:
* CGLSurfaceData.java
the condition for lcd rendering is inherited from OGL surface
data, but
here we have to remove the check for the transparency, because
we always
create transparent volatile images for swing backbuffers on
macosx in order
to support shaped windows.
Are you saying its created translucent regardless, or only if its shaped?
But if its really translucent/transparent under the text, then
IIRC the shaders - and s/w loops - do not properly handle that case.
You probably should try drawing LCD text over a fully transparent area
to see what happens.
* * *CGGlyphImages.m and AWTStrike.m
NSException is used to handle invalid (unevaluated) text
antialising hint values.
We actually have already used NSException to handle memory
allocation failure,
so this change just makes usage of get/release of primitive
arrays a bit more safe.
Known differences comparing to apple jdk6:
a) we do not interpret TEXT_ANTIALIASING_ON as lcd text.
Its should never have meant that, else you would have no way to
explicitly
request grey scale.
b) we do not render lcd text in a case of non-opaque paint. This
behavior is common for
all cases (software loops, OGL, and D3D), so it seems to deserve
a separate bug if we
want to handle this case.
I think that's another manifestation of the issue mentioned above.
-phil.