Commit 09d549dc authored by Roman Sedaikin's avatar Roman Sedaikin

Fixed stretching policy when resizing window.

parent 87b52db4
...@@ -270,6 +270,7 @@ HRESULT D3DCompile( ...@@ -270,6 +270,7 @@ HRESULT D3DCompile(
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
swapChainDesc.SampleDesc.Count = 1; swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.Scaling = DXGI_SCALING_NONE;
DXGI_SWAP_CHAIN_FULLSCREEN_DESC swapChainFSDesc = {}; DXGI_SWAP_CHAIN_FULLSCREEN_DESC swapChainFSDesc = {};
swapChainFSDesc.Windowed = TRUE; swapChainFSDesc.Windowed = TRUE;
......
...@@ -32,7 +32,11 @@ internal val platformOperations: PlatformOperations by lazy { ...@@ -32,7 +32,11 @@ internal val platformOperations: PlatformOperations by lazy {
return component.graphicsConfiguration.defaultTransform.scaleX.toFloat() return component.graphicsConfiguration.defaultTransform.scaleX.toFloat()
} }
override fun createRedrawer(layer: HardwareLayer, renderApi: GraphicsApi, properties: SkiaLayerProperties) = when(renderApi) { override fun createRedrawer(
layer: HardwareLayer,
renderApi: GraphicsApi,
properties: SkiaLayerProperties
) = when(renderApi) {
GraphicsApi.SOFTWARE -> SoftwareRedrawer(layer) GraphicsApi.SOFTWARE -> SoftwareRedrawer(layer)
else -> MacOsOpenGLRedrawer(layer, properties) else -> MacOsOpenGLRedrawer(layer, properties)
} }
...@@ -55,7 +59,11 @@ internal val platformOperations: PlatformOperations by lazy { ...@@ -55,7 +59,11 @@ internal val platformOperations: PlatformOperations by lazy {
return component.graphicsConfiguration.defaultTransform.scaleX.toFloat() return component.graphicsConfiguration.defaultTransform.scaleX.toFloat()
} }
override fun createRedrawer(layer: HardwareLayer, renderApi: GraphicsApi, properties: SkiaLayerProperties) = when(renderApi) { override fun createRedrawer(
layer: HardwareLayer,
renderApi: GraphicsApi,
properties: SkiaLayerProperties
) = when(renderApi) {
GraphicsApi.SOFTWARE -> SoftwareRedrawer(layer) GraphicsApi.SOFTWARE -> SoftwareRedrawer(layer)
GraphicsApi.DIRECT3D -> Direct3DRedrawer(layer) GraphicsApi.DIRECT3D -> Direct3DRedrawer(layer)
else -> WindowsOpenGLRedrawer(layer, properties) else -> WindowsOpenGLRedrawer(layer, properties)
...@@ -81,18 +89,22 @@ internal val platformOperations: PlatformOperations by lazy { ...@@ -81,18 +89,22 @@ internal val platformOperations: PlatformOperations by lazy {
// TODO doesn't work well because java doesn't scale windows (content has offset with 200% scale) // TODO doesn't work well because java doesn't scale windows (content has offset with 200% scale)
// //
// Two solutions: // Two solutions:
// 1. dynamically change sun.java2d.uiScale (it is global property, so we have to be careful) and update all windows // 1. dynamically change sun.java2d.uiScale (it is global property,
// so we have to be careful) and update all windows
// //
// 2. apply contentScale manually to all windows // 2. apply contentScale manually to all windows
// (it is not good, because on different platform windows will have different size. // (it is not good, because on different platform windows will have different size.
// Maybe we will apply contentScale manually on all platforms?) // Maybe we will apply contentScale manually on all platforms?)
// see also comment for HardwareLayer.checkContentScale // see also comment for HardwareLayer.checkContentScale
// return component.useDrawingSurfacePlatformInfo(::linuxGetDpiScaleNative)
// return component.useDrawingSurfacePlatformInfo(::linuxGetDpiScaleNative)
} }
override fun createRedrawer(layer: HardwareLayer, renderApi: GraphicsApi, properties: SkiaLayerProperties) = when(renderApi) { override fun createRedrawer(
layer: HardwareLayer,
renderApi: GraphicsApi,
properties: SkiaLayerProperties
) = when(renderApi) {
GraphicsApi.SOFTWARE -> SoftwareRedrawer(layer) GraphicsApi.SOFTWARE -> SoftwareRedrawer(layer)
else -> LinuxOpenGLRedrawer(layer, properties) else -> LinuxOpenGLRedrawer(layer, properties)
} }
......
...@@ -11,24 +11,36 @@ internal class Direct3DRedrawer( ...@@ -11,24 +11,36 @@ internal class Direct3DRedrawer(
private val layer: HardwareLayer private val layer: HardwareLayer
) : Redrawer { ) : Redrawer {
private var isDisposed = false
private var device: Long = 0 private var device: Long = 0
private val frameDispatcher = FrameDispatcher(Dispatchers.Swing) { private val frameDispatcher = FrameDispatcher(Dispatchers.Swing) {
layer.update(System.nanoTime()) update(System.nanoTime())
layer.draw() draw()
} }
override fun dispose() { override fun dispose() {
frameDispatcher.cancel() frameDispatcher.cancel()
disposeDevice(device) disposeDevice(device)
isDisposed = true
} }
override fun needRedraw() { override fun needRedraw() {
check(!isDisposed)
frameDispatcher.scheduleFrame() frameDispatcher.scheduleFrame()
} }
override fun redrawImmediately() { override fun redrawImmediately() {
layer.update(System.nanoTime()) check(!isDisposed)
update(System.nanoTime())
draw()
}
private fun update(nanoTime: Long) {
layer.update(nanoTime)
}
private fun draw() {
layer.draw() layer.draw()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment