[OpenJDK 2D-Dev] [9] Review request for 8023794: [macosx] LCD Rendering hints seems not working without FRACTIONALMETRICS=ON
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Wed Jul 9 15:22:45 UTC 2014
Hello, Denis.
Thanks for this research!
On 09.07.2014 15:13, Denis Fokin wrote:
> The current version consist of three parts.
>
> 1. We are rendering glyphs in offscreen images using Quartz functions.
> This does not work without kCGBitmapByteOrder32Host mask.
I assume LCD hint does not work? this looks good.
>
> 2. We assume that subpixel antialiasing should not be used on a
> non-opaque surface. As I understand the vImage in
> CGLVolatileSurfaceManager is not related directly to our window. For a
> start, I have hardcoded Transparency.OPAQUE, but it requires much
> better understanding of the architecture to make a more proper solution.
It is related to the CGLOffScreenSurfaceData, which is used as a surface
for VolatileImages. I check this code and looks like we ignore type of
the ColorModel and create a transparent native texture anyway.
>
> 3. When I started using CGGI_CopyImageFromCanvasToRGBInfo as a
> rendering mode, I had found that the little endian mode should be
> undefined. Again, it might be an improper way to do this.
It seems __LITTLE_ENDIAN__usage in this file should be checked.
>
> Thank you,
> Denis.
>
> diff -r f87c5be90e01
> src/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java
>
> ---
> a/src/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.javaFri
> Jun 20 10:15:30 2014 -0700
>
> +++
> b/src/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.javaWed
> Jul 09 14:50:09 2014 +0400
>
> @@ -108,7 +108,7 @@
>
> } else {
>
> CGLGraphicsConfig gc =
>
> (CGLGraphicsConfig)vImg.getGraphicsConfig();
>
> - ColorModel cm = gc.getColorModel(vImg.getTransparency());
>
> + ColorModel cm = gc.getColorModel(Transparency.OPAQUE);
>
> int type = vImg.getForcedAccelSurfaceType();
>
> // if acceleration type is forced (type != UNDEFINED)
> then
>
> // use the forced type, otherwise choose one based on
> caps
>
> diff -r f87c5be90e01 src/macosx/native/sun/font/CGGlyphImages.m
>
> --- a/src/macosx/native/sun/font/CGGlyphImages.mFri Jun 20 10:15:30
> 2014 -0700
>
> +++ b/src/macosx/native/sun/font/ .mWed Jul 09 14:50:09 2014 +0400
>
> @@ -196,6 +196,8 @@
>
> #pragma mark --- Font Rendering Mode Descriptors ---
>
> +#undef __LITTLE_ENDIAN__
>
> +
>
> static inline void
>
> CGGI_CopyARGBPixelToRGBPixel(const UInt32 p, UInt8 *dst)
>
> {
>
> @@ -366,7 +368,8 @@
>
> canvas->context = CGBitmapContextCreate(canvas->image->data,
>
> width, height, 8, bytesPerRow,
>
> colorSpace,
>
> - kCGImageAlphaPremultipliedFirst);
>
> + kCGImageAlphaPremultipliedFirst
>
> + | kCGBitmapByteOrder32Host);
>
> CGContextSetRGBFillColor(canvas->context, 0.0f, 0.0f, 0.0f, 1.0f);
>
> CGContextSetFontSize(canvas->context, 1);
>
--
Best regards, Sergey.
More information about the 2d-dev
mailing list