Search in sources :

Example 6 with InvalidPipeException

use of sun.java2d.InvalidPipeException in project jdk8u_jdk by JetBrains.

the class WComponentPeer method createBuffers.

/**
     * The following multibuffering-related methods delegate to our
     * associated GraphicsConfig (Win or WGL) to handle the appropriate
     * native windowing system specific actions.
     */
@Override
public void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException {
    Win32GraphicsConfig gc = (Win32GraphicsConfig) getGraphicsConfiguration();
    gc.assertOperationSupported((Component) target, numBuffers, caps);
    // Re-create the primary surface with the new number of back buffers
    try {
        replaceSurfaceData(numBuffers - 1, caps);
    } catch (InvalidPipeException e) {
        throw new AWTException(e.getMessage());
    }
}
Also used : InvalidPipeException(sun.java2d.InvalidPipeException) Win32GraphicsConfig(sun.awt.Win32GraphicsConfig)

Example 7 with InvalidPipeException

use of sun.java2d.InvalidPipeException in project jdk8u_jdk by JetBrains.

the class WComponentPeer method replaceSurfaceDataLater.

public void replaceSurfaceDataLater() {
    Runnable r = new Runnable() {

        @Override
        public void run() {
            // on EDT
            if (!isDisposed()) {
                try {
                    replaceSurfaceData();
                } catch (InvalidPipeException e) {
                // REMIND : what do we do if our surface creation failed?
                }
            }
        }
    };
    Component c = (Component) target;
    // Fix 6255371.
    if (!PaintEventDispatcher.getPaintEventDispatcher().queueSurfaceDataReplacing(c, r)) {
        postEvent(new InvocationEvent(c, r));
    }
}
Also used : InvalidPipeException(sun.java2d.InvalidPipeException) InvocationEvent(java.awt.event.InvocationEvent)

Example 8 with InvalidPipeException

use of sun.java2d.InvalidPipeException in project jdk8u_jdk by JetBrains.

the class D3DVolatileSurfaceManager method initAcceleratedSurface.

/**
     * Create a pbuffer-based SurfaceData object (or init the backbuffer
     * of an existing window if this is a double buffered GraphicsConfig).
     */
protected SurfaceData initAcceleratedSurface() {
    SurfaceData sData;
    Component comp = vImg.getComponent();
    WComponentPeer peer = (comp != null) ? (WComponentPeer) comp.getPeer() : null;
    try {
        boolean forceback = false;
        if (context instanceof Boolean) {
            forceback = ((Boolean) context).booleanValue();
        }
        if (forceback) {
            // peer must be non-null in this case
            sData = D3DSurfaceData.createData(peer, vImg);
        } else {
            D3DGraphicsConfig gc = (D3DGraphicsConfig) vImg.getGraphicsConfig();
            ColorModel cm = gc.getColorModel(vImg.getTransparency());
            int type = vImg.getForcedAccelSurfaceType();
            // use the forced type, otherwise use RT_TEXTURE
            if (type == UNDEFINED) {
                type = RT_TEXTURE;
            }
            sData = D3DSurfaceData.createData(gc, vImg.getWidth(), vImg.getHeight(), cm, vImg, type);
        }
    } catch (NullPointerException ex) {
        sData = null;
    } catch (OutOfMemoryError er) {
        sData = null;
    } catch (InvalidPipeException ipe) {
        sData = null;
    }
    return sData;
}
Also used : InvalidPipeException(sun.java2d.InvalidPipeException) SurfaceData(sun.java2d.SurfaceData) GDIWindowSurfaceData(sun.java2d.windows.GDIWindowSurfaceData) ColorModel(java.awt.image.ColorModel) WComponentPeer(sun.awt.windows.WComponentPeer) Component(java.awt.Component)

Example 9 with InvalidPipeException

use of sun.java2d.InvalidPipeException in project jdk8u_jdk by JetBrains.

the class D3DScreenUpdateManager method validate.

/**
     * Restores the passed surface if it was lost, resets the lost status.
     * @param sd surface to be validated
     * @return true if surface wasn't lost or if restoration was successful,
     * false otherwise
     */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
Also used : InvalidPipeException(sun.java2d.InvalidPipeException) Color(java.awt.Color) SunGraphics2D(sun.java2d.SunGraphics2D)

Example 10 with InvalidPipeException

use of sun.java2d.InvalidPipeException in project jdk8u_jdk by JetBrains.

the class GDIRenderer method doShape.

void doShape(SunGraphics2D sg2d, Shape s, boolean isfill) {
    Path2D.Float p2df;
    int transX;
    int transY;
    if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
        if (s instanceof Path2D.Float) {
            p2df = (Path2D.Float) s;
        } else {
            p2df = new Path2D.Float(s);
        }
        transX = sg2d.transX;
        transY = sg2d.transY;
    } else {
        p2df = new Path2D.Float(s, sg2d.transform);
        transX = 0;
        transY = 0;
    }
    try {
        doShape((GDIWindowSurfaceData) sg2d.surfaceData, sg2d.getCompClip(), sg2d.composite, sg2d.eargb, transX, transY, p2df, isfill);
    } catch (ClassCastException e) {
        throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
    }
}
Also used : InvalidPipeException(sun.java2d.InvalidPipeException) Path2D(java.awt.geom.Path2D)

Aggregations

InvalidPipeException (sun.java2d.InvalidPipeException)21 SurfaceData (sun.java2d.SurfaceData)3 Color (java.awt.Color)2 SurfaceType (sun.java2d.loops.SurfaceType)2 Component (java.awt.Component)1 Composite (java.awt.Composite)1 Paint (java.awt.Paint)1 InvocationEvent (java.awt.event.InvocationEvent)1 AffineTransform (java.awt.geom.AffineTransform)1 Path2D (java.awt.geom.Path2D)1 ColorModel (java.awt.image.ColorModel)1 Win32GraphicsConfig (sun.awt.Win32GraphicsConfig)1 WComponentPeer (sun.awt.windows.WComponentPeer)1 SunGraphics2D (sun.java2d.SunGraphics2D)1 Region (sun.java2d.pipe.Region)1 AccelSurface (sun.java2d.pipe.hw.AccelSurface)1 GDIWindowSurfaceData (sun.java2d.windows.GDIWindowSurfaceData)1