changeset 4199:2ca8dc7b3c96

RT-31384: fx8.0-b96: NullPointerException in fillLCDAlphaMask in sw pipeline
author felipe
date Mon, 08 Jul 2013 12:04:11 -0700
parents 1ef3f9aba44e
children 228c5ed14f8f
files modules/graphics/src/main/java/com/sun/javafx/font/coretext/CTGlyph.java modules/graphics/src/main/java/com/sun/javafx/font/directwrite/DWGlyph.java
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/javafx/font/coretext/CTGlyph.java	Mon Jul 08 11:56:59 2013 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/font/coretext/CTGlyph.java	Mon Jul 08 12:04:11 2013 -0700
@@ -143,7 +143,7 @@
     private synchronized byte[] getImage(double x, double y, int w, int h,
                                          double subPixelX, double subPixelY) {
 
-        if (w == 0 || h == 0) return null;
+        if (w == 0 || h == 0) return new byte[0];
 
         long fontRef = strike.getFontRef();
         boolean lcd = isLCDGlyph();
--- a/modules/graphics/src/main/java/com/sun/javafx/font/directwrite/DWGlyph.java	Mon Jul 08 11:56:59 2013 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/font/directwrite/DWGlyph.java	Mon Jul 08 12:04:11 2013 -0700
@@ -101,6 +101,10 @@
         int textureType = OS.DWRITE_TEXTURE_CLEARTYPE_3x1;
         IDWriteGlyphRunAnalysis runAnalysis = createAnalysis(subPixelX, subPixelY);
         rect = runAnalysis.GetAlphaTextureBounds(textureType);
+        if ((rect.right - rect.left == 0) ||
+            (rect.bottom - rect.top == 0)) {
+            return new byte[0];
+        }
         byte[] buffer = runAnalysis.CreateAlphaTexture(textureType, rect);
         runAnalysis.Release();
         return buffer;