• R/O
  • HTTP
  • SSH
  • HTTPS

FooEditEngine: Commit


Commit MetaInfo

Revision1f87f5a611cb2d7013cc960a5382df6b3abc0ab2 (tree)
Time2019-04-09 20:26:26
Authortest <test@yaho...>
Commitertest

Log Message

メモリーリークが発生するのでsharpdxだけ4.0.1に戻した

Change Summary

Incremental Difference

--- a/Core/Direct2D/InlineChar.cs
+++ b/Core/Direct2D/InlineChar.cs
@@ -15,14 +15,14 @@ using DW = SharpDX.DirectWrite;
1515
1616 namespace FooEditEngine
1717 {
18- sealed class InlineChar : CallbackBase, DW.InlineObject
18+ sealed class InlineChar : DW.InlineObject
1919 {
2020 DW.TextLayout Layout;
2121 ColorBrushCollection brushes;
2222 Color4 DefaultFore;
23- public InlineChar(DW.Factory factory, DW.TextFormat format,ColorBrushCollection brushes, Color4 Fore, char c)
23+ public InlineChar(DW.Factory factory, DW.TextFormat format, ColorBrushCollection brushes, Color4 Fore, char c)
2424 {
25- this.Layout = new DW.TextLayout(factory,c.ToString(),format,float.MaxValue,float.MaxValue);
25+ this.Layout = new DW.TextLayout(factory, c.ToString(), format, float.MaxValue, float.MaxValue);
2626 this.Layout.ReadingDirection = DW.ReadingDirection.LeftToRight;
2727 this.AlternativeChar = c;
2828 this.brushes = brushes;
@@ -74,7 +74,7 @@ namespace FooEditEngine
7474 {
7575 get
7676 {
77- if(_Metrics == null)
77+ if (_Metrics == null)
7878 {
7979 DW.InlineObjectMetrics value = new DW.InlineObjectMetrics();
8080 value.Height = this.Layout.Metrics.Height;
@@ -92,7 +92,7 @@ namespace FooEditEngine
9292 {
9393 get
9494 {
95- if(_OverhangMetrics == null)
95+ if (_OverhangMetrics == null)
9696 {
9797 DW.OverhangMetrics value = new DW.OverhangMetrics();
9898 DW.TextMetrics metrics = this.Layout.Metrics;
@@ -112,22 +112,20 @@ namespace FooEditEngine
112112 set;
113113 }
114114
115- //disposeしてはいけないらしい
116- //protected override void Dispose(bool disposing)
117- //{
118- // base.Dispose(disposing);
119- // this.Layout.Dispose();
120- //}
121-
115+ public void Dispose()
116+ {
117+ this.Layout.Dispose();
118+ return;
119+ }
122120 }
123121
124- sealed class InlineTab : CallbackBase,DW.InlineObject
122+ sealed class InlineTab : DW.InlineObject
125123 {
126124 double _TabWidth;
127125 double LineHeight;
128126 ColorBrushCollection brushes;
129127 Color4 DefaultFore;
130- public InlineTab(ColorBrushCollection brushes, Color4 Fore, double witdh,double lineHeight)
128+ public InlineTab(ColorBrushCollection brushes, Color4 Fore, double witdh, double lineHeight)
131129 {
132130 this._TabWidth = witdh;
133131 this.LineHeight = lineHeight;
@@ -140,7 +138,7 @@ namespace FooEditEngine
140138 {
141139 get
142140 {
143- if(_Metrics == null)
141+ if (_Metrics == null)
144142 {
145143 DW.InlineObjectMetrics value = new DW.InlineObjectMetrics();
146144 value.Width = (float)this._TabWidth;
@@ -218,5 +216,8 @@ namespace FooEditEngine
218216 set;
219217 }
220218
219+ public void Dispose()
220+ {
221+ }
221222 }
222223 }
--- a/Core/Direct2D/MultiSet.cs
+++ b/Core/Direct2D/MultiSet.cs
@@ -47,7 +47,7 @@ namespace FooEditEngine
4747 {
4848 if (c == '\t')
4949 {
50- this.InlineTabs = new MultiSet<double,InlineTab>();
50+ this.InlineTabs = new MultiSet<double, InlineTab>();
5151 }
5252 else
5353 {
@@ -104,13 +104,13 @@ namespace FooEditEngine
104104 }
105105 set
106106 {
107- this._TabWidth = value;
108- if(this.InlineTabs != null)
107+ this._TabWidth = value;
108+ if (this.InlineTabs != null)
109109 this.InlineTabs.Clear();
110110 }
111111 }
112112
113- public DW.InlineObject Get(MyTextLayout layout,int index, string str)
113+ public DW.InlineObject Get(MyTextLayout layout, int index, string str)
114114 {
115115 if (str[index] == '\t')
116116 {
@@ -130,7 +130,7 @@ namespace FooEditEngine
130130 collection = new List<InlineTab>();
131131 D2D.SolidColorBrush brush = this.Brushes.Get(this.Fore);
132132 for (int i = 0; i < DuplicateCount; i++)
133- collection.Add(new InlineTab(this.Brushes, this.Fore, width,layout.Height));
133+ collection.Add(new InlineTab(this.Brushes, this.Fore, width, layout.Height));
134134 this.InlineTabs.Add(width, collection);
135135 }
136136 return collection[index % DuplicateCount];
@@ -146,9 +146,9 @@ namespace FooEditEngine
146146
147147 public void Clear()
148148 {
149- if(this.InlineChars != null)
149+ if (this.InlineChars != null)
150150 this.InlineChars.Clear();
151- if(this.InlineTabs != null)
151+ if (this.InlineTabs != null)
152152 this.InlineTabs.Clear();
153153 }
154154
@@ -212,7 +212,7 @@ namespace FooEditEngine
212212 return this.Collection.TryGetValue(key, out value);
213213 }
214214
215- public J Get(T key,int index)
215+ public J Get(T key, int index)
216216 {
217217 return this.Collection[key][index];
218218 }
@@ -228,12 +228,9 @@ namespace FooEditEngine
228228
229229 public void Clear()
230230 {
231- /*
232- * Dispose()すると落ちる
233231 foreach (List<J> list in this.Collection.Values)
234232 foreach (J value in list)
235233 value.Dispose();
236- */
237234 this.Collection.Clear();
238235 }
239236
--- a/UWP/FooEditEngine.UWP/Direct2D/D2DRenderBase.cs
+++ b/UWP/FooEditEngine.UWP/Direct2D/D2DRenderBase.cs
@@ -24,7 +24,7 @@ using FooEditEngine.UWP;
2424
2525 namespace FooEditEngine
2626 {
27- class D2DRenderBase: D2DRenderCommon,IDisposable
27+ class D2DRenderBase : D2DRenderCommon, IDisposable
2828 {
2929 public new const int MiniumeWidth = 40; //これ以上ないと誤操作が起こる
3030
@@ -93,9 +93,8 @@ namespace FooEditEngine
9393 {
9494 this.Brushes.Clear();
9595 this.Strokes.Clear();
96- //ここでDispose()する必要はない。すると落ちる
97- //if (this.textRender != null)
98- // this.textRender.Dispose();
96+ if (this.textRender != null)
97+ this.textRender.Dispose();
9998 if (this.D2DDevice != null)
10099 this.D2DDevice.Dispose();
101100 if (this.D2DContext != null)
@@ -181,7 +180,7 @@ namespace FooEditEngine
181180 return false;
182181 }
183182
184- public void DrawOneLine(Document doc,LineToIndexTable lti, int row, double x, double y)
183+ public void DrawOneLine(Document doc, LineToIndexTable lti, int row, double x, double y)
185184 {
186185 this.DrawOneLine(doc,
187186 lti,
--- a/UWP/FooEditEngine.UWP/FooEditEngine.UWP.csproj
+++ b/UWP/FooEditEngine.UWP/FooEditEngine.UWP.csproj
@@ -126,19 +126,19 @@
126126 <Version>5.0.0</Version>
127127 </PackageReference>
128128 <PackageReference Include="SharpDX">
129- <Version>4.2.0</Version>
129+ <Version>4.0.1</Version>
130130 </PackageReference>
131131 <PackageReference Include="SharpDX.Direct2D1">
132- <Version>4.2.0</Version>
132+ <Version>4.0.1</Version>
133133 </PackageReference>
134134 <PackageReference Include="SharpDX.Direct3D11">
135- <Version>4.2.0</Version>
135+ <Version>4.0.1</Version>
136136 </PackageReference>
137137 <PackageReference Include="SharpDX.DXGI">
138- <Version>4.2.0</Version>
138+ <Version>4.0.1</Version>
139139 </PackageReference>
140140 <PackageReference Include="SharpDX.Mathematics">
141- <Version>4.2.0</Version>
141+ <Version>4.0.1</Version>
142142 </PackageReference>
143143 </ItemGroup>
144144 <ItemGroup>
--- a/WPF/FooEditEngine/Direct2D/D2DRender.cs
+++ b/WPF/FooEditEngine/Direct2D/D2DRender.cs
@@ -44,7 +44,7 @@ namespace FooEditEngine.WPF
4444 FontStyle fontStyle;
4545 D3DImage imageSource;
4646
47- public D2DRender(FooTextBox textbox, double width, double height,Image image)
47+ public D2DRender(FooTextBox textbox, double width, double height, Image image)
4848 {
4949 this.fontFamily = textbox.FontFamily;
5050 this.fontSize = textbox.FontSize;
@@ -111,7 +111,7 @@ namespace FooEditEngine.WPF
111111 set
112112 {
113113 this.fontWeigth = value;
114- this.InitTextFormat(this.fontFamily.Source, (float)this.fontSize, this.GetDWFontWeigth(value),this.GetDWFontStyle(this.fontStyle));
114+ this.InitTextFormat(this.fontFamily.Source, (float)this.fontSize, this.GetDWFontWeigth(value), this.GetDWFontStyle(this.fontStyle));
115115 }
116116 }
117117
@@ -152,7 +152,7 @@ namespace FooEditEngine.WPF
152152 this.ConstructRenderAndResource(width, height);
153153 }
154154
155- public void DrawContent(EditView view,bool IsEnabled,Rectangle updateRect)
155+ public void DrawContent(EditView view, bool IsEnabled, Rectangle updateRect)
156156 {
157157 if (this.imageSource.IsFrontBufferAvailable)
158158 {
@@ -172,7 +172,7 @@ namespace FooEditEngine.WPF
172172 }
173173 }
174174
175- public void DrawOneLine(Document doc,LineToIndexTable lti, int row, double x, double y)
175+ public void DrawOneLine(Document doc, LineToIndexTable lti, int row, double x, double y)
176176 {
177177 PreDrawOneLineHandler PreDrawOneLine = null;
178178
@@ -188,7 +188,7 @@ namespace FooEditEngine.WPF
188188 );
189189 }
190190
191- private void DrawImeConversionLine(MyTextLayout layout,LineToIndexTable lti,int row,double x,double y)
191+ private void DrawImeConversionLine(MyTextLayout layout, LineToIndexTable lti, int row, double x, double y)
192192 {
193193 using (Unlocker locker = this.store.LockDocument(false))
194194 {
@@ -245,7 +245,7 @@ namespace FooEditEngine.WPF
245245 private Color4? GetColor4(TF_DA_COLOR cr)
246246 {
247247 COLORREF colorref;
248- switch(cr.type)
248+ switch (cr.type)
249249 {
250250 case TF_DA_COLORTYPE.TF_CT_SYSCOLOR:
251251 colorref = new COLORREF(NativeMethods.GetSysColor((int)cr.indexOrColorRef));
@@ -428,9 +428,8 @@ namespace FooEditEngine.WPF
428428 this.cachedBitMap.Dispose();
429429 this.Brushes.Clear();
430430 this.Strokes.Clear();
431- //ここでDispose()すると落ちる
432- //if (this.textRender != null)
433- // this.textRender.Dispose();
431+ if (this.textRender != null)
432+ this.textRender.Dispose();
434433 if (this.texture != null)
435434 this.texture.Dispose();
436435 if (this.surface != null)
--- a/WPF/FooEditEngine/FooEditEngine.csproj
+++ b/WPF/FooEditEngine/FooEditEngine.csproj
@@ -87,16 +87,16 @@
8787 <Version>5.0.0</Version>
8888 </PackageReference>
8989 <PackageReference Include="SharpDX.Direct2D1">
90- <Version>4.2.0</Version>
90+ <Version>4.0.1</Version>
9191 </PackageReference>
9292 <PackageReference Include="SharpDX.Direct3D11">
93- <Version>4.2.0</Version>
93+ <Version>4.0.1</Version>
9494 </PackageReference>
9595 <PackageReference Include="SharpDX.Direct3D9">
96- <Version>4.2.0</Version>
96+ <Version>4.0.1</Version>
9797 </PackageReference>
9898 <PackageReference Include="SharpDX.Mathematics">
99- <Version>4.2.0</Version>
99+ <Version>4.0.1</Version>
100100 </PackageReference>
101101 </ItemGroup>
102102 <Import Project="..\..\Core\Core.projitems" Label="Shared" />
Show on old repository browser