本文整理汇总了Java中sun.java2d.InvalidPipeException类的典型用法代码示例。如果您正苦于以下问题:Java InvalidPipeException类的具体用法?Java InvalidPipeException怎么用?Java InvalidPipeException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InvalidPipeException类属于sun.java2d包,在下文中一共展示了InvalidPipeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
/**
* 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;
}
示例2: doShape
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
void doShape(SunGraphics2D sg2d, Shape s, boolean isfill) {
Path2D.Float p2df;
int transX;
int transY;
if (sg2d.transformState <= SunGraphics2D.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);
}
}
示例3: doShape
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
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);
}
}
示例4: copyArea
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
void copyArea(SunGraphics2D sg2d,
int x, int y, int w, int h, int dx, int dy)
{
rq.lock();
try {
int ctxflags =
sg2d.surfaceData.getTransparency() == Transparency.OPAQUE ?
OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS;
OGLSurfaceData dstData;
try {
dstData = (OGLSurfaceData)sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
OGLContext.validateContext(dstData, dstData,
sg2d.getCompClip(), sg2d.composite,
null, null, null, ctxflags);
rq.ensureCapacity(28);
buf.putInt(COPY_AREA);
buf.putInt(x).putInt(y).putInt(w).putInt(h);
buf.putInt(dx).putInt(dy);
} finally {
rq.unlock();
}
}
示例5: validateSurfaceData
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
@Override
public SurfaceData validateSurfaceData(SurfaceData srcData,
SurfaceData cachedData,
int w, int h)
{
if (cachedData == null || cachedData.isSurfaceLost()) {
try {
cachedData = d3dgc.createManagedSurface(w, h, transparency);
} catch (InvalidPipeException e) {
if (!d3dgc.getD3DDevice().isD3DAvailable()) {
invalidate();
flush();
return null;
}
}
}
return cachedData;
}
示例6: initSurface
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
/**
* Initializes the appropriate D3D offscreen surface based on the value
* of the type parameter. If the surface creation fails for any reason,
* an OutOfMemoryError will be thrown.
*/
protected void initSurface() {
// any time we create or restore the surface, recreate the raster
synchronized (this) {
wrn = null;
}
// REMIND: somewhere a puppy died
class Status {
boolean success = false;
};
final Status status = new Status();
D3DRenderQueue rq = D3DRenderQueue.getInstance();
rq.lock();
try {
rq.flushAndInvokeNow(new Runnable() {
public void run() {
status.success = initSurfaceNow();
}
});
if (!status.success) {
throw new InvalidPipeException("Error creating D3DSurface");
}
} finally {
rq.unlock();
}
}
示例7: copyArea
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
void copyArea(SunGraphics2D sg2d,
int x, int y, int w, int h, int dx, int dy)
{
rq.lock();
try {
int ctxflags =
sg2d.surfaceData.getTransparency() == Transparency.OPAQUE ?
D3DContext.SRC_IS_OPAQUE : D3DContext.NO_CONTEXT_FLAGS;
D3DSurfaceData dstData;
try {
dstData = (D3DSurfaceData)sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
D3DContext.validateContext(dstData, dstData,
sg2d.getCompClip(), sg2d.composite,
null, null, null, ctxflags);
rq.ensureCapacity(28);
buf.putInt(COPY_AREA);
buf.putInt(x).putInt(y).putInt(w).putInt(h);
buf.putInt(dx).putInt(dy);
} finally {
rq.unlock();
}
}
示例8: restoreAcceleratedSurface
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
/**
* Note that we create a new surface instead of restoring
* an old one. This will help with D3DContext revalidation.
*/
@Override
protected void restoreAcceleratedSurface() {
synchronized (this) {
if (restoreCountdown > 0) {
restoreCountdown--;
throw new
InvalidPipeException("Will attempt to restore surface " +
" in " + restoreCountdown);
}
}
SurfaceData sData = initAcceleratedSurface();
if (sData != null) {
sdAccel = sData;
} else {
throw new InvalidPipeException("could not restore surface");
// REMIND: alternatively, we could try this:
// ((D3DSurfaceData)sdAccel).restoreSurface();
}
}
示例9: setBounds
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
@Override
public void setBounds(int x, int y, int width, int height, int op) {
// Should set paintPending before reahape to prevent
// thread race between paint events
// Native components do redraw after resize
paintPending = (width != oldWidth) || (height != oldHeight);
if ( (op & NO_EMBEDDED_CHECK) != 0 ) {
reshapeNoCheck(x, y, width, height);
} else {
reshape(x, y, width, height);
}
if ((width != oldWidth) || (height != oldHeight)) {
// Only recreate surfaceData if this setBounds is called
// for a resize; a simple move should not trigger a recreation
try {
replaceSurfaceData();
} catch (InvalidPipeException e) {
// REMIND : what do we do if our surface creation failed?
}
oldWidth = width;
oldHeight = height;
}
serialNum++;
}
示例10: doFillSpans
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
public void doFillSpans(SunGraphics2D sg2d, SpanIterator si) {
int box[] = new int[4];
GDIWindowSurfaceData sd;
try {
sd = (GDIWindowSurfaceData)sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
Region clip = sg2d.getCompClip();
Composite comp = sg2d.composite;
int eargb = sg2d.eargb;
while (si.nextSpan(box)) {
doFillRect(sd, clip, comp, eargb,
box[0], box[1], box[2]-box[0], box[3]-box[1]);
}
}
示例11: replaceSurfaceDataLater
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
public void replaceSurfaceDataLater() {
Runnable r = new Runnable() {
@Override
public void run() {
// Shouldn't do anything if object is disposed in meanwhile
// No need for sync as disposeAction in Window is performed
// 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));
}
}
示例12: createBuffers
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
/**
* 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());
}
}
示例13: validateContext
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
@Override
protected void validateContext(SunGraphics2D sg2d,
Composite comp, int ctxflags)
{
OGLSurfaceData dstData;
try {
dstData = (OGLSurfaceData) sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " +
sg2d.surfaceData);
}
OGLContext.validateContext(dstData, dstData,
sg2d.getCompClip(), comp,
null, sg2d.paint, sg2d, ctxflags);
}
示例14: validateSurfaceData
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
@Override
public SurfaceData validateSurfaceData(SurfaceData srcData,
SurfaceData cachedData,
int w, int h)
{
if (cachedData == null || cachedData.isSurfaceLost()) {
try {
cachedData = d3dgc.createManagedSurface(w, h, transparency);
} catch (InvalidPipeException e) {
if (!D3DGraphicsDevice.isD3DAvailable()) {
invalidate();
flush();
return null;
}
}
}
return cachedData;
}
示例15: validateContext
import sun.java2d.InvalidPipeException; //导入依赖的package包/类
@Override
protected void validateContext(SunGraphics2D sg2d) {
int ctxflags =
sg2d.paint.getTransparency() == Transparency.OPAQUE ?
OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS;
OGLSurfaceData dstData;
try {
dstData = (OGLSurfaceData)sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
OGLContext.validateContext(dstData, dstData,
sg2d.getCompClip(), sg2d.composite,
null, sg2d.paint, sg2d, ctxflags);
}