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

Unified Diff: chrome/browser/resources/file_manager/js/image_editor/image_util.js

Issue 7552035: Adding simple filters to ChromeOS Image Editor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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: chrome/browser/resources/file_manager/js/image_editor/image_util.js
diff --git a/chrome/browser/resources/file_manager/js/image_editor/image_util.js b/chrome/browser/resources/file_manager/js/image_editor/image_util.js
index 72a3a562d90efb7d67e389a4df5d594cae632d45..c130675529c0f02a8998d92632b0abaf24c0e058 100644
--- a/chrome/browser/resources/file_manager/js/image_editor/image_util.js
+++ b/chrome/browser/resources/file_manager/js/image_editor/image_util.js
@@ -48,23 +48,6 @@ ImageUtil.between = function(min, value, max) {
};
/**
- * Computes the function for every integer value between 0 and max and stores
- * the results. Rounds and clips the results to fit the [0..255] range.
- * Used to speed up pixel manipulations.
- * @param {Function} func Function returning a number.
- * @param {Number} max Maximum argument value (inclusive).
- * @return {Array<Number>} Computed results
- */
-
-ImageUtil.precomputeByteFunction = function(func, max) {
- var results = [];
- for (var arg = 0; arg <= max; arg ++) {
- results.push(Math.max(0, Math.min(0xFF, Math.round(func(arg)))));
- }
- return results;
-}
-
-/**
* Rectangle class.
*/
@@ -204,7 +187,7 @@ Rect.prototype.clamp = function(bounds) {
*/
/**
- * Draws the image in context with appropriate scaling.
+ * Draw the image in context with appropriate scaling.
*/
Rect.drawImage = function(context, image, opt_dstRect, opt_srcRect) {
opt_dstRect = opt_dstRect || new Rect(context.canvas);
@@ -215,10 +198,18 @@ Rect.drawImage = function(context, image, opt_dstRect, opt_srcRect) {
};
/**
- * Strokes the rectangle.
+ * Draw a box around the rectangle.
+ */
+Rect.outline = function(context, rect) {
+ context.strokeRect(
+ rect.left - 0.5, rect.top - 0.5, rect.width + 1, rect.height + 1);
+};
+
+/**
+ * Fill the rectangle.
*/
-Rect.stroke = function(context, rect) {
- context.strokeRect(rect.left, rect.top, rect.width, rect.height);
+Rect.fill = function(context, rect) {
+ context.fillRect(rect.left, rect.top, rect.width, rect.height);
};
/**

Powered by Google App Engine
This is Rietveld 408576698