(fromQueue)
| 251 | // Update the visible canvas with the contents of the |
| 252 | // rendering canvas |
| 253 | flip(fromQueue) { |
| 254 | if (this._renderQ.length !== 0 && !fromQueue) { |
| 255 | this._renderQPush({ |
| 256 | 'type': 'flip' |
| 257 | }); |
| 258 | } else { |
| 259 | let x = this._damageBounds.left; |
| 260 | let y = this._damageBounds.top; |
| 261 | let w = this._damageBounds.right - x; |
| 262 | let h = this._damageBounds.bottom - y; |
| 263 | |
| 264 | let vx = x - this._viewportLoc.x; |
| 265 | let vy = y - this._viewportLoc.y; |
| 266 | |
| 267 | if (vx < 0) { |
| 268 | w += vx; |
| 269 | x -= vx; |
| 270 | vx = 0; |
| 271 | } |
| 272 | if (vy < 0) { |
| 273 | h += vy; |
| 274 | y -= vy; |
| 275 | vy = 0; |
| 276 | } |
| 277 | |
| 278 | if ((vx + w) > this._viewportLoc.w) { |
| 279 | w = this._viewportLoc.w - vx; |
| 280 | } |
| 281 | if ((vy + h) > this._viewportLoc.h) { |
| 282 | h = this._viewportLoc.h - vy; |
| 283 | } |
| 284 | |
| 285 | if ((w > 0) && (h > 0)) { |
| 286 | // FIXME: We may need to disable image smoothing here |
| 287 | // as well (see copyImage()), but we haven't |
| 288 | // noticed any problem yet. |
| 289 | this._targetCtx.drawImage(this._backbuffer, |
| 290 | x, y, w, h, |
| 291 | vx, vy, w, h); |
| 292 | } |
| 293 | |
| 294 | this._damageBounds.left = this._damageBounds.top = 65535; |
| 295 | this._damageBounds.right = this._damageBounds.bottom = 0; |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | pending() { |
| 300 | return this._renderQ.length > 0; |
no test coverage detected