|
Lines 310-321
Link Here
|
| 310 |
var context = this._context; |
310 |
var context = this._context; |
| 311 |
var alpha = this._context.globalAlpha; |
311 |
var alpha = this._context.globalAlpha; |
| 312 |
var image = new Image(); |
312 |
var image = new Image(); |
| 313 |
image.onload = function() { |
313 |
image.src = imageSrc; |
| 314 |
// [if] As drawImage is delayed by the onload event, we have to draw |
314 |
// On (native) canvas, only loaded images can be drawn: |
| 315 |
// it with correct context parameters (alpha). |
315 |
if( image.complete || qx.core.Variant.isSet( "qx.client", "mshtml" ) ) { |
| 316 |
// TODO [tb] : The z-order will be wrong in any case. |
|
|
| 317 |
context.save(); |
| 318 |
context.globalAlpha = alpha; |
| 319 |
if( simple ) { |
316 |
if( simple ) { |
| 320 |
context.drawImage( image, destX, destY ); |
317 |
context.drawImage( image, destX, destY ); |
| 321 |
} else { |
318 |
} else { |
|
Lines 328-337
Link Here
|
| 328 |
destY, |
325 |
destY, |
| 329 |
destWidth, |
326 |
destWidth, |
| 330 |
destHeight ); |
327 |
destHeight ); |
| 331 |
} |
328 |
}; |
| 332 |
context.restore(); |
329 |
} else { |
| 333 |
}; |
330 |
image.onload = function() { |
| 334 |
image.src = imageSrc; |
331 |
// TODO [tb] : The z-order will be wrong in this case. |
|
|
332 |
// [if] As drawImage is delayed by the onload event, we have to draw |
| 333 |
// it with correct context parameters (alpha). |
| 334 |
context.save(); |
| 335 |
context.globalAlpha = alpha; |
| 336 |
if( simple ) { |
| 337 |
context.drawImage( image, destX, destY ); |
| 338 |
} else { |
| 339 |
context.drawImage( image, |
| 340 |
srcX, |
| 341 |
srcY, |
| 342 |
srcWidth, |
| 343 |
srcHeight, |
| 344 |
destX, |
| 345 |
destY, |
| 346 |
destWidth, |
| 347 |
destHeight ); |
| 348 |
} |
| 349 |
context.restore(); |
| 350 |
}; |
| 351 |
} |
| 335 |
}, |
352 |
}, |
| 336 |
|
353 |
|
| 337 |
_stroke : function( fill ) { |
354 |
_stroke : function( fill ) { |