(
img,
sx,
sy,
sWidth,
sHeight,
dx,
dy,
dWidth,
dHeight
)
| 363 | ////////////////////////////////////////////// |
| 364 | |
| 365 | image( |
| 366 | img, |
| 367 | sx, |
| 368 | sy, |
| 369 | sWidth, |
| 370 | sHeight, |
| 371 | dx, |
| 372 | dy, |
| 373 | dWidth, |
| 374 | dHeight |
| 375 | ) { |
| 376 | let cnv; |
| 377 | if (img.gifProperties) { |
| 378 | img._animateGif(this._pInst); |
| 379 | } |
| 380 | |
| 381 | try { |
| 382 | if (img instanceof MediaElement) { |
| 383 | img._ensureCanvas(); |
| 384 | } |
| 385 | if (this.states.tint && img.canvas) { |
| 386 | cnv = this._getTintedImageCanvas(img); |
| 387 | } |
| 388 | if (!cnv) { |
| 389 | cnv = img.canvas || img.elt; |
| 390 | } |
| 391 | let s = 1; |
| 392 | if (img.width && img.width > 0) { |
| 393 | s = cnv.width / img.width; |
| 394 | } |
| 395 | if (this._isErasing) { |
| 396 | this.blendMode(this._cachedBlendMode); |
| 397 | } |
| 398 | |
| 399 | this.drawingContext.drawImage( |
| 400 | cnv, |
| 401 | s * sx, |
| 402 | s * sy, |
| 403 | s * sWidth, |
| 404 | s * sHeight, |
| 405 | dx, |
| 406 | dy, |
| 407 | dWidth, |
| 408 | dHeight |
| 409 | ); |
| 410 | if (this._isErasing) { |
| 411 | this._pInst.erase(); |
| 412 | } |
| 413 | } catch (e) { |
| 414 | if (e.name !== 'NS_ERROR_NOT_AVAILABLE') { |
| 415 | throw e; |
| 416 | } |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | _getTintedImageCanvas(img) { |
| 421 | if (!img.canvas) { |
no test coverage detected