From 647b2dc1f877da3efaa657e79cff98c5e1382ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E5=8F=8C=E6=98=8E?= Date: Thu, 10 Oct 2024 08:19:15 +0000 Subject: [PATCH] update library/src/main/ets/downsampling/Downsampler.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 田双明 --- .../src/main/ets/downsampling/Downsampler.ets | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/library/src/main/ets/downsampling/Downsampler.ets b/library/src/main/ets/downsampling/Downsampler.ets index 1b7cdeb..4f15775 100644 --- a/library/src/main/ets/downsampling/Downsampler.ets +++ b/library/src/main/ets/downsampling/Downsampler.ets @@ -18,11 +18,7 @@ import { CenterOutside, DownsampleStrategy, FitCenter, - None, } from './DownsampleStartegy'; -import { highestOneBit, round, SampleSizeRounding } from './DownsampleUtils'; - - export class Downsampler { calculateScaling( typeValue: string, @@ -39,22 +35,6 @@ export class Downsampler { let downsampler = this.getDownsampler(downsampType); let scaleFactor: number = downsampler.getScaleFactor(sourceWidth, sourceHeight, requestWidth, requestHeight, downsampType);//缩放比 - // let rounding: SampleSizeRounding = - // downsampler.getSampleSizeType(sourceWidth, sourceHeight, requestWidth, requestHeight, downsampType); //采样类型 - //根据缩放比重新计算宽高 - // let outSize: Size = { - // width: round(exactScaleFactor * sourceWidth), - // height:round(exactScaleFactor * sourceHeight) - // } - // let scaleFactor = - // rounding == SampleSizeRounding.QUALITY ? Math.max(sourceWidth / exactScaleFactor.width, sourceHeight / exactScaleFactor.height) : - // Math.min(sourceWidth / exactScaleFactor.width, sourceHeight / exactScaleFactor.height) //重新计算宽高比 - - // scaleFactor = Math.max(1, highestOneBit(scaleFactor))//将整型的缩放因子转换为2的次幂采样大小 - // - // if (rounding == 0 && (scaleFactor < (1 / exactScaleFactor))) { - // scaleFactor = scaleFactor << 1; - // } //基于上一步得出的采样大小,根据不同的图片类型,计算采样后的图片尺寸 if (typeValue === "png") { return { @@ -80,8 +60,6 @@ export class Downsampler { case DownsampleStrategy.FIT_CENTER_MEMORY: case DownsampleStrategy.FIT_CENTER_QUALITY: return new FitCenter(); - case DownsampleStrategy.NONE: - return new None(); case DownsampleStrategy.AT_MOST: return new AtMost(); case DownsampleStrategy.CENTER_INSIDE_MEMORY: