| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 var baseY = (position + height) * window.devicePixelRatio; | 266 var baseY = (position + height) * window.devicePixelRatio; |
| 267 var y = baseY + 10; | 267 var y = baseY + 10; |
| 268 var ctx = this._context; | 268 var ctx = this._context; |
| 269 ctx.save(); | 269 ctx.save(); |
| 270 ctx.beginPath(); | 270 ctx.beginPath(); |
| 271 ctx.rect(0, position * window.devicePixelRatio, this._canvas.width, heig
ht * window.devicePixelRatio); | 271 ctx.rect(0, position * window.devicePixelRatio, this._canvas.width, heig
ht * window.devicePixelRatio); |
| 272 ctx.clip(); | 272 ctx.clip(); |
| 273 ctx.beginPath(); | 273 ctx.beginPath(); |
| 274 ctx.lineWidth = 1 * window.devicePixelRatio; | 274 ctx.lineWidth = 1 * window.devicePixelRatio; |
| 275 ctx.strokeStyle = "hsl(110, 50%, 60%)"; | 275 ctx.strokeStyle = "hsl(110, 50%, 60%)"; |
| 276 ctx.fillStyle = "hsl(110, 50%, 70%)"; | 276 ctx.fillStyle = "hsl(110, 50%, 80%)"; |
| 277 ctx.moveTo(0, y); | 277 ctx.moveTo(0, y); |
| 278 for (var i = 0; i < frames.length; ++i) { | 278 for (var i = 0; i < frames.length; ++i) { |
| 279 var frame = frames[i]; | 279 var frame = frames[i]; |
| 280 var x = 0.5 + Math.round((frame.startTime - timeOffset) * scale); | 280 var x = Math.round((frame.startTime - timeOffset) * scale) + 0.5; |
| 281 ctx.lineTo(x, y); | 281 ctx.lineTo(x, y); |
| 282 y = 0.5 + Math.round(baseY - visualHeight * Math.min(baseFrameDurati
onMs / frame.duration, 1)); | 282 y = frame.idle ? baseY + 0.5 : Math.round(baseY - visualHeight * Mat
h.min(baseFrameDurationMs / frame.duration, 1)) - 0.5; |
| 283 ctx.lineTo(x, y); | 283 ctx.lineTo(x, y); |
| 284 } | 284 } |
| 285 ctx.lineTo(this._canvas.width, y); | 285 ctx.lineTo(this._canvas.width, y); |
| 286 ctx.lineTo(this._canvas.width, baseY + 10); | 286 ctx.lineTo(this._canvas.width, baseY + 10); |
| 287 ctx.closePath(); | 287 ctx.closePath(); |
| 288 ctx.stroke(); | 288 ctx.stroke(); |
| 289 ctx.fill(); | 289 ctx.fill(); |
| 290 ctx.restore(); | 290 ctx.restore(); |
| 291 return height; | 291 return height; |
| 292 }, | 292 }, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 for (var g of this._groupError.keys()) { | 385 for (var g of this._groupError.keys()) { |
| 386 if (!g) | 386 if (!g) |
| 387 continue; | 387 continue; |
| 388 var value = this._groupError.get(g); | 388 var value = this._groupError.get(g); |
| 389 value += (1 - value) * ratio; | 389 value += (1 - value) * ratio; |
| 390 this._groupError.set(g, value); | 390 this._groupError.set(g, value); |
| 391 } | 391 } |
| 392 return toDistribute; | 392 return toDistribute; |
| 393 } | 393 } |
| 394 } | 394 } |
| OLD | NEW |