DocumentContext.java 1.17 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.internal.pdftoolkit.graphicsDOM;

import java.awt.geom.GeneralPath;
import java.util.HashMap;

public abstract class DocumentContext {
    private HashMap<String, HashMap<Integer, GeneralPath>> cachedGlyphOutlines = null;

    public abstract void graphicsStateChanged();

    public abstract void destroy();

    public void cacheGlyphOutline(GeneralPath outline, int gid, String fontName) {
        HashMap fontGlyphs;
        if (this.cachedGlyphOutlines == null) {
            this.cachedGlyphOutlines = new HashMap<K, V>();
        }
        if ((fontGlyphs = this.cachedGlyphOutlines.get(fontName)) == null) {
            fontGlyphs = new HashMap<K, V>();
        }
        fontGlyphs.put(gid, outline);
        this.cachedGlyphOutlines.put(fontName, fontGlyphs);
    }

    public GeneralPath getCachedGlyphOutline(int gid, String fontName) {
        if (this.cachedGlyphOutlines == null) {
            return null;
        }
        HashMap<Integer, GeneralPath> fontGlyphs = this.cachedGlyphOutlines.get(fontName);
        if (fontGlyphs == null) {
            return null;
        }
        return fontGlyphs.get(gid);
    }
}