| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * The base class for simple filters that only modify the image content | 6 * The base class for simple filters that only modify the image content |
| 7 * but do not modify the image dimensions. | 7 * but do not modify the image dimensions. |
| 8 * @param {string} name | 8 * @param {string} name |
| 9 * @param {string} title | 9 * @param {string} title |
| 10 * @constructor | 10 * @constructor |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 // Update canvas size and/or transformation. | 126 // Update canvas size and/or transformation. |
| 127 if (!this.previewImageData_ || | 127 if (!this.previewImageData_ || |
| 128 this.viewportGeneration_ !== this.getViewport().getCacheGeneration()) { | 128 this.viewportGeneration_ !== this.getViewport().getCacheGeneration()) { |
| 129 this.viewportGeneration_ = this.getViewport().getCacheGeneration(); | 129 this.viewportGeneration_ = this.getViewport().getCacheGeneration(); |
| 130 | 130 |
| 131 if (!this.canvas_) | 131 if (!this.canvas_) |
| 132 this.canvas_ = this.getImageView().createOverlayCanvas(); | 132 this.canvas_ = this.getImageView().createOverlayCanvas(); |
| 133 | 133 |
| 134 this.getImageView().setupDeviceBuffer(this.canvas_); | 134 this.getImageView().setupDeviceBuffer(this.canvas_); |
| 135 this.originalImageData_ = this.getImageView().getScreenImageDataWith( | 135 var canvas = this.getImageView().getImageCanvasWith( |
| 136 this.canvas_.width, this.canvas_.height); | 136 this.canvas_.width, this.canvas_.height); |
| 137 this.previewImageData_ = this.getImageView().getScreenImageDataWith( | 137 var context = canvas.getContext('2d'); |
| 138 this.originalImageData_ = context.getImageData(0, 0, |
| 139 this.canvas_.width, this.canvas_.height); |
| 140 this.previewImageData_ = context.getImageData(0, 0, |
| 138 this.canvas_.width, this.canvas_.height); | 141 this.canvas_.width, this.canvas_.height); |
| 139 | 142 |
| 140 isPreviewImageInvalidated = true; | 143 isPreviewImageInvalidated = true; |
| 141 } else { | 144 } else { |
| 142 this.getImageView().setTransform_( | 145 this.getImageView().setTransform_( |
| 143 assert(this.canvas_), assert(this.getViewport())); | 146 assert(this.canvas_), assert(this.getViewport())); |
| 144 } | 147 } |
| 145 | 148 |
| 146 // Update preview image with applying filter. | 149 // Update preview image with applying filter. |
| 147 if (isPreviewImageInvalidated) { | 150 if (isPreviewImageInvalidated) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 }; | 297 }; |
| 295 | 298 |
| 296 ImageEditor.Mode.Sharpen.prototype = | 299 ImageEditor.Mode.Sharpen.prototype = |
| 297 {__proto__: ImageEditor.Mode.Adjust.prototype}; | 300 {__proto__: ImageEditor.Mode.Adjust.prototype}; |
| 298 | 301 |
| 299 /** @override */ | 302 /** @override */ |
| 300 ImageEditor.Mode.Sharpen.prototype.createTools = function(toolbar) { | 303 ImageEditor.Mode.Sharpen.prototype.createTools = function(toolbar) { |
| 301 toolbar.addRange('strength', 'GALLERY_STRENGTH', 0, 0, 1, 100); | 304 toolbar.addRange('strength', 'GALLERY_STRENGTH', 0, 0, 1, 100); |
| 302 toolbar.addRange('radius', 'GALLERY_RADIUS', 1, 1, 3); | 305 toolbar.addRange('radius', 'GALLERY_RADIUS', 1, 1, 3); |
| 303 }; | 306 }; |
| OLD | NEW |