use of sun.java2d.SurfaceData in project jdk8u_jdk by JetBrains.
the class D3DDrawImage method renderImageXform.
@Override
protected void renderImageXform(SunGraphics2D sg, Image img, AffineTransform tx, int interpType, int sx1, int sy1, int sx2, int sy2, Color bgColor) {
// - an appropriate TransformBlit primitive could not be found
if (interpType != AffineTransformOp.TYPE_BICUBIC) {
SurfaceData dstData = sg.surfaceData;
SurfaceData srcData = dstData.getSourceSurfaceData(img, sg.TRANSFORM_GENERIC, sg.imageComp, bgColor);
if (srcData != null && !isBgOperation(srcData, bgColor)) {
SurfaceType srcType = srcData.getSurfaceType();
SurfaceType dstType = dstData.getSurfaceType();
TransformBlit blit = TransformBlit.getFromCache(srcType, sg.imageComp, dstType);
if (blit != null) {
blit.Transform(srcData, dstData, sg.composite, sg.getCompClip(), tx, interpType, sx1, sy1, 0, 0, sx2 - sx1, sy2 - sy1);
return;
}
}
}
super.renderImageXform(sg, img, tx, interpType, sx1, sy1, sx2, sy2, bgColor);
}
use of sun.java2d.SurfaceData in project jdk8u_jdk by JetBrains.
the class D3DGraphicsConfig method flip.
/**
* Performs the native D3D flip operation for the given target Component.
*/
@Override
public void flip(WComponentPeer peer, Component target, VolatileImage backBuffer, int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction) {
// REMIND: we should actually get a surface data for the
// backBuffer's VI
SurfaceManager d3dvsm = SurfaceManager.getManager(backBuffer);
SurfaceData sd = d3dvsm.getPrimarySurfaceData();
if (sd instanceof D3DSurfaceData) {
D3DSurfaceData d3dsd = (D3DSurfaceData) sd;
D3DSurfaceData.swapBuffers(d3dsd, x1, y1, x2, y2);
} else {
// the surface was likely lost could not have been restored
Graphics g = peer.getGraphics();
try {
g.drawImage(backBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null);
} finally {
g.dispose();
}
}
if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) {
Graphics g = backBuffer.getGraphics();
try {
g.setColor(target.getBackground());
g.fillRect(0, 0, backBuffer.getWidth(), backBuffer.getHeight());
} finally {
g.dispose();
}
}
}
use of sun.java2d.SurfaceData in project jdk8u_jdk by JetBrains.
the class D3DScreenUpdateManager method getReplacementScreenSurface.
@Override
public SurfaceData getReplacementScreenSurface(WComponentPeer peer, SurfaceData sd) {
SurfaceData newSurface = super.getReplacementScreenSurface(peer, sd);
// if some outstanding graphics context wants to get a replacement we
// need to make sure that the new surface (if it is accelerated) is
// being tracked
trackScreenSurface(newSurface);
return newSurface;
}
use of sun.java2d.SurfaceData in project jdk8u_jdk by JetBrains.
the class WGLVolatileSurfaceManager 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 createVSynced = false;
boolean forceback = false;
if (context instanceof Boolean) {
forceback = ((Boolean) context).booleanValue();
if (forceback) {
BufferCapabilities caps = peer.getBackBufferCaps();
if (caps instanceof ExtendedBufferCapabilities) {
ExtendedBufferCapabilities ebc = (ExtendedBufferCapabilities) caps;
if (ebc.getVSync() == VSYNC_ON && ebc.getFlipContents() == COPIED) {
createVSynced = true;
forceback = false;
}
}
}
}
if (forceback) {
// peer must be non-null in this case
sData = WGLSurfaceData.createData(peer, vImg, FLIP_BACKBUFFER);
} else {
WGLGraphicsConfig gc = (WGLGraphicsConfig) vImg.getGraphicsConfig();
ColorModel cm = gc.getColorModel(vImg.getTransparency());
int type = vImg.getForcedAccelSurfaceType();
// use the forced type, otherwise choose one based on caps
if (type == OGLSurfaceData.UNDEFINED) {
type = gc.isCapPresent(CAPS_EXT_FBOBJECT) ? OGLSurfaceData.FBOBJECT : OGLSurfaceData.PBUFFER;
}
if (createVSynced) {
sData = WGLSurfaceData.createData(peer, vImg, type);
} else {
sData = WGLSurfaceData.createData(gc, vImg.getWidth(), vImg.getHeight(), cm, vImg, type);
}
}
} catch (NullPointerException ex) {
sData = null;
} catch (OutOfMemoryError er) {
sData = null;
}
return sData;
}
Aggregations