()
| 1188 | } |
| 1189 | |
| 1190 | toString(): string { |
| 1191 | if (this.hasError) { |
| 1192 | return `ImageCompressTask: ${this.image.path} -> 错误: ${this.errorMessage}` |
| 1193 | } |
| 1194 | |
| 1195 | const savedPercentage = |
| 1196 | this.image.size > 0 |
| 1197 | ? `${(((this.image.size - this.size) / this.image.size) * 100).toFixed(2)}%` |
| 1198 | : '0%' |
| 1199 | |
| 1200 | let info = `ImageCompressTask: ${this.image.width}x${this.image.height} ${this.image.sizeFormatted} -> ${this.width}x${this.height} ${this.sizeFormatted} (节省${savedPercentage})` |
| 1201 | |
| 1202 | if (this.hasWatermark) { |
| 1203 | info += ' [水印]' |
| 1204 | } |
| 1205 | |
| 1206 | if (this.hasTexture) { |
| 1207 | info += ' [纹理]' |
| 1208 | } |
| 1209 | |
| 1210 | return info |
| 1211 | } |
| 1212 | } |
| 1213 | |
| 1214 | /** |
no outgoing calls
no test coverage detected