OSDN Git Service
(root)
/
fooeditengine
/
FooEditEngine.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
912fc05
)
サーフェスでUWP版を起動すると表示がぼやけることがあった
author
gdkhd812
<test@yahoo.co.jp>
Thu, 6 Apr 2017 05:02:15 +0000
(14:02 +0900)
committer
gdkhd812
<test@yahoo.co.jp>
Thu, 6 Apr 2017 05:02:15 +0000
(14:02 +0900)
UWP/FooEditEngine.UWP/Direct2D/D2DRender.cs
patch
|
blob
|
history
diff --git
a/UWP/FooEditEngine.UWP/Direct2D/D2DRender.cs
b/UWP/FooEditEngine.UWP/Direct2D/D2DRender.cs
index
1be45fb
..
0e98eee
100644
(file)
--- a/
UWP/FooEditEngine.UWP/Direct2D/D2DRender.cs
+++ b/
UWP/FooEditEngine.UWP/Direct2D/D2DRender.cs
@@
-86,16
+86,20
@@
namespace FooEditEngine
public void DrawContent(EditView view,bool IsEnabled,Rectangle updateRect)
{
SharpDX.Mathematics.Interop.RawPoint offset;
public void DrawContent(EditView view,bool IsEnabled,Rectangle updateRect)
{
SharpDX.Mathematics.Interop.RawPoint offset;
+ //デバイス依存の座標を渡さないといけない
this.Surface = this.SurfaceImageNative.BeginDraw(
this.Surface = this.SurfaceImageNative.BeginDraw(
- new SharpDX.Rectangle(0, 0, (int)
this.Size.Width, (int)this.Size.Height
), out offset);
+ new SharpDX.Rectangle(0, 0, (int)
(this.Size.Width * this.GetScale()), (int)(this.Size.Height * this.GetScale())
), out offset);
var prop = new D2D.BitmapProperties1();
prop.BitmapOptions = D2D.BitmapOptions.Target | D2D.BitmapOptions.CannotDraw | D2D.BitmapOptions.GdiCompatible;
prop.PixelFormat = this._RenderTargetProperties.PixelFormat;
var prop = new D2D.BitmapProperties1();
prop.BitmapOptions = D2D.BitmapOptions.Target | D2D.BitmapOptions.CannotDraw | D2D.BitmapOptions.GdiCompatible;
prop.PixelFormat = this._RenderTargetProperties.PixelFormat;
- prop.DpiX = this._RenderTargetProperties.DpiX;
- prop.DpiY = this._RenderTargetProperties.DpiY;
+
//
prop.DpiX = this._RenderTargetProperties.DpiX;
+
//
prop.DpiY = this._RenderTargetProperties.DpiY;
this.Bitmap = new D2D.Bitmap1(this.D2DContext, this.Surface, null);
this.D2DContext.Target = this.Bitmap;
this.Bitmap = new D2D.Bitmap1(this.D2DContext, this.Surface, null);
this.D2DContext.Target = this.Bitmap;
- this.D2DContext.Transform = Matrix3x2.Translation(offset.X, offset.Y);
+ //こっちはDirect2Dなのでデバイス非依存の座標を渡す
+ float dipOffsetX = (float)(offset.X / this.GetScale());
+ float dipOffsetY = (float)(offset.Y / this.GetScale());
+ this.D2DContext.Transform = Matrix3x2.Translation(dipOffsetX, dipOffsetY);
base.BegineDraw();
if (IsEnabled)
base.BegineDraw();
if (IsEnabled)
@@
-113,7
+117,8
@@
namespace FooEditEngine
{
if (this.SurfaceImageNative != null)
this.SurfaceImageNative.Dispose();
{
if (this.SurfaceImageNative != null)
this.SurfaceImageNative.Dispose();
- this.SurfaceImage = new SurfaceImageSource((int)width, (int)height);
+ //デバイス依存の座標を渡さないといけない
+ this.SurfaceImage = new SurfaceImageSource((int)(width * this.GetScale()), (int)(height * this.GetScale()), false);
this.SurfaceImageNative = ComObject.As<DXGI.ISurfaceImageSourceNative>(this.SurfaceImage);
this.SurfaceImageNative.Device = this.DXGIDevice;
this.Size.Width = width;
this.SurfaceImageNative = ComObject.As<DXGI.ISurfaceImageSourceNative>(this.SurfaceImage);
this.SurfaceImageNative.Device = this.DXGIDevice;
this.Size.Width = width;
@@
-128,6
+133,7
@@
namespace FooEditEngine
{
this.D2DDevice = new D2D.Device(factory,this.DXGIDevice);
this.D2DContext = new D2D.DeviceContext(this.D2DDevice, D2D.DeviceContextOptions.None);
{
this.D2DDevice = new D2D.Device(factory,this.DXGIDevice);
this.D2DContext = new D2D.DeviceContext(this.D2DDevice, D2D.DeviceContextOptions.None);
+ this.D2DContext.DotsPerInch = new Size2F(prop.DpiX, prop.DpiY);
this._RenderTargetProperties = prop;
return this.D2DContext;
}
this._RenderTargetProperties = prop;
return this.D2DContext;
}