modules/graphics/src/main/java/com/sun/prism/d3d/D3DSwapChain.java
Print this page
*** 36,51 ****
class D3DSwapChain
extends D3DResource
implements D3DRenderTarget, Presentable, D3DContextSource {
private final D3DRTTexture texBackBuffer;
! private final float pixelScaleFactor;
! D3DSwapChain(D3DContext context, long pResource, D3DRTTexture rtt, float pixelScale) {
super(new D3DRecord(context, pResource));
texBackBuffer = rtt;
! pixelScaleFactor = pixelScale;
}
@Override
public void dispose() {
texBackBuffer.dispose();
--- 36,53 ----
class D3DSwapChain
extends D3DResource
implements D3DRenderTarget, Presentable, D3DContextSource {
private final D3DRTTexture texBackBuffer;
! private final float pixelScaleFactorX;
! private final float pixelScaleFactorY;
! D3DSwapChain(D3DContext context, long pResource, D3DRTTexture rtt, float pixelScaleX, float pixelScaleY) {
super(new D3DRecord(context, pResource));
texBackBuffer = rtt;
! pixelScaleFactorX = pixelScaleX;
! pixelScaleFactorY = pixelScaleY;
}
@Override
public void dispose() {
texBackBuffer.dispose();
*** 117,137 ****
}
public boolean lockResources(PresentableState pState) {
if (pState.getRenderWidth() != texBackBuffer.getContentWidth() ||
pState.getRenderHeight() != texBackBuffer.getContentHeight() ||
! pState.getRenderScale() != pixelScaleFactor)
{
return true;
}
texBackBuffer.lock();
return texBackBuffer.isSurfaceLost();
}
public Graphics createGraphics() {
Graphics g = D3DGraphics.create(texBackBuffer, getContext());
! g.scale(pixelScaleFactor, pixelScaleFactor);
return g;
}
public RTTexture getRTTBackBuffer() {
return texBackBuffer;
--- 119,140 ----
}
public boolean lockResources(PresentableState pState) {
if (pState.getRenderWidth() != texBackBuffer.getContentWidth() ||
pState.getRenderHeight() != texBackBuffer.getContentHeight() ||
! pState.getRenderScaleX() != pixelScaleFactorX ||
! pState.getRenderScaleY() != pixelScaleFactorY)
{
return true;
}
texBackBuffer.lock();
return texBackBuffer.isSurfaceLost();
}
public Graphics createGraphics() {
Graphics g = D3DGraphics.create(texBackBuffer, getContext());
! g.scale(pixelScaleFactorX, pixelScaleFactorY);
return g;
}
public RTTexture getRTTBackBuffer() {
return texBackBuffer;
*** 139,150 ****
public Screen getAssociatedScreen() {
return getContext().getAssociatedScreen();
}
! public float getPixelScaleFactor() {
! return pixelScaleFactor;
}
public boolean isOpaque() {
return texBackBuffer.isOpaque();
}
--- 142,159 ----
public Screen getAssociatedScreen() {
return getContext().getAssociatedScreen();
}
! @Override
! public float getPixelScaleFactorX() {
! return pixelScaleFactorX;
! }
!
! @Override
! public float getPixelScaleFactorY() {
! return pixelScaleFactorY;
}
public boolean isOpaque() {
return texBackBuffer.isOpaque();
}