OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 'use strict'; | |
6 | |
7 /** | 5 /** |
8 * Loads and resizes an image. | 6 * Loads and resizes an image. |
9 * @constructor | 7 * @constructor |
10 */ | 8 */ |
11 function ImageLoader() { | 9 function ImageLoader() { |
12 /** | 10 /** |
13 * Persistent cache object. | 11 * Persistent cache object. |
14 * @type {Cache} | 12 * @type {Cache} |
15 * @private | 13 * @private |
16 */ | 14 */ |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 targetContext.translate(target.width / 2, target.height / 2); | 226 targetContext.translate(target.width / 2, target.height / 2); |
229 targetContext.rotate(orientation * Math.PI / 2); | 227 targetContext.rotate(orientation * Math.PI / 2); |
230 targetContext.drawImage( | 228 targetContext.drawImage( |
231 source, | 229 source, |
232 0, 0, | 230 0, 0, |
233 source.width, source.height, | 231 source.width, source.height, |
234 -drawImageWidth / 2, -drawImageHeight / 2, | 232 -drawImageWidth / 2, -drawImageHeight / 2, |
235 drawImageWidth, drawImageHeight); | 233 drawImageWidth, drawImageHeight); |
236 targetContext.restore(); | 234 targetContext.restore(); |
237 }; | 235 }; |
OLD | NEW |