下采样冲突解决
This commit is contained in:
parent
38ac84b926
commit
46df24b66b
|
@ -167,7 +167,7 @@ export class RequestManager {
|
||||||
// gif、webp处理
|
// gif、webp处理
|
||||||
if ((ImageKnifeData.GIF == typeValue || ImageKnifeData.WEBP == typeValue) && !request.dontAnimateFlag) {
|
if ((ImageKnifeData.GIF == typeValue || ImageKnifeData.WEBP == typeValue) && !request.dontAnimateFlag) {
|
||||||
// 处理gif、webp
|
// 处理gif、webp
|
||||||
this.gifProcess(onComplete, onError, arrayBuffer, typeValue)
|
this.gifProcess(onComplete, onError, arrayBuffer, typeValue,request)
|
||||||
} else if (ImageKnifeData.SVG == typeValue) {
|
} else if (ImageKnifeData.SVG == typeValue) {
|
||||||
// 处理svg
|
// 处理svg
|
||||||
this.svgProcess(request, onComplete, onError, arrayBuffer, typeValue)
|
this.svgProcess(request, onComplete, onError, arrayBuffer, typeValue)
|
||||||
|
@ -266,7 +266,7 @@ export class RequestManager {
|
||||||
// 解析磁盘文件 gif、webp 和 svg
|
// 解析磁盘文件 gif、webp 和 svg
|
||||||
if ((ImageKnifeData.GIF == typeValue || ImageKnifeData.WEBP == typeValue) && !request.dontAnimateFlag) {
|
if ((ImageKnifeData.GIF == typeValue || ImageKnifeData.WEBP == typeValue) && !request.dontAnimateFlag) {
|
||||||
// 处理gif、webp
|
// 处理gif、webp
|
||||||
this.gifProcess(onComplete, onError, source, typeValue)
|
this.gifProcess(onComplete, onError, source, typeValue,request)
|
||||||
} else if (ImageKnifeData.SVG == typeValue) {
|
} else if (ImageKnifeData.SVG == typeValue) {
|
||||||
this.svgProcess(request, onComplete, onError, source, typeValue)
|
this.svgProcess(request, onComplete, onError, source, typeValue)
|
||||||
} else {
|
} else {
|
||||||
|
@ -396,7 +396,7 @@ export class RequestManager {
|
||||||
// 解析磁盘文件 gif、webp 和 svg
|
// 解析磁盘文件 gif、webp 和 svg
|
||||||
if ((ImageKnifeData.GIF == filetype || ImageKnifeData.WEBP == filetype) && !this.options.dontAnimateFlag) {
|
if ((ImageKnifeData.GIF == filetype || ImageKnifeData.WEBP == filetype) && !this.options.dontAnimateFlag) {
|
||||||
// 处理gif、webp
|
// 处理gif、webp
|
||||||
this.gifProcess(onComplete, onError, source, filetype)
|
this.gifProcess(onComplete, onError, source, filetype,request)
|
||||||
|
|
||||||
// 保存二级磁盘缓存
|
// 保存二级磁盘缓存
|
||||||
Promise.resolve(source)
|
Promise.resolve(source)
|
||||||
|
@ -534,9 +534,17 @@ export class RequestManager {
|
||||||
svgParseImpl.parseSvg(option, arraybuffer, onComplete, onError)
|
svgParseImpl.parseSvg(option, arraybuffer, onComplete, onError)
|
||||||
}
|
}
|
||||||
|
|
||||||
private gifProcess(onComplete: (value: PixelMap | GIFFrame[]) => void | PromiseLike<ImageKnifeData>, onError: (reason?: BusinessError | string) => void, arraybuffer: ArrayBuffer, typeValue: string, cacheStrategy?: (cacheData: ImageKnifeData) => void) {
|
private gifProcess(
|
||||||
|
onComplete: (value: PixelMap | GIFFrame[]) => void | PromiseLike<ImageKnifeData>,
|
||||||
|
onError: (reason?: BusinessError | string) => void,
|
||||||
|
arraybuffer: ArrayBuffer,
|
||||||
|
typeValue: string,
|
||||||
|
request?:RequestOption,
|
||||||
|
cacheStrategy?: (cacheData: ImageKnifeData) => void) {
|
||||||
let gifParseImpl = new GIFParseImpl()
|
let gifParseImpl = new GIFParseImpl()
|
||||||
gifParseImpl.parseGifs(arraybuffer, (data?: GIFFrame[], err?: BusinessError | string) => {
|
gifParseImpl.parseGifs(
|
||||||
|
arraybuffer,
|
||||||
|
(data?: GIFFrame[], err?: BusinessError | string) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
onError(err)
|
onError(err)
|
||||||
}
|
}
|
||||||
|
@ -552,6 +560,6 @@ export class RequestManager {
|
||||||
} else {
|
} else {
|
||||||
onError('Parse GIF callback data is null, you need check callback data!')
|
onError('Parse GIF callback data is null, you need check callback data!')
|
||||||
}
|
}
|
||||||
})
|
},request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue