@@ -29,6 +29,7 @@ protected override Document GetFlatDocument(string svgdata, SvgImportConfig conf
29
29
30
30
ctoken . ThrowIfCancellationRequested ( ) ;
31
31
( int width , int height ) = ( config . RasterWidth , config . RasterHeight ) ;
32
+ using BenchmarkScope _ = new BenchmarkScope ( ) ;
32
33
using MemoryFailPoint mfp = GetMemoryFailPoint ( width , height , 1 ) ;
33
34
ResetProgress ( 1 ) ;
34
35
Surface surface = new Surface ( width , height , SurfaceCreationFlags . DoNotZeroFillHint ) ;
@@ -64,13 +65,14 @@ protected override Document GetLayeredDocument(string svgdata, SvgImportConfig c
64
65
ArgumentException . ThrowIfNullOrWhiteSpace ( svgdata ) ;
65
66
ArgumentNullException . ThrowIfNull ( config ) ;
66
67
68
+ using BenchmarkScope _ = new BenchmarkScope ( ) ;
67
69
SvgDocument svg = SvgDocument . FromSvg < SvgDocument > ( svgdata ) ;
68
- using IDisposable _ = svg . UseSetRasterDimensions ( config ) ;
70
+ using IDisposable _1 = svg . UseSetRasterDimensions ( config ) ;
69
71
70
72
List < SvgVisualElement > elements = GetSvgVisualElements ( svg , config , ctoken ) ;
71
73
ctoken . ThrowIfCancellationRequested ( ) ;
72
74
73
- using MemoryFailPoint _1 = GetMemoryFailPoint ( config . RasterWidth , config . RasterHeight , elements . Count ) ; // We will probably need a bit more that this but that's okay.
75
+ using MemoryFailPoint _2 = GetMemoryFailPoint ( config . RasterWidth , config . RasterHeight , elements . Count ) ;
74
76
75
77
ResetProgress ( elements . Count ) ;
76
78
List < BitmapLayer > layers = [ ] ;
@@ -146,36 +148,35 @@ protected override Document GetLayeredDocument(string svgdata, SvgImportConfig c
146
148
147
149
public override Document GetNoPathDocument ( )
148
150
{
149
- string text = SR . NoPath ;
150
151
IDirectWriteFactory dw = Services . Get < IDirectWriteFactory > ( ) ;
151
152
IDirect2DFactory d2d = Services . Get < IDirect2DFactory > ( ) ;
152
153
using ITextFormat textFormat = dw . CreateTextFormat ( "Arial" , null , FontWeight . Bold , FontStyle . Normal , FontStretch . Normal , UIScaleFactor . ConvertFontPointsToDips ( 24 ) ) ;
153
- using ITextLayout textLayout = dw . CreateTextLayout ( text , textFormat ) ;
154
+ using ITextLayout textLayout = dw . CreateTextLayout ( SR . NoPath , textFormat ) ;
154
155
textLayout . WordWrapping = WordWrapping . NoWrap ;
155
- TextMeasurement tm = textLayout . Measure ( ) ;
156
- int width = ( int ) tm . Width ;
157
- int height = ( int ) tm . Height ;
158
- // StrokeStyleProperties ssprops = StrokeStyleProperties.Default;
159
- // ssprops .LineJoin = LineJoin.Bevel;
160
- // ssprops .MiterLimit = 0;
156
+ TextMeasurement textMeasurement = textLayout . Measure ( ) ;
157
+ int width = ( int ) textMeasurement . Width ;
158
+ int height = ( int ) textMeasurement . Height ;
159
+ //StrokeStyleProperties strokeStyleProperties = StrokeStyleProperties.Default;
160
+ //strokeStyleProperties .LineJoin = LineJoin.Bevel;
161
+ //strokeStyleProperties .MiterLimit = 0;
161
162
Surface surface = new Surface ( width , height , SurfaceCreationFlags . DoNotZeroFillHint ) ;
162
163
using ( IBitmap < ColorBgra32 > shared = surface . CreateSharedBitmap ( ) )
163
164
using ( IBitmap < ColorPbgra32 > premltd = shared . CreatePremultipliedAdapter ( PremultipliedAdapterOptions . UnPremultiplyOnDispose ) )
164
165
using ( IDeviceContext dc = d2d . CreateBitmapDeviceContext ( premltd ) )
165
166
using ( ISolidColorBrush textBrush = dc . CreateSolidColorBrush ( Color . Black ) )
166
167
//using (ISolidColorBrush strokeBrush = dc.CreateSolidColorBrush(Color.Red))
167
- //using (IGeometry textGeometry = d2d.CreateGeometryFromTextLayout(layout ))
168
- //using (IStrokeStyle strokeStyle = d2d.CreateStrokeStyle(ssprops ))
169
- //using (IGeometry widenedGeometry = textGeometry.Widen(10 , strokeStyle))
168
+ //using (IGeometry textGeometry = d2d.CreateGeometryFromTextLayout(textLayout ))
169
+ //using (IStrokeStyle strokeStyle = d2d.CreateStrokeStyle(strokeStyleProperties ))
170
+ //using (IGeometry widenedGeometry = textGeometry.Widen(1 , strokeStyle))
170
171
//using (IGeometry outerStrokeGeometry = widenedGeometry.CombineWithGeometry(textGeometry, GeometryCombineMode.Exclude))
171
172
using ( dc . UseTextRenderingMode ( TextRenderingMode . Default ) )
172
173
using ( dc . UseTextAntialiasMode ( TextAntialiasMode . Grayscale ) )
173
174
using ( dc . UseBeginDraw ( ) )
174
175
{
175
176
dc . Clear ( Color . LightGray ) ;
176
177
dc . DrawTextLayout ( 0 , 0 , textLayout , textBrush , DrawTextOptions . EnableColorFont ) ;
177
- // dc.FillGeometry(textGeometry, textBrush);
178
- // dc.FillGeometry(outerStrokeGeometry, strokeBrush);
178
+ //dc.FillGeometry(textGeometry, textBrush);
179
+ //dc.FillGeometry(outerStrokeGeometry, strokeBrush);
179
180
}
180
181
return surface . CreateSingleLayerDocument ( takeOwnership : true ) ;
181
182
}
0 commit comments