From 4c0d857f416ef55e0e03d204620c03fdb7d89687 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 18 Sep 2015 15:05:16 +0900 Subject: [PATCH] Remove goog.isDef from colormatrix.js (-12 B) --- src/ol/color/colormatrix.js | 28 ++++++++++++++++------------ src/ol/ol.js | 10 ++++++++++ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/ol/color/colormatrix.js b/src/ol/color/colormatrix.js index ac947263fc..3652ea692c 100644 --- a/src/ol/color/colormatrix.js +++ b/src/ol/color/colormatrix.js @@ -1,6 +1,7 @@ goog.provide('ol.color.Matrix'); goog.require('goog.vec.Mat4'); +goog.require('ol'); @@ -165,39 +166,42 @@ ol.color.Matrix.makeSaturation = function(matrix, value) { ol.color.Matrix.prototype.getMatrix = function( brightness, contrast, hue, saturation) { var colorMatrixDirty = false; - if (goog.isDef(brightness) && brightness !== this.brightness_) { - ol.color.Matrix.makeBrightness(this.brightnessMatrix_, brightness); + if (ol.isDef(brightness) && brightness !== this.brightness_) { + ol.color.Matrix.makeBrightness(this.brightnessMatrix_, + /** @type {number} */ (brightness)); this.brightness_ = brightness; colorMatrixDirty = true; } - if (goog.isDef(contrast) && contrast !== this.contrast_) { - ol.color.Matrix.makeContrast(this.contrastMatrix_, contrast); + if (ol.isDef(contrast) && contrast !== this.contrast_) { + ol.color.Matrix.makeContrast(this.contrastMatrix_, + /** @type {number} */ (contrast)); this.contrast_ = contrast; colorMatrixDirty = true; } - if (goog.isDef(hue) && hue !== this.hue_) { - ol.color.Matrix.makeHue(this.hueMatrix_, hue); + if (ol.isDef(hue) && hue !== this.hue_) { + ol.color.Matrix.makeHue(this.hueMatrix_, /** @type {number} */ (hue)); this.hue_ = hue; colorMatrixDirty = true; } - if (goog.isDef(saturation) && saturation !== this.saturation_) { - ol.color.Matrix.makeSaturation(this.saturationMatrix_, saturation); + if (ol.isDef(saturation) && saturation !== this.saturation_) { + ol.color.Matrix.makeSaturation(this.saturationMatrix_, + /** @type {number} */ (saturation)); this.saturation_ = saturation; colorMatrixDirty = true; } if (colorMatrixDirty) { var colorMatrix = this.colorMatrix_; goog.vec.Mat4.makeIdentity(colorMatrix); - if (goog.isDef(contrast)) { + if (ol.isDef(contrast)) { goog.vec.Mat4.multMat(colorMatrix, this.contrastMatrix_, colorMatrix); } - if (goog.isDef(brightness)) { + if (ol.isDef(brightness)) { goog.vec.Mat4.multMat(colorMatrix, this.brightnessMatrix_, colorMatrix); } - if (goog.isDef(saturation)) { + if (ol.isDef(saturation)) { goog.vec.Mat4.multMat(colorMatrix, this.saturationMatrix_, colorMatrix); } - if (goog.isDef(hue)) { + if (ol.isDef(hue)) { goog.vec.Mat4.multMat(colorMatrix, this.hueMatrix_, colorMatrix); } } diff --git a/src/ol/ol.js b/src/ol/ol.js index ba1c7e6282..4b7969102a 100644 --- a/src/ol/ol.js +++ b/src/ol/ol.js @@ -240,3 +240,13 @@ ol.WEBGL_EXTENSIONS; // value is set in `ol.has` ol.inherits = goog.inherits; // note that the newline above is necessary to satisfy the linter + + +/** + * Determine if a value is defined. + * @param {?} value The value to test. + * @return {boolean} The value is defined. + */ +ol.isDef = function(value) { + return value !== undefined; +};