Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Unified Diff: ui/file_manager/gallery/js/image_editor/filter.js

Issue 1608143002: support animated GIF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add assert to pass closure compiler Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/gallery/js/image_editor/filter.js
diff --git a/ui/file_manager/gallery/js/image_editor/filter.js b/ui/file_manager/gallery/js/image_editor/filter.js
index a68fff846ab1fd2ef40eea0fb908892b1f1a923d..7b5782ba99d7f54e60b9d25cb2d4301f42826270 100644
--- a/ui/file_manager/gallery/js/image_editor/filter.js
+++ b/ui/file_manager/gallery/js/image_editor/filter.js
@@ -31,25 +31,25 @@ filter.create = function(name, options) {
* To be used with large images to avoid freezing up the UI.
*
* @param {!HTMLCanvasElement} dstCanvas Destination canvas.
- * @param {!HTMLCanvasElement} srcCanvas Source canvas.
+ * @param {!HTMLCanvasElement|!HTMLImageElement} srcImage Source image.
* @param {function(!ImageData,!ImageData,number,number)} filterFunc Filter.
* @param {function(number, number)} progressCallback Progress callback.
* @param {number=} opt_maxPixelsPerStrip Pixel number to process at once.
*/
filter.applyByStrips = function(
- dstCanvas, srcCanvas, filterFunc, progressCallback, opt_maxPixelsPerStrip) {
+ dstCanvas, srcImage, filterFunc, progressCallback, opt_maxPixelsPerStrip) {
// 1 Mpix is a reasonable default.
var maxPixelsPerStrip = opt_maxPixelsPerStrip || 1000000;
var dstContext = dstCanvas.getContext('2d');
- var srcContext = srcCanvas.getContext('2d');
- var source = srcContext.getImageData(0, 0, srcCanvas.width, srcCanvas.height);
+ var srcContext = ImageUtil.ensureCanvas(srcImage).getContext('2d');
+ var source = srcContext.getImageData(0, 0, srcImage.width, srcImage.height);
- var stripCount = Math.ceil(srcCanvas.width * srcCanvas.height /
+ var stripCount = Math.ceil(srcImage.width * srcImage.height /
maxPixelsPerStrip);
var strip = srcContext.getImageData(0, 0,
- srcCanvas.width, Math.ceil(srcCanvas.height / stripCount));
+ srcImage.width, Math.ceil(srcImage.height / stripCount));
var offset = 0;
« no previous file with comments | « ui/file_manager/gallery/js/image_editor/commands.js ('k') | ui/file_manager/gallery/js/image_editor/image_adjust.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698