Pre Merge pull request !447 from zgf/master

This commit is contained in:
zgf 2024-12-24 08:44:47 +00:00 committed by Gitee
commit 40c6f57b6a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 41 additions and 33 deletions

View File

@ -5,6 +5,8 @@
- Modify memory cache limit and file cache limit - Modify memory cache limit and file cache limit
- Fix record decodeEndTime in imageKinfaData - Fix record decodeEndTime in imageKinfaData
- Add image buffersize in memory cache - Add image buffersize in memory cache
- Optimize the magic number of heif format image files
- Default image request does not require duplicate creation
## 3.2.0-rc.6 ## 3.2.0-rc.6
- Support LogUtil to turn off log - Support LogUtil to turn off log

View File

@ -140,40 +140,46 @@ export struct ImageKnifeComponent {
} }
getRequest(width: number, height: number,componentId: number): ImageKnifeRequest { getRequest(width: number, height: number,componentId: number): ImageKnifeRequest {
this.request = new ImageKnifeRequest( if (this.imageKnifeOption.downsampleOf !== undefined) {
this.imageKnifeOption, this.request = undefined
this.imageKnifeOption.context !== undefined ? this.imageKnifeOption.context : this.getCurrentContext(), }
width,
height, if (this.request == undefined) {
this.componentVersion, this.request = new ImageKnifeRequest(
{ this.imageKnifeOption,
showPixelMap: (version: number, pixelMap: PixelMap | string,size:Size, requestSource: ImageKnifeRequestSource) => { this.imageKnifeOption.context !== undefined ? this.imageKnifeOption.context : this.getCurrentContext(),
if (version !== this.componentVersion) { width,
return //针对reuse场景不显示历史图片 height,
} this.componentVersion,
this.pixelMap = pixelMap {
LogUtil.info('image load showPixelMap:' + this.request?.componentId + ',srcType:' + requestSource + showPixelMap: (version: number, pixelMap: PixelMap | string,size:Size, requestSource: ImageKnifeRequestSource) => {
',version:' + this.request?.componentVersion + if (version !== this.componentVersion) {
',size:' + JSON.stringify(size)) return //针对reuse场景不显示历史图片
if (this.imageKnifeOption.objectFit === ImageFit.Auto && this.isImageFitAutoResize == false && requestSource == ImageKnifeRequestSource.SRC) { }
this.adaptiveHeight = undefined this.pixelMap = pixelMap
this.isImageFitAutoResize = true LogUtil.info('image load showPixelMap:' + this.request?.componentId + ',srcType:' + requestSource +
} ',version:' + this.request?.componentVersion +
',size:' + JSON.stringify(size))
if (this.imageKnifeOption.objectFit === ImageFit.Auto && this.isImageFitAutoResize == false && requestSource == ImageKnifeRequestSource.SRC) {
this.adaptiveHeight = undefined
this.isImageFitAutoResize = true
}
if (requestSource == ImageKnifeRequestSource.SRC) { if (requestSource == ImageKnifeRequestSource.SRC) {
this.objectFit = this.objectFit =
this.imageKnifeOption.objectFit === undefined ? ImageFit.Contain : this.imageKnifeOption.objectFit this.imageKnifeOption.objectFit === undefined ? ImageFit.Contain : this.imageKnifeOption.objectFit
} else if (requestSource == ImageKnifeRequestSource.PLACE_HOLDER) { } else if (requestSource == ImageKnifeRequestSource.PLACE_HOLDER) {
this.objectFit = this.objectFit =
this.imageKnifeOption.placeholderObjectFit === undefined ? (this.imageKnifeOption.objectFit === undefined ? ImageFit.Contain : this.imageKnifeOption.objectFit) : this.imageKnifeOption.placeholderObjectFit this.imageKnifeOption.placeholderObjectFit === undefined ? (this.imageKnifeOption.objectFit === undefined ? ImageFit.Contain : this.imageKnifeOption.objectFit) : this.imageKnifeOption.placeholderObjectFit
} else { } else {
this.objectFit = this.objectFit =
this.imageKnifeOption.errorholderObjectFit === undefined ? (this.imageKnifeOption.objectFit === undefined ? ImageFit.Contain : this.imageKnifeOption.objectFit) : this.imageKnifeOption.errorholderObjectFit this.imageKnifeOption.errorholderObjectFit === undefined ? (this.imageKnifeOption.objectFit === undefined ? ImageFit.Contain : this.imageKnifeOption.objectFit) : this.imageKnifeOption.errorholderObjectFit
}
} }
} },
}, componentId
componentId )
) }
return this.request return this.request
} }
} }

View File

@ -26,7 +26,7 @@ export class FileTypeUtil {
'ico': [new Uint8Array([0x00,0x00,0x01,0x00])], 'ico': [new Uint8Array([0x00,0x00,0x01,0x00])],
'tiff': [new Uint8Array([0x49, 0x20, 0x49]), new Uint8Array([0x49, 0x49, 0x2A, 0x00]), new Uint8Array([0x4D, 0x4D, 0x00, 0x2A]), new Uint8Array([0x4D, 0x4D, 0x00, 0x2B])], 'tiff': [new Uint8Array([0x49, 0x20, 0x49]), new Uint8Array([0x49, 0x49, 0x2A, 0x00]), new Uint8Array([0x4D, 0x4D, 0x00, 0x2A]), new Uint8Array([0x4D, 0x4D, 0x00, 0x2B])],
// 添加更多的文件类型和特征 // 添加更多的文件类型和特征
'heic': [new Uint8Array([0x00, 0x00, 0x00, 0x18, 0x66, 0x74, 0x79, 0x70, 0x68, 0x65, 0x69, 0x63, 0x00, 0x00, 0x00, 0x00]),new Uint8Array([0x00, 0x00, 0x00, 0x1C, 0x66, 0x74, 0x79, 0x70, 0x68, 0x65, 0x69, 0x63, 0x00, 0x00, 0x00, 0x00])], 'heic': [new Uint8Array([0x00, 0x00, 0x00, 0x18, 0x66, 0x74, 0x79, 0x70, 0x68, 0x65, 0x69, 0x63]),new Uint8Array([0x00, 0x00, 0x00, 0x1C, 0x66, 0x74, 0x79, 0x70, 0x6D, 0x69, 0x66, 0x31])],
}; };