Simplify some code in #getAverageColor().

This commit is contained in:
Jürg Lehni 2011-12-27 20:39:46 +01:00
parent 96f7d140a7
commit 50e1509ab9

View file

@ -228,10 +228,10 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{
* specified path, rectangle or point. * specified path, rectangle or point.
*/ */
getAverageColor: function(object) { getAverageColor: function(object) {
if (!object)
object = this.getBounds();
var bounds, path; var bounds, path;
if (object instanceof PathItem) { if (!object) {
bounds = this.getBounds();
} else if (object instanceof PathItem) {
// TODO: What if the path is smaller than 1 px? // TODO: What if the path is smaller than 1 px?
// TODO: How about rounding of bounds.size? // TODO: How about rounding of bounds.size?
path = object; path = object;