OSDN Git Service

DPIの設定がメトロ版で反映されていなかった
authorgdkhd812 <test@yahoo.co.jp>
Wed, 5 Apr 2017 12:49:36 +0000 (21:49 +0900)
committergdkhd812 <test@yahoo.co.jp>
Wed, 5 Apr 2017 12:49:36 +0000 (21:49 +0900)
UWP/FooEditEngine.UWP/Direct2D/D2DRender.cs

index 2f2341d..1be45fb 100644 (file)
@@ -88,6 +88,11 @@ namespace FooEditEngine
             SharpDX.Mathematics.Interop.RawPoint offset;
             this.Surface = this.SurfaceImageNative.BeginDraw(
                 new SharpDX.Rectangle(0, 0, (int)this.Size.Width, (int)this.Size.Height), out offset);
+            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;
             this.Bitmap = new D2D.Bitmap1(this.D2DContext, this.Surface, null);
             this.D2DContext.Target = this.Bitmap;
             this.D2DContext.Transform = Matrix3x2.Translation(offset.X, offset.Y);
@@ -118,10 +123,12 @@ namespace FooEditEngine
             rect.Fill = brush;
         }
 
+        D2D.RenderTargetProperties _RenderTargetProperties;
         protected override D2D.RenderTarget ConstructRender(D2D.Factory1 factory, D2D.RenderTargetProperties prop, double width, double height)
         {
             this.D2DDevice = new D2D.Device(factory,this.DXGIDevice);
             this.D2DContext = new D2D.DeviceContext(this.D2DDevice, D2D.DeviceContextOptions.None);
+            this._RenderTargetProperties = prop;
             return this.D2DContext;
         }