@@ -252,41 +252,38 @@ private bool SetThumbnail(SKBitmap image, ILogger log)
252252
253253 SKBitmap centeredBitmap ;
254254 SKCanvas canvas ;
255+ SKPaint paint = new ( ) { IsAntialias = true , IsDither = true } ;
255256 switch ( BackgroundType )
256257 {
257258 case BgType . TEX_CG :
258259 {
259260 centeredBitmap = new ( 96 , 128 ) ;
260- SKBitmap actualSizeBitmap = image . Resize ( new SKSizeI ( 96 , 72 ) , SKSamplingOptions . Default ) ;
261261 canvas = new ( centeredBitmap ) ;
262- canvas . DrawBitmap ( actualSizeBitmap , 0 , 12 ) ;
262+ canvas . DrawImage ( SKImage . FromBitmap ( image ) , new ( 0 , 0 , image . Width , image . Height ) , new SKRect ( 0 , 12 , 96 , 84 ) , new ( SKCubicResampler . Mitchell ) , paint ) ;
263263 break ;
264264 }
265265
266266 case BgType . TEX_CG_SINGLE :
267267 {
268268 centeredBitmap = new ( 96 , 128 ) ;
269- SKBitmap actualSizeBitmap = image . Resize ( new SKSizeI ( 96 , 96 ) , SKSamplingOptions . Default ) ;
270269 canvas = new ( centeredBitmap ) ;
271- canvas . DrawBitmap ( actualSizeBitmap , 0 , 0 ) ;
270+ canvas . DrawImage ( SKImage . FromBitmap ( image ) , new ( 0 , 0 , image . Width , image . Height ) , new SKRect ( 0 , 0 , 96 , 96 ) , new ( SKCubicResampler . Mitchell ) , paint ) ;
272271 break ;
273272 }
274273
275274 case BgType . TEX_CG_WIDE :
276275 {
277276 centeredBitmap = new ( 128 , 128 ) ;
278- SKBitmap actualSizeBitmap = image . Resize ( new SKSizeI ( 128 , 72 ) , SKSamplingOptions . Default ) ;
279277 canvas = new ( centeredBitmap ) ;
280- canvas . DrawBitmap ( actualSizeBitmap , 0 , 12 ) ;
278+ canvas . DrawImage ( SKImage . FromBitmap ( image ) , new ( 0 , 0 , image . Width , image . Height ) , new SKRect ( 0 , 12 , 128 , 84 ) , new ( SKCubicResampler . Mitchell ) , paint ) ;
281279 break ;
282280 }
283281
284282 case BgType . TEX_CG_DUAL_SCREEN :
285283 {
286284 centeredBitmap = new ( 96 , 128 ) ;
287- SKBitmap actualSizeBitmap = image . Resize ( new SKSizeI ( 112 , 124 ) , SKSamplingOptions . Default ) ;
288285 canvas = new ( centeredBitmap ) ;
289- canvas . DrawBitmap ( actualSizeBitmap , 8 , 2 ) ;
286+ canvas . DrawImage ( SKImage . FromBitmap ( image ) , new ( 0 , 0 , image . Width , image . Height ) , new SKRect ( 8 , 2 , 120 , 126 ) , new ( SKCubicResampler . Mitchell ) , paint ) ;
290287 break ;
291288 }
292289
0 commit comments