update library/src/main/ets/downsampling/DownsampleStartegy.ets.
Signed-off-by: 田双明 <tianshuangming@h-partners.com>
This commit is contained in:
parent
618df4c3bb
commit
c9957c458f
|
@ -152,13 +152,11 @@ export class CenterInside implements BaseDownsampling {
|
|||
width: round(Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)) * sourceWidth),
|
||||
height:round(Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)) * sourceHeight)
|
||||
}
|
||||
//将整型的缩放因子转换为2的次幂采样大小
|
||||
let scaleFactor = this.getSampleSizeType(sourceWidth, sourceHeight, requestedWidth, requestedHeight,
|
||||
downsampType) == SampleSizeRounding.QUALITY ?
|
||||
Math.max(sourceWidth / outSize.width, sourceHeight / outSize.height) :
|
||||
Math.min(sourceWidth / outSize.width, sourceHeight / outSize.height) //重新计算宽高比
|
||||
|
||||
scaleFactor = Math.max(1, highestOneBit(scaleFactor))//将整型的缩放因子转换为2的次幂采样大小
|
||||
|
||||
Math.max(1, highestOneBit(Math.max(sourceWidth / outSize.width, sourceHeight / outSize.height))) :
|
||||
Math.max(1, highestOneBit(Math.min(sourceWidth / outSize.width, sourceHeight / outSize.height)))
|
||||
if (this.getSampleSizeType(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)
|
||||
== SampleSizeRounding.MEMORY && (scaleFactor < (1 / Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType))))) {
|
||||
scaleFactor = scaleFactor << 1;
|
||||
|
|
Loading…
Reference in New Issue