OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 // Namespace object for the utilities. | 6 // Namespace object for the utilities. |
7 function ImageUtil() {} | 7 function ImageUtil() {} |
8 | 8 |
9 // Performance trace. | 9 // Performance trace. |
10 ImageUtil.trace = (function() { | 10 ImageUtil.trace = (function() { |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 callback(context.canvas); | 427 callback(context.canvas); |
428 } else { | 428 } else { |
429 var self = this; | 429 var self = this; |
430 this.timeout_ = setTimeout( | 430 this.timeout_ = setTimeout( |
431 function() { | 431 function() { |
432 self.timeout_ = null; | 432 self.timeout_ = null; |
433 self.copyStrip_(context, lastRow, rowCount); | 433 self.copyStrip_(context, lastRow, rowCount); |
434 }, 0); | 434 }, 0); |
435 } | 435 } |
436 }; | 436 }; |
| 437 |
| 438 ImageUtil.getFullNameFromUrl = function(url) { |
| 439 if (url.indexOf('/') != -1) |
| 440 return url.substr(url.lastIndexOf('/') + 1); |
| 441 else |
| 442 return url; |
| 443 }; |
| 444 |
| 445 ImageUtil.getFileNameFromFullName = function(name) { |
| 446 var index = name.lastIndexOf('.'); |
| 447 if (index != -1) |
| 448 return name.substr(0, index); |
| 449 else |
| 450 return name; |
| 451 }; |
| 452 |
| 453 ImageUtil.getFileNameFromUrl = function(url) { |
| 454 return ImageUtil.getFileNameFromFullName(ImageUtil.getFullNameFromUrl(url)); |
| 455 }; |
| 456 |
| 457 ImageUtil.replaceFileNameInFullName = function(fullName, name) { |
| 458 var index = fullName.lastIndexOf('.'); |
| 459 if (index != -1) |
| 460 return name + fullName.substr(index); |
| 461 else |
| 462 return name; |
| 463 }; |
OLD | NEW |