Remove goog.isDef from colormatrix.js (-12 B)

This commit is contained in:
Tim Schaub
2015-09-18 15:05:16 +09:00
parent c8e9525f3b
commit 4c0d857f41
2 changed files with 26 additions and 12 deletions

View File

@@ -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);
}
}

View File

@@ -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;
};