From 1f87f5a611cb2d7013cc960a5382df6b3abc0ab2 Mon Sep 17 00:00:00 2001 From: test Date: Tue, 9 Apr 2019 20:26:26 +0900 Subject: [PATCH] =?utf8?q?=E3=83=A1=E3=83=A2=E3=83=AA=E3=83=BC=E3=83=AA?= =?utf8?q?=E3=83=BC=E3=82=AF=E3=81=8C=E7=99=BA=E7=94=9F=E3=81=99=E3=82=8B?= =?utf8?q?=E3=81=AE=E3=81=A7sharpdx=E3=81=A0=E3=81=914.0.1=E3=81=AB?= =?utf8?q?=E6=88=BB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Core/Direct2D/InlineChar.cs | 31 +++++++++++++------------ Core/Direct2D/MultiSet.cs | 19 +++++++-------- UWP/FooEditEngine.UWP/Direct2D/D2DRenderBase.cs | 9 ++++--- UWP/FooEditEngine.UWP/FooEditEngine.UWP.csproj | 10 ++++---- WPF/FooEditEngine/Direct2D/D2DRender.cs | 17 +++++++------- WPF/FooEditEngine/FooEditEngine.csproj | 8 +++---- 6 files changed, 45 insertions(+), 49 deletions(-) diff --git a/Core/Direct2D/InlineChar.cs b/Core/Direct2D/InlineChar.cs index 935acca..642cfb3 100644 --- a/Core/Direct2D/InlineChar.cs +++ b/Core/Direct2D/InlineChar.cs @@ -15,14 +15,14 @@ using DW = SharpDX.DirectWrite; namespace FooEditEngine { - sealed class InlineChar : CallbackBase, DW.InlineObject + sealed class InlineChar : DW.InlineObject { DW.TextLayout Layout; ColorBrushCollection brushes; Color4 DefaultFore; - public InlineChar(DW.Factory factory, DW.TextFormat format,ColorBrushCollection brushes, Color4 Fore, char c) + public InlineChar(DW.Factory factory, DW.TextFormat format, ColorBrushCollection brushes, Color4 Fore, char c) { - this.Layout = new DW.TextLayout(factory,c.ToString(),format,float.MaxValue,float.MaxValue); + this.Layout = new DW.TextLayout(factory, c.ToString(), format, float.MaxValue, float.MaxValue); this.Layout.ReadingDirection = DW.ReadingDirection.LeftToRight; this.AlternativeChar = c; this.brushes = brushes; @@ -74,7 +74,7 @@ namespace FooEditEngine { get { - if(_Metrics == null) + if (_Metrics == null) { DW.InlineObjectMetrics value = new DW.InlineObjectMetrics(); value.Height = this.Layout.Metrics.Height; @@ -92,7 +92,7 @@ namespace FooEditEngine { get { - if(_OverhangMetrics == null) + if (_OverhangMetrics == null) { DW.OverhangMetrics value = new DW.OverhangMetrics(); DW.TextMetrics metrics = this.Layout.Metrics; @@ -112,22 +112,20 @@ namespace FooEditEngine set; } - //disposeしてはいけないらしい - //protected override void Dispose(bool disposing) - //{ - // base.Dispose(disposing); - // this.Layout.Dispose(); - //} - + public void Dispose() + { + this.Layout.Dispose(); + return; + } } - sealed class InlineTab : CallbackBase,DW.InlineObject + sealed class InlineTab : DW.InlineObject { double _TabWidth; double LineHeight; ColorBrushCollection brushes; Color4 DefaultFore; - public InlineTab(ColorBrushCollection brushes, Color4 Fore, double witdh,double lineHeight) + public InlineTab(ColorBrushCollection brushes, Color4 Fore, double witdh, double lineHeight) { this._TabWidth = witdh; this.LineHeight = lineHeight; @@ -140,7 +138,7 @@ namespace FooEditEngine { get { - if(_Metrics == null) + if (_Metrics == null) { DW.InlineObjectMetrics value = new DW.InlineObjectMetrics(); value.Width = (float)this._TabWidth; @@ -218,5 +216,8 @@ namespace FooEditEngine set; } + public void Dispose() + { + } } } diff --git a/Core/Direct2D/MultiSet.cs b/Core/Direct2D/MultiSet.cs index 801d279..963f4da 100644 --- a/Core/Direct2D/MultiSet.cs +++ b/Core/Direct2D/MultiSet.cs @@ -47,7 +47,7 @@ namespace FooEditEngine { if (c == '\t') { - this.InlineTabs = new MultiSet(); + this.InlineTabs = new MultiSet(); } else { @@ -104,13 +104,13 @@ namespace FooEditEngine } set { - this._TabWidth = value; - if(this.InlineTabs != null) + this._TabWidth = value; + if (this.InlineTabs != null) this.InlineTabs.Clear(); } } - public DW.InlineObject Get(MyTextLayout layout,int index, string str) + public DW.InlineObject Get(MyTextLayout layout, int index, string str) { if (str[index] == '\t') { @@ -130,7 +130,7 @@ namespace FooEditEngine collection = new List(); D2D.SolidColorBrush brush = this.Brushes.Get(this.Fore); for (int i = 0; i < DuplicateCount; i++) - collection.Add(new InlineTab(this.Brushes, this.Fore, width,layout.Height)); + collection.Add(new InlineTab(this.Brushes, this.Fore, width, layout.Height)); this.InlineTabs.Add(width, collection); } return collection[index % DuplicateCount]; @@ -146,9 +146,9 @@ namespace FooEditEngine public void Clear() { - if(this.InlineChars != null) + if (this.InlineChars != null) this.InlineChars.Clear(); - if(this.InlineTabs != null) + if (this.InlineTabs != null) this.InlineTabs.Clear(); } @@ -212,7 +212,7 @@ namespace FooEditEngine return this.Collection.TryGetValue(key, out value); } - public J Get(T key,int index) + public J Get(T key, int index) { return this.Collection[key][index]; } @@ -228,12 +228,9 @@ namespace FooEditEngine public void Clear() { - /* - * Dispose()すると落ちる foreach (List list in this.Collection.Values) foreach (J value in list) value.Dispose(); - */ this.Collection.Clear(); } diff --git a/UWP/FooEditEngine.UWP/Direct2D/D2DRenderBase.cs b/UWP/FooEditEngine.UWP/Direct2D/D2DRenderBase.cs index 0ee7b55..56370cd 100644 --- a/UWP/FooEditEngine.UWP/Direct2D/D2DRenderBase.cs +++ b/UWP/FooEditEngine.UWP/Direct2D/D2DRenderBase.cs @@ -24,7 +24,7 @@ using FooEditEngine.UWP; namespace FooEditEngine { - class D2DRenderBase: D2DRenderCommon,IDisposable + class D2DRenderBase : D2DRenderCommon, IDisposable { public new const int MiniumeWidth = 40; //これ以上ないと誤操作が起こる @@ -93,9 +93,8 @@ namespace FooEditEngine { this.Brushes.Clear(); this.Strokes.Clear(); - //ここでDispose()する必要はない。すると落ちる - //if (this.textRender != null) - // this.textRender.Dispose(); + if (this.textRender != null) + this.textRender.Dispose(); if (this.D2DDevice != null) this.D2DDevice.Dispose(); if (this.D2DContext != null) @@ -181,7 +180,7 @@ namespace FooEditEngine return false; } - 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) { this.DrawOneLine(doc, lti, diff --git a/UWP/FooEditEngine.UWP/FooEditEngine.UWP.csproj b/UWP/FooEditEngine.UWP/FooEditEngine.UWP.csproj index 247bece..74060a2 100644 --- a/UWP/FooEditEngine.UWP/FooEditEngine.UWP.csproj +++ b/UWP/FooEditEngine.UWP/FooEditEngine.UWP.csproj @@ -126,19 +126,19 @@ 5.0.0 - 4.2.0 + 4.0.1 - 4.2.0 + 4.0.1 - 4.2.0 + 4.0.1 - 4.2.0 + 4.0.1 - 4.2.0 + 4.0.1 diff --git a/WPF/FooEditEngine/Direct2D/D2DRender.cs b/WPF/FooEditEngine/Direct2D/D2DRender.cs index a492978..54d5c74 100644 --- a/WPF/FooEditEngine/Direct2D/D2DRender.cs +++ b/WPF/FooEditEngine/Direct2D/D2DRender.cs @@ -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)); @@ -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) diff --git a/WPF/FooEditEngine/FooEditEngine.csproj b/WPF/FooEditEngine/FooEditEngine.csproj index 850ec6c..f99d2a9 100644 --- a/WPF/FooEditEngine/FooEditEngine.csproj +++ b/WPF/FooEditEngine/FooEditEngine.csproj @@ -87,16 +87,16 @@ 5.0.0 - 4.2.0 + 4.0.1 - 4.2.0 + 4.0.1 - 4.2.0 + 4.0.1 - 4.2.0 + 4.0.1 -- 2.11.0