OSDN Git Service

レンダーターゲットをクラス変数として持たせておく意味はない
[fooeditengine/FooEditEngine.git] / WPF / FooEditEngine / Direct2D / D2DRender.cs
index a492978..e12f559 100644 (file)
@@ -44,7 +44,7 @@ namespace FooEditEngine.WPF
         FontStyle fontStyle;
         D3DImage imageSource;
 
-        public D2DRender(FooTextBox textbox, double width, double height,Image image)
+        public D2DRender(FooTextBox textbox, double width, double height, Image image)
         {
             this.fontFamily = textbox.FontFamily;
             this.fontSize = textbox.FontSize;
@@ -111,7 +111,7 @@ namespace FooEditEngine.WPF
             set
             {
                 this.fontWeigth = value;
-                this.InitTextFormat(this.fontFamily.Source, (float)this.fontSize, this.GetDWFontWeigth(value),this.GetDWFontStyle(this.fontStyle));
+                this.InitTextFormat(this.fontFamily.Source, (float)this.fontSize, this.GetDWFontWeigth(value), this.GetDWFontStyle(this.fontStyle));
             }
         }
 
@@ -152,7 +152,7 @@ namespace FooEditEngine.WPF
             this.ConstructRenderAndResource(width, height);
         }
 
-        public void DrawContent(EditView view,bool IsEnabled,Rectangle updateRect)
+        public void DrawContent(EditView view, bool IsEnabled, Rectangle updateRect)
         {
             if (this.imageSource.IsFrontBufferAvailable)
             {
@@ -172,7 +172,7 @@ namespace FooEditEngine.WPF
             }
         }
 
-        public void DrawOneLine(Document doc,LineToIndexTable lti, int row, double x, double y)
+        public void DrawOneLine(Document doc, LineToIndexTable lti, int row, double x, double y)
         {
             PreDrawOneLineHandler PreDrawOneLine = null;
 
@@ -188,7 +188,7 @@ namespace FooEditEngine.WPF
                 );
         }
 
-        private void DrawImeConversionLine(MyTextLayout layout,LineToIndexTable lti,int row,double x,double y)
+        private void DrawImeConversionLine(MyTextLayout layout, LineToIndexTable lti, int row, double x, double y)
         {
             using (Unlocker locker = this.store.LockDocument(false))
             {
@@ -245,7 +245,7 @@ namespace FooEditEngine.WPF
         private Color4? GetColor4(TF_DA_COLOR cr)
         {
             COLORREF colorref;
-            switch(cr.type)
+            switch (cr.type)
             {
                 case TF_DA_COLORTYPE.TF_CT_SYSCOLOR:
                     colorref = new COLORREF(NativeMethods.GetSysColor((int)cr.indexOrColorRef));
@@ -407,7 +407,7 @@ namespace FooEditEngine.WPF
             resource.Dispose();
             texture.Dispose();
 
-            this.render = new D2D.RenderTarget(this.D2DFactory, this.surface, prop);
+            this.render = new D2D.RenderTarget(D2DRenderShared.D2DFactory, this.surface, prop);
 
             D2D.BitmapProperties bmpProp = new D2D.BitmapProperties();
             bmpProp.DpiX = dpiX;
@@ -416,7 +416,7 @@ namespace FooEditEngine.WPF
             this.cachedBitMap = new D2D.Bitmap(this.render, new SharpDX.Size2((int)width, (int)height), bmpProp);
             this.hasCache = false;
 
-            this.textRender = new CustomTextRenderer(this.render, this.Brushes, this.Strokes, this.Foreground);
+            this.textRender = new CustomTextRenderer(this.Brushes, this.Strokes, this.Foreground);
 
             this.renderSize = new Size(width, height);
         }
@@ -428,9 +428,8 @@ namespace FooEditEngine.WPF
                 this.cachedBitMap.Dispose();
             this.Brushes.Clear();
             this.Strokes.Clear();
-            //ここでDispose()すると落ちる
-            //if (this.textRender != null)
-            //    this.textRender.Dispose();
+            if (this.textRender != null)
+                this.textRender.Dispose();
             if (this.texture != null)
                 this.texture.Dispose();
             if (this.surface != null)