update library/src/main/ets/downsampling/DownsampleStartegy.ets.
Signed-off-by: 田双明 <tianshuangming@h-partners.com>
This commit is contained in:
parent
c79046f005
commit
d2646b5ad4
|
@ -101,7 +101,6 @@ export class CenterInside implements BaseDownsampling {
|
||||||
getScaleFactor(sourceWidth: number, sourceHeight: number, requestedWidth: number, requestedHeight: number,
|
getScaleFactor(sourceWidth: number, sourceHeight: number, requestedWidth: number, requestedHeight: number,
|
||||||
downsampType: DownsampleStrategy
|
downsampType: DownsampleStrategy
|
||||||
): number {
|
): number {
|
||||||
|
|
||||||
let outSize: Size = {
|
let outSize: Size = {
|
||||||
width: round(Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)) * sourceWidth),
|
width: round(Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)) * sourceWidth),
|
||||||
height:round(Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)) * sourceHeight)
|
height:round(Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)) * sourceHeight)
|
||||||
|
@ -127,17 +126,7 @@ export class CenterInside implements BaseDownsampling {
|
||||||
return SampleSizeRounding.QUALITY
|
return SampleSizeRounding.QUALITY
|
||||||
}
|
}
|
||||||
//否则,使用 FIL_CENTER 的 SampleSizeRounding 值
|
//否则,使用 FIL_CENTER 的 SampleSizeRounding 值
|
||||||
return this.getSampleSize(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType);
|
return downsampType === DownsampleStrategy.CENTER_INSIDE_MEMORY?SampleSizeRounding.MEMORY:SampleSizeRounding.QUALITY
|
||||||
}
|
|
||||||
|
|
||||||
getSampleSize(sourceWidth: number, sourceHeight: number, requestedWidth: number, requestedHeight: number,
|
|
||||||
downsampType: DownsampleStrategy
|
|
||||||
): SampleSizeRounding {
|
|
||||||
if (downsampType === DownsampleStrategy.CENTER_INSIDE_MEMORY) {
|
|
||||||
return SampleSizeRounding.MEMORY;
|
|
||||||
} else {
|
|
||||||
return SampleSizeRounding.QUALITY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue