类sun.java2d.Disposer源码实例Demo

下面列出了怎么用sun.java2d.Disposer的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: openjdk-jdk9   文件: Type1Font.java
/**
 * - does basic verification of the file
 * - reads the names (full, family).
 * - determines the style of the font.
 * @throws FontFormatException if the font can't be opened
 * or fails verification,  or there's no usable cmap
 */
public Type1Font(String platname, Object nativeNames, boolean createdCopy)
    throws FontFormatException {
    super(platname, nativeNames);
    fontRank = Font2D.TYPE1_RANK;
    checkedNatives = true;
    try {
        verify();
    } catch (Throwable t) {
        if (createdCopy) {
            T1DisposerRecord ref = new T1DisposerRecord(platname);
            Disposer.addObjectRecord(bufferRef, ref);
            bufferRef = null;
        }
        if (t instanceof FontFormatException) {
            throw (FontFormatException)t;
        } else {
            throw new FontFormatException("Unexpected runtime exception.");
        }
    }
}
 
源代码2 项目: dragonwell8_jdk   文件: TrueTypeFont.java
/**
 * - does basic verification of the file
 * - reads the header table for this font (within a collection)
 * - reads the names (full, family).
 * - determines the style of the font.
 * - initializes the CMAP
 * @throws FontFormatException - if the font can't be opened
 * or fails verification,  or there's no usable cmap
 */
public TrueTypeFont(String platname, Object nativeNames, int fIndex,
             boolean javaRasterizer, boolean useFilePool)
    throws FontFormatException {
    super(platname, nativeNames);
    useJavaRasterizer = javaRasterizer;
    fontRank = Font2D.TTF_RANK;
    try {
        verify(useFilePool);
        init(fIndex);
        if (!useFilePool) {
           close();
        }
    } catch (Throwable t) {
        close();
        if (t instanceof FontFormatException) {
            throw (FontFormatException)t;
        } else {
            throw new FontFormatException("Unexpected runtime exception.");
        }
    }
    Disposer.addObjectRecord(this, disposerRecord);
}
 
源代码3 项目: jdk8u-dev-jdk   文件: TrueTypeFont.java
/**
 * - does basic verification of the file
 * - reads the header table for this font (within a collection)
 * - reads the names (full, family).
 * - determines the style of the font.
 * - initializes the CMAP
 * @throws FontFormatException - if the font can't be opened
 * or fails verification,  or there's no usable cmap
 */
public TrueTypeFont(String platname, Object nativeNames, int fIndex,
             boolean javaRasterizer)
    throws FontFormatException {
    super(platname, nativeNames);
    useJavaRasterizer = javaRasterizer;
    fontRank = Font2D.TTF_RANK;
    try {
        verify();
        init(fIndex);
    } catch (Throwable t) {
        close();
        if (t instanceof FontFormatException) {
            throw (FontFormatException)t;
        } else {
            throw new FontFormatException("Unexpected runtime exception.");
        }
    }
    Disposer.addObjectRecord(this, disposerRecord);
}
 
源代码4 项目: dragonwell8_jdk   文件: FontScaler.java
public static FontScaler getScaler(Font2D font,
                            int indexInCollection,
                            boolean supportsCJK,
                            int filesize) {
    FontScaler scaler = null;

    try {
        Object args[] = new Object[] {font, indexInCollection,
                                      supportsCJK, filesize};
        scaler = scalerConstructor.newInstance(args);
        Disposer.addObjectRecord(font, scaler);
    } catch (Throwable e) {
        scaler = nullScaler;

        //if we can not instantiate scaler assume bad font
        //NB: technically it could be also because of internal scaler
        //    error but here we are assuming scaler is ok.
        FontManager fm = FontManagerFactory.getInstance();
        fm.deRegisterBadFont(font);
    }
    return scaler;
}
 
源代码5 项目: dragonwell8_jdk   文件: CGLGraphicsConfig.java
private CGLGraphicsConfig(CGraphicsDevice device, int pixfmt,
                          long configInfo, int maxTextureSize,
                          ContextCapabilities oglCaps) {
    super(device);

    this.pixfmt = pixfmt;
    this.pConfigInfo = configInfo;
    this.oglCaps = oglCaps;
    this.maxTextureSize = maxTextureSize;
    context = new OGLContext(OGLRenderQueue.getInstance(), this);

    // add a record to the Disposer so that we destroy the native
    // CGLGraphicsConfigInfo data when this object goes away
    Disposer.addRecord(disposerReferent,
                       new CGLGCDisposerRecord(pConfigInfo));
}
 
源代码6 项目: openjdk-jdk9   文件: FontScaler.java
public static FontScaler getScaler(Font2D font,
                            int indexInCollection,
                            boolean supportsCJK,
                            int filesize) {
    FontScaler scaler = null;

    try {
        Object args[] = new Object[] {font, indexInCollection,
                                      supportsCJK, filesize};
        scaler = scalerConstructor.newInstance(args);
        Disposer.addObjectRecord(font, scaler);
    } catch (Throwable e) {
        scaler = nullScaler;

        //if we can not instantiate scaler assume bad font
        //NB: technically it could be also because of internal scaler
        //    error but here we are assuming scaler is ok.
        FontManager fm = FontManagerFactory.getInstance();
        fm.deRegisterBadFont(font);
    }
    return scaler;
}
 
源代码7 项目: dragonwell8_jdk   文件: WindowsLeak.java
public static void main(String[] args) throws Exception {
    Robot r = new Robot();
    for (int i = 0; i < 100; i++) {
        Frame f = new Frame();
        f.pack();
        f.dispose();
    }
    r.waitForIdle();

    Disposer.addRecord(new Object(), () -> disposerPhantomComplete = true);

    while (!disposerPhantomComplete) {
        Util.generateOOME();
    }

    Vector<WeakReference<Window>> windowList =
                    (Vector<WeakReference<Window>>) AppContext.getAppContext().get(Window.class);

    if (windowList != null && !windowList.isEmpty()) {
        throw new RuntimeException("Test FAILED: Window list is not empty: " + windowList.size());
    }

    System.out.println("Test PASSED");
}
 
源代码8 项目: jdk8u-jdk   文件: X11GraphicsConfig.java
protected X11GraphicsConfig(X11GraphicsDevice device,
                            int visualnum, int depth,
                            int colormap, boolean doubleBuffer)
{
    this.screen = device;
    this.visual = visualnum;
    this.doubleBuffer = doubleBuffer;
    this.depth = depth;
    this.colormap = colormap;
    init (visualnum, screen.getScreen());

    // add a record to the Disposer so that we destroy the native
    // AwtGraphicsConfigData when this object goes away (i.e. after a
    // display change event)
    long x11CfgData = getAData();
    Disposer.addRecord(disposerReferent,
                       new X11GCDisposerRecord(x11CfgData));
}
 
源代码9 项目: openjdk-8-source   文件: X11GraphicsConfig.java
protected X11GraphicsConfig(X11GraphicsDevice device,
                            int visualnum, int depth,
                            int colormap, boolean doubleBuffer)
{
    this.screen = device;
    this.visual = visualnum;
    this.doubleBuffer = doubleBuffer;
    this.depth = depth;
    this.colormap = colormap;
    init (visualnum, screen.getScreen());

    // add a record to the Disposer so that we destroy the native
    // AwtGraphicsConfigData when this object goes away (i.e. after a
    // display change event)
    long x11CfgData = getAData();
    Disposer.addRecord(disposerReferent,
                       new X11GCDisposerRecord(x11CfgData));
}
 
源代码10 项目: openjdk-jdk8u-backup   文件: Type1Font.java
/**
 * - does basic verification of the file
 * - reads the names (full, family).
 * - determines the style of the font.
 * @throws FontFormatException - if the font can't be opened
 * or fails verification,  or there's no usable cmap
 */
public Type1Font(String platname, Object nativeNames, boolean createdCopy)
    throws FontFormatException {
    super(platname, nativeNames);
    fontRank = Font2D.TYPE1_RANK;
    checkedNatives = true;
    try {
        verify();
    } catch (Throwable t) {
        if (createdCopy) {
            T1DisposerRecord ref = new T1DisposerRecord(platname);
            Disposer.addObjectRecord(bufferRef, ref);
            bufferRef = null;
        }
        if (t instanceof FontFormatException) {
            throw (FontFormatException)t;
        } else {
            throw new FontFormatException("Unexpected runtime exception.");
        }
    }
}
 
源代码11 项目: Bytecoder   文件: TrueTypeFont.java
/**
 * - does basic verification of the file
 * - reads the header table for this font (within a collection)
 * - reads the names (full, family).
 * - determines the style of the font.
 * - initializes the CMAP
 * @throws FontFormatException if the font can't be opened
 * or fails verification,  or there's no usable cmap
 */
public TrueTypeFont(String platname, Object nativeNames, int fIndex,
             boolean javaRasterizer, boolean useFilePool)
    throws FontFormatException {
    super(platname, nativeNames);
    useJavaRasterizer = javaRasterizer;
    fontRank = Font2D.TTF_RANK;
    try {
        verify(useFilePool);
        init(fIndex);
        if (!useFilePool) {
           close();
        }
    } catch (Throwable t) {
        close();
        if (t instanceof FontFormatException) {
            throw (FontFormatException)t;
        } else {
            throw new FontFormatException("Unexpected runtime exception.");
        }
    }
    Disposer.addObjectRecord(this, disposerRecord);
}
 
源代码12 项目: jdk8u-dev-jdk   文件: CGLGraphicsConfig.java
private CGLGraphicsConfig(CGraphicsDevice device, int pixfmt,
                          long configInfo, int maxTextureSize,
                          ContextCapabilities oglCaps) {
    super(device);

    this.pixfmt = pixfmt;
    this.pConfigInfo = configInfo;
    this.oglCaps = oglCaps;
    this.maxTextureSize = maxTextureSize;
    context = new OGLContext(OGLRenderQueue.getInstance(), this);

    // add a record to the Disposer so that we destroy the native
    // CGLGraphicsConfigInfo data when this object goes away
    Disposer.addRecord(disposerReferent,
                       new CGLGCDisposerRecord(pConfigInfo));
}
 
源代码13 项目: hottub   文件: Window.java
private void initDeserializedWindow() {
    setWarningString();
    inputContextLock = new Object();

    // Deserialized Windows are not yet visible.
    visible = false;

    weakThis = new WeakReference<>(this);

    anchor = new Object();
    disposerRecord = new WindowDisposerRecord(appContext, this);
    sun.java2d.Disposer.addRecord(anchor, disposerRecord);

    addToWindowList();
    initGC(null);
    ownedWindowList = new Vector<>();
}
 
源代码14 项目: TencentKona-8   文件: X11GraphicsConfig.java
protected X11GraphicsConfig(X11GraphicsDevice device,
                            int visualnum, int depth,
                            int colormap, boolean doubleBuffer)
{
    this.screen = device;
    this.visual = visualnum;
    this.doubleBuffer = doubleBuffer;
    this.depth = depth;
    this.colormap = colormap;
    init (visualnum, screen.getScreen());

    // add a record to the Disposer so that we destroy the native
    // AwtGraphicsConfigData when this object goes away (i.e. after a
    // display change event)
    long x11CfgData = getAData();
    Disposer.addRecord(disposerReferent,
                       new X11GCDisposerRecord(x11CfgData));
}
 
源代码15 项目: openjdk-jdk9   文件: X11GraphicsConfig.java
protected X11GraphicsConfig(X11GraphicsDevice device,
                            int visualnum, int depth,
                            int colormap, boolean doubleBuffer)
{
    this.screen = device;
    this.visual = visualnum;
    this.doubleBuffer = doubleBuffer;
    this.depth = depth;
    this.colormap = colormap;
    init (visualnum, screen.getScreen());

    // add a record to the Disposer so that we destroy the native
    // AwtGraphicsConfigData when this object goes away (i.e. after a
    // display change event)
    long x11CfgData = getAData();
    Disposer.addRecord(disposerReferent,
                       new X11GCDisposerRecord(x11CfgData));
}
 
源代码16 项目: jdk8u-jdk   文件: CGLGraphicsConfig.java
private CGLGraphicsConfig(CGraphicsDevice device, int pixfmt,
                          long configInfo, int maxTextureSize,
                          ContextCapabilities oglCaps) {
    super(device);

    this.pixfmt = pixfmt;
    this.pConfigInfo = configInfo;
    this.oglCaps = oglCaps;
    this.maxTextureSize = maxTextureSize;
    context = new OGLContext(OGLRenderQueue.getInstance(), this);

    // add a record to the Disposer so that we destroy the native
    // CGLGraphicsConfigInfo data when this object goes away
    Disposer.addRecord(disposerReferent,
                       new CGLGCDisposerRecord(pConfigInfo));
}
 
源代码17 项目: jdk8u60   文件: FontScaler.java
public static FontScaler getScaler(Font2D font,
                            int indexInCollection,
                            boolean supportsCJK,
                            int filesize) {
    FontScaler scaler = null;

    try {
        Object args[] = new Object[] {font, indexInCollection,
                                      supportsCJK, filesize};
        scaler = scalerConstructor.newInstance(args);
        Disposer.addObjectRecord(font, scaler);
    } catch (Throwable e) {
        scaler = nullScaler;

        //if we can not instantiate scaler assume bad font
        //NB: technically it could be also because of internal scaler
        //    error but here we are assuming scaler is ok.
        FontManager fm = FontManagerFactory.getInstance();
        fm.deRegisterBadFont(font);
    }
    return scaler;
}
 
源代码18 项目: jdk8u60   文件: Type1Font.java
/**
 * - does basic verification of the file
 * - reads the names (full, family).
 * - determines the style of the font.
 * @throws FontFormatException - if the font can't be opened
 * or fails verification,  or there's no usable cmap
 */
public Type1Font(String platname, Object nativeNames, boolean createdCopy)
    throws FontFormatException {
    super(platname, nativeNames);
    fontRank = Font2D.TYPE1_RANK;
    checkedNatives = true;
    try {
        verify();
    } catch (Throwable t) {
        if (createdCopy) {
            T1DisposerRecord ref = new T1DisposerRecord(platname);
            Disposer.addObjectRecord(bufferRef, ref);
            bufferRef = null;
        }
        if (t instanceof FontFormatException) {
            throw (FontFormatException)t;
        } else {
            throw new FontFormatException("Unexpected runtime exception.");
        }
    }
}
 
源代码19 项目: jdk8u60   文件: CGLGraphicsConfig.java
private CGLGraphicsConfig(CGraphicsDevice device, int pixfmt,
                          long configInfo, int maxTextureSize,
                          ContextCapabilities oglCaps) {
    super(device);

    this.pixfmt = pixfmt;
    this.pConfigInfo = configInfo;
    this.oglCaps = oglCaps;
    this.maxTextureSize = maxTextureSize;
    context = new OGLContext(OGLRenderQueue.getInstance(), this);

    // add a record to the Disposer so that we destroy the native
    // CGLGraphicsConfigInfo data when this object goes away
    Disposer.addRecord(disposerReferent,
                       new CGLGCDisposerRecord(pConfigInfo));
}
 
源代码20 项目: openjdk-jdk8u-backup   文件: FontScaler.java
public static FontScaler getScaler(Font2D font,
                            int indexInCollection,
                            boolean supportsCJK,
                            int filesize) {
    FontScaler scaler = null;

    try {
        Object args[] = new Object[] {font, indexInCollection,
                                      supportsCJK, filesize};
        scaler = scalerConstructor.newInstance(args);
        Disposer.addObjectRecord(font, scaler);
    } catch (Throwable e) {
        scaler = nullScaler;

        //if we can not instantiate scaler assume bad font
        //NB: technically it could be also because of internal scaler
        //    error but here we are assuming scaler is ok.
        FontManager fm = FontManagerFactory.getInstance();
        fm.deRegisterBadFont(font);
    }
    return scaler;
}
 
源代码21 项目: openjdk-8-source   文件: Type1Font.java
/**
 * - does basic verification of the file
 * - reads the names (full, family).
 * - determines the style of the font.
 * @throws FontFormatException - if the font can't be opened
 * or fails verification,  or there's no usable cmap
 */
public Type1Font(String platname, Object nativeNames, boolean createdCopy)
    throws FontFormatException {
    super(platname, nativeNames);
    fontRank = Font2D.TYPE1_RANK;
    checkedNatives = true;
    try {
        verify();
    } catch (Throwable t) {
        if (createdCopy) {
            T1DisposerRecord ref = new T1DisposerRecord(platname);
            Disposer.addObjectRecord(bufferRef, ref);
            bufferRef = null;
        }
        if (t instanceof FontFormatException) {
            throw (FontFormatException)t;
        } else {
            throw new FontFormatException("Unexpected runtime exception.");
        }
    }
}
 
源代码22 项目: openjdk-jdk8u   文件: Window.java
private void initDeserializedWindow() {
    setWarningString();
    inputContextLock = new Object();

    // Deserialized Windows are not yet visible.
    visible = false;

    weakThis = new WeakReference<>(this);

    anchor = new Object();
    disposerRecord = new WindowDisposerRecord(appContext, this);
    sun.java2d.Disposer.addRecord(anchor, disposerRecord);

    addToWindowList();
    initGC(null);
    ownedWindowList = new Vector<>();
}
 
源代码23 项目: jdk8u_jdk   文件: CGLGraphicsConfig.java
private CGLGraphicsConfig(CGraphicsDevice device, int pixfmt,
                          long configInfo, int maxTextureSize,
                          ContextCapabilities oglCaps) {
    super(device);

    this.pixfmt = pixfmt;
    this.pConfigInfo = configInfo;
    this.oglCaps = oglCaps;
    this.maxTextureSize = maxTextureSize;
    context = new OGLContext(OGLRenderQueue.getInstance(), this);

    // add a record to the Disposer so that we destroy the native
    // CGLGraphicsConfigInfo data when this object goes away
    Disposer.addRecord(disposerReferent,
                       new CGLGCDisposerRecord(pConfigInfo));
}
 
源代码24 项目: openjdk-jdk9   文件: TrueTypeFont.java
/**
 * - does basic verification of the file
 * - reads the header table for this font (within a collection)
 * - reads the names (full, family).
 * - determines the style of the font.
 * - initializes the CMAP
 * @throws FontFormatException if the font can't be opened
 * or fails verification,  or there's no usable cmap
 */
public TrueTypeFont(String platname, Object nativeNames, int fIndex,
             boolean javaRasterizer, boolean useFilePool)
    throws FontFormatException {
    super(platname, nativeNames);
    useJavaRasterizer = javaRasterizer;
    fontRank = Font2D.TTF_RANK;
    try {
        verify(useFilePool);
        init(fIndex);
        if (!useFilePool) {
           close();
        }
    } catch (Throwable t) {
        close();
        if (t instanceof FontFormatException) {
            throw (FontFormatException)t;
        } else {
            throw new FontFormatException("Unexpected runtime exception.");
        }
    }
    Disposer.addObjectRecord(this, disposerRecord);
}
 
源代码25 项目: openjdk-jdk8u   文件: FontScaler.java
public static FontScaler getScaler(Font2D font,
                            int indexInCollection,
                            boolean supportsCJK,
                            int filesize) {
    FontScaler scaler = null;

    try {
        Object args[] = new Object[] {font, indexInCollection,
                                      supportsCJK, filesize};
        scaler = scalerConstructor.newInstance(args);
        Disposer.addObjectRecord(font, scaler);
    } catch (Throwable e) {
        scaler = nullScaler;

        //if we can not instantiate scaler assume bad font
        //NB: technically it could be also because of internal scaler
        //    error but here we are assuming scaler is ok.
        FontManager fm = FontManagerFactory.getInstance();
        fm.deRegisterBadFont(font);
    }
    return scaler;
}
 
源代码26 项目: jdk8u_jdk   文件: WindowsLeak.java
public static void main(String[] args) throws Exception {
    Robot r = new Robot();
    for (int i = 0; i < 100; i++) {
        Frame f = new Frame();
        f.pack();
        f.dispose();
    }
    r.waitForIdle();

    Disposer.addRecord(new Object(), () -> disposerPhantomComplete = true);

    while (!disposerPhantomComplete) {
        Util.generateOOME();
    }

    Vector<WeakReference<Window>> windowList =
                    (Vector<WeakReference<Window>>) AppContext.getAppContext().get(Window.class);

    if (windowList != null && !windowList.isEmpty()) {
        throw new RuntimeException("Test FAILED: Window list is not empty: " + windowList.size());
    }

    System.out.println("Test PASSED");
}
 
源代码27 项目: jdk8u-jdk   文件: CGLGraphicsConfig.java
private CGLGraphicsConfig(CGraphicsDevice device, int pixfmt,
                          long configInfo, int maxTextureSize,
                          ContextCapabilities oglCaps) {
    super(device);

    this.pixfmt = pixfmt;
    this.pConfigInfo = configInfo;
    this.oglCaps = oglCaps;
    this.maxTextureSize = maxTextureSize;
    context = new OGLContext(OGLRenderQueue.getInstance(), this);

    // add a record to the Disposer so that we destroy the native
    // CGLGraphicsConfigInfo data when this object goes away
    Disposer.addRecord(disposerReferent,
                       new CGLGCDisposerRecord(pConfigInfo));
}
 
源代码28 项目: openjdk-jdk8u   文件: CGLGraphicsConfig.java
private CGLGraphicsConfig(CGraphicsDevice device, int pixfmt,
                          long configInfo, int maxTextureSize,
                          ContextCapabilities oglCaps) {
    super(device);

    this.pixfmt = pixfmt;
    this.pConfigInfo = configInfo;
    this.oglCaps = oglCaps;
    this.maxTextureSize = maxTextureSize;
    context = new OGLContext(OGLRenderQueue.getInstance(), this);

    // add a record to the Disposer so that we destroy the native
    // CGLGraphicsConfigInfo data when this object goes away
    Disposer.addRecord(disposerReferent,
                       new CGLGCDisposerRecord(pConfigInfo));
}
 
源代码29 项目: jdk8u-jdk   文件: Type1Font.java
/**
 * - does basic verification of the file
 * - reads the names (full, family).
 * - determines the style of the font.
 * @throws FontFormatException - if the font can't be opened
 * or fails verification,  or there's no usable cmap
 */
public Type1Font(String platname, Object nativeNames, boolean createdCopy)
    throws FontFormatException {
    super(platname, nativeNames);
    fontRank = Font2D.TYPE1_RANK;
    checkedNatives = true;
    try {
        verify();
    } catch (Throwable t) {
        if (createdCopy) {
            T1DisposerRecord ref = new T1DisposerRecord(platname);
            Disposer.addObjectRecord(bufferRef, ref);
            bufferRef = null;
        }
        if (t instanceof FontFormatException) {
            throw (FontFormatException)t;
        } else {
            throw new FontFormatException("Unexpected runtime exception.");
        }
    }
}
 
源代码30 项目: jdk1.8-source-analysis   文件: Window.java
private void init(GraphicsConfiguration gc) {
    GraphicsEnvironment.checkHeadless();

    syncLWRequests = systemSyncLWRequests;

    weakThis = new WeakReference<Window>(this);
    addToWindowList();

    setWarningString();
    this.cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
    this.visible = false;

    gc = initGC(gc);

    if (gc.getDevice().getType() !=
        GraphicsDevice.TYPE_RASTER_SCREEN) {
        throw new IllegalArgumentException("not a screen device");
    }
    setLayout(new BorderLayout());

    /* offset the initial location with the original of the screen */
    /* and any insets                                              */
    Rectangle screenBounds = gc.getBounds();
    Insets screenInsets = getToolkit().getScreenInsets(gc);
    int x = getX() + screenBounds.x + screenInsets.left;
    int y = getY() + screenBounds.y + screenInsets.top;
    if (x != this.x || y != this.y) {
        setLocation(x, y);
        /* reset after setLocation */
        setLocationByPlatform(locationByPlatformProp);
    }

    modalExclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
    disposerRecord = new WindowDisposerRecord(appContext, this);
    sun.java2d.Disposer.addRecord(anchor, disposerRecord);

    SunToolkit.checkAndSetPolicy(this);
}
 
 类所在包
 类方法
 同包方法