diff --git a/src/shapes/group.class.js b/src/shapes/group.class.js index c40e474784e..4d91dbb6acf 100644 --- a/src/shapes/group.class.js +++ b/src/shapes/group.class.js @@ -280,15 +280,13 @@ /** * Decide if the object should cache or not. Create its own cache level - * objectCaching is a global flag, wins over everything * needsItsOwnCache should be used when the object drawing method requires * a cache step. None of the fabric classes requires it. - * Generally you do not cache objects in groups because the group outside is cached. + * Generally you do not cache objects in groups because the group is already cached. * @return {Boolean} */ shouldCache: function() { - var ownCache = this.objectCaching && (!this.group || this.needsItsOwnCache() || !this.group.isOnACache()); - this.ownCaching = ownCache; + var ownCache = fabric.Object.prototype.shouldCache.call(this); if (ownCache) { for (var i = 0, len = this._objects.length; i < len; i++) { if (this._objects[i].willDrawShadow()) { diff --git a/src/shapes/image.class.js b/src/shapes/image.class.js index 594fea93032..b5591e060a8 100644 --- a/src/shapes/image.class.js +++ b/src/shapes/image.class.js @@ -504,7 +504,6 @@ /** * Decide if the object should cache or not. Create its own cache level - * objectCaching is a global flag, wins over everything * needsItsOwnCache should be used when the object drawing method requires * a cache step. None of the fabric classes requires it. * Generally you do not cache objects in groups because the group outside is cached. @@ -515,8 +514,7 @@ * @return {Boolean} */ shouldCache: function() { - this.ownCaching = this.objectCaching && this.needsItsOwnCache(); - return this.ownCaching; + return this.needsItsOwnCache(); }, _renderFill: function(ctx) { diff --git a/src/shapes/object.class.js b/src/shapes/object.class.js index 1abeb3207ff..e0525ffee76 100644 --- a/src/shapes/object.class.js +++ b/src/shapes/object.class.js @@ -522,7 +522,7 @@ /** * When `true`, object is not exported in OBJECT/JSON - * since 1.6.3 + * @since 1.6.3 * @type Boolean * @default */ @@ -530,8 +530,9 @@ /** * When `true`, object is cached on an additional canvas. + * When `false`, object is not cached unless necessary ( clipPath ) * default to true - * since 1.7.0 + * @since 1.7.0 * @type Boolean * @default true */ @@ -1139,11 +1140,14 @@ * needsItsOwnCache should be used when the object drawing method requires * a cache step. None of the fabric classes requires it. * Generally you do not cache objects in groups because the group outside is cached. + * Read as: cache if is needed, or if the feature is enabled but we are not already caching. * @return {Boolean} */ shouldCache: function() { - this.ownCaching = this.objectCaching && - (!this.group || this.needsItsOwnCache() || !this.group.isOnACache()); + this.ownCaching = this.needsItsOwnCache() || ( + this.objectCaching && + (!this.group || !this.group.isOnACache()) + ); return this.ownCaching; },