Socket
Socket
Sign inDemoInstall

@pixi/mixin-cache-as-bitmap

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/mixin-cache-as-bitmap - npm Package Compare versions

Comparing version 6.0.0 to 6.0.1

7

dist/browser/mixin-cache-as-bitmap.js
/*!
* @pixi/mixin-cache-as-bitmap - v6.0.0
* Compiled Tue, 02 Mar 2021 21:45:03 UTC
* @pixi/mixin-cache-as-bitmap - v6.0.1
* Compiled Wed, 24 Mar 2021 20:02:24 UTC
*

@@ -175,2 +175,3 @@ * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.

var cachedSourceFrame = renderer.renderTexture.sourceFrame.clone();
var cachedDestinationFrame = renderer.renderTexture.destinationFrame.clone();
var cachedProjectionTransform = renderer.projection.transform;

@@ -196,3 +197,3 @@ // We also store the filter stack - I will definitely look to change how this works a little later down the line.

renderer.projection.transform = cachedProjectionTransform;
renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame);
renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame, cachedDestinationFrame);
// renderer.filterManager.filterStack = stack;

@@ -199,0 +200,0 @@ this.render = this._renderCached;

/*!
* @pixi/mixin-cache-as-bitmap - v6.0.0
* Compiled Tue, 02 Mar 2021 21:45:03 UTC
* @pixi/mixin-cache-as-bitmap - v6.0.1
* Compiled Wed, 24 Mar 2021 20:02:24 UTC
*

@@ -8,3 +8,3 @@ * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.

*/
this.PIXI=this.PIXI||{};var _pixi_mixin_cache_as_bitmap=function(t,a,e,i,s,r,n){"use strict";var h=new s.Matrix;i.DisplayObject.prototype._cacheAsBitmap=!1,i.DisplayObject.prototype._cacheData=null,i.DisplayObject.prototype._cacheAsBitmapResolution=null;var o=function(){return function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}();return Object.defineProperties(i.DisplayObject.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(t){var a;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new o),(a=this._cacheData).originalRender=this.render,a.originalRenderCanvas=this.renderCanvas,a.originalUpdateTransform=this.updateTransform,a.originalCalculateBounds=this.calculateBounds,a.originalGetLocalBounds=this.getLocalBounds,a.originalDestroy=this.destroy,a.originalContainsPoint=this.containsPoint,a.originalMask=this._mask,a.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((a=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=a.originalRender,this.renderCanvas=a.originalRenderCanvas,this.calculateBounds=a.originalCalculateBounds,this.getLocalBounds=a.originalGetLocalBounds,this.destroy=a.originalDestroy,this.updateTransform=a.originalUpdateTransform,this.containsPoint=a.originalContainsPoint,this._mask=a.originalMask,this.filterArea=a.originalFilterArea))}}}),i.DisplayObject.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},i.DisplayObject.prototype._initCachedDisplayObject=function(t){if(!this._cacheData||!this._cacheData.sprite){var i=this.alpha;this.alpha=1,t.batch.flush();var s=this.getLocalBounds(null,!0).clone();if(this.filters){var o=this.filters[0].padding;s.pad(o)}s.ceil(n.settings.RESOLUTION);var c=t.renderTexture.current,l=t.renderTexture.sourceFrame.clone(),d=t.projection.transform,p=a.RenderTexture.create({width:s.width,height:s.height,resolution:this.cacheAsBitmapResolution||t.resolution}),u="cacheAsBitmap_"+r.uid();this._cacheData.textureCacheId=u,a.BaseTexture.addToCache(p.baseTexture,u),a.Texture.addToCache(p,u);var _=this.transform.localTransform.copyTo(h).invert().translate(-s.x,-s.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:p,clear:!0,transform:_,skipUpdateTransform:!1}),t.projection.transform=d,t.renderTexture.bind(c,l),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var m=new e.Sprite(p);m.transform.worldTransform=this.transform.worldTransform,m.anchor.x=-s.x/s.width,m.anchor.y=-s.y/s.height,m.alpha=i,m._bounds=this._bounds,this._cacheData.sprite=m,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=m.containsPoint.bind(m)}},i.DisplayObject.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},i.DisplayObject.prototype._initCachedDisplayObjectCanvas=function(t){if(!this._cacheData||!this._cacheData.sprite){var i=this.getLocalBounds(null,!0),s=this.alpha;this.alpha=1;var o=t.context,c=t._projTransform;i.ceil(n.settings.RESOLUTION);var l=a.RenderTexture.create({width:i.width,height:i.height}),d="cacheAsBitmap_"+r.uid();this._cacheData.textureCacheId=d,a.BaseTexture.addToCache(l.baseTexture,d),a.Texture.addToCache(l,d);var p=h;this.transform.localTransform.copyTo(p),p.invert(),p.tx-=i.x,p.ty-=i.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:l,clear:!0,transform:p,skipUpdateTransform:!1}),t.context=o,t._projTransform=c,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var u=new e.Sprite(l);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-i.x/i.width,u.anchor.y=-i.y/i.height,u.alpha=s,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u)}},i.DisplayObject.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},i.DisplayObject.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},i.DisplayObject.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,a.BaseTexture.removeFromCache(this._cacheData.textureCacheId),a.Texture.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},i.DisplayObject.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},t.CacheData=o,t}({},PIXI,PIXI,PIXI,PIXI,PIXI.utils,PIXI);
this.PIXI=this.PIXI||{};var _pixi_mixin_cache_as_bitmap=function(t,a,e,i,s,r,n){"use strict";var h=new s.Matrix;i.DisplayObject.prototype._cacheAsBitmap=!1,i.DisplayObject.prototype._cacheData=null,i.DisplayObject.prototype._cacheAsBitmapResolution=null;var o=function(){return function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}();return Object.defineProperties(i.DisplayObject.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(t){var a;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new o),(a=this._cacheData).originalRender=this.render,a.originalRenderCanvas=this.renderCanvas,a.originalUpdateTransform=this.updateTransform,a.originalCalculateBounds=this.calculateBounds,a.originalGetLocalBounds=this.getLocalBounds,a.originalDestroy=this.destroy,a.originalContainsPoint=this.containsPoint,a.originalMask=this._mask,a.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((a=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=a.originalRender,this.renderCanvas=a.originalRenderCanvas,this.calculateBounds=a.originalCalculateBounds,this.getLocalBounds=a.originalGetLocalBounds,this.destroy=a.originalDestroy,this.updateTransform=a.originalUpdateTransform,this.containsPoint=a.originalContainsPoint,this._mask=a.originalMask,this.filterArea=a.originalFilterArea))}}}),i.DisplayObject.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},i.DisplayObject.prototype._initCachedDisplayObject=function(t){if(!this._cacheData||!this._cacheData.sprite){var i=this.alpha;this.alpha=1,t.batch.flush();var s=this.getLocalBounds(null,!0).clone();if(this.filters){var o=this.filters[0].padding;s.pad(o)}s.ceil(n.settings.RESOLUTION);var c=t.renderTexture.current,l=t.renderTexture.sourceFrame.clone(),d=t.renderTexture.destinationFrame.clone(),u=t.projection.transform,p=a.RenderTexture.create({width:s.width,height:s.height,resolution:this.cacheAsBitmapResolution||t.resolution}),_="cacheAsBitmap_"+r.uid();this._cacheData.textureCacheId=_,a.BaseTexture.addToCache(p.baseTexture,_),a.Texture.addToCache(p,_);var m=this.transform.localTransform.copyTo(h).invert().translate(-s.x,-s.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:p,clear:!0,transform:m,skipUpdateTransform:!1}),t.projection.transform=u,t.renderTexture.bind(c,l,d),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var f=new e.Sprite(p);f.transform.worldTransform=this.transform.worldTransform,f.anchor.x=-s.x/s.width,f.anchor.y=-s.y/s.height,f.alpha=i,f._bounds=this._bounds,this._cacheData.sprite=f,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=f.containsPoint.bind(f)}},i.DisplayObject.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},i.DisplayObject.prototype._initCachedDisplayObjectCanvas=function(t){if(!this._cacheData||!this._cacheData.sprite){var i=this.getLocalBounds(null,!0),s=this.alpha;this.alpha=1;var o=t.context,c=t._projTransform;i.ceil(n.settings.RESOLUTION);var l=a.RenderTexture.create({width:i.width,height:i.height}),d="cacheAsBitmap_"+r.uid();this._cacheData.textureCacheId=d,a.BaseTexture.addToCache(l.baseTexture,d),a.Texture.addToCache(l,d);var u=h;this.transform.localTransform.copyTo(u),u.invert(),u.tx-=i.x,u.ty-=i.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:l,clear:!0,transform:u,skipUpdateTransform:!1}),t.context=o,t._projTransform=c,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var p=new e.Sprite(l);p.transform.worldTransform=this.transform.worldTransform,p.anchor.x=-i.x/i.width,p.anchor.y=-i.y/i.height,p.alpha=s,p._bounds=this._bounds,this._cacheData.sprite=p,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=p.containsPoint.bind(p)}},i.DisplayObject.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},i.DisplayObject.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},i.DisplayObject.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,a.BaseTexture.removeFromCache(this._cacheData.textureCacheId),a.Texture.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},i.DisplayObject.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},t.CacheData=o,t}({},PIXI,PIXI,PIXI,PIXI,PIXI.utils,PIXI);
//# sourceMappingURL=mixin-cache-as-bitmap.min.js.map
/*!
* @pixi/mixin-cache-as-bitmap - v6.0.0
* Compiled Tue, 02 Mar 2021 21:45:03 UTC
* @pixi/mixin-cache-as-bitmap - v6.0.1
* Compiled Wed, 24 Mar 2021 20:02:24 UTC
*

@@ -182,2 +182,3 @@ * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.

var cachedSourceFrame = renderer.renderTexture.sourceFrame.clone();
var cachedDestinationFrame = renderer.renderTexture.destinationFrame.clone();
var cachedProjectionTransform = renderer.projection.transform;

@@ -203,3 +204,3 @@ // We also store the filter stack - I will definitely look to change how this works a little later down the line.

renderer.projection.transform = cachedProjectionTransform;
renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame);
renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame, cachedDestinationFrame);
// renderer.filterManager.filterStack = stack;

@@ -206,0 +207,0 @@ this.render = this._renderCached;

/*!
* @pixi/mixin-cache-as-bitmap - v6.0.0
* Compiled Tue, 02 Mar 2021 21:45:03 UTC
* @pixi/mixin-cache-as-bitmap - v6.0.1
* Compiled Wed, 24 Mar 2021 20:02:24 UTC
*

@@ -8,3 +8,3 @@ * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.

*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@pixi/core"),sprite=require("@pixi/sprite"),display=require("@pixi/display"),math=require("@pixi/math"),utils=require("@pixi/utils"),settings=require("@pixi/settings"),_tempMatrix=new math.Matrix;display.DisplayObject.prototype._cacheAsBitmap=!1,display.DisplayObject.prototype._cacheData=null,display.DisplayObject.prototype._cacheAsBitmapResolution=null;var CacheData=function(){return function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}();Object.defineProperties(display.DisplayObject.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(t){var a;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new CacheData),(a=this._cacheData).originalRender=this.render,a.originalRenderCanvas=this.renderCanvas,a.originalUpdateTransform=this.updateTransform,a.originalCalculateBounds=this.calculateBounds,a.originalGetLocalBounds=this.getLocalBounds,a.originalDestroy=this.destroy,a.originalContainsPoint=this.containsPoint,a.originalMask=this._mask,a.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((a=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=a.originalRender,this.renderCanvas=a.originalRenderCanvas,this.calculateBounds=a.originalCalculateBounds,this.getLocalBounds=a.originalGetLocalBounds,this.destroy=a.originalDestroy,this.updateTransform=a.originalUpdateTransform,this.containsPoint=a.originalContainsPoint,this._mask=a.originalMask,this.filterArea=a.originalFilterArea))}}}),display.DisplayObject.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},display.DisplayObject.prototype._initCachedDisplayObject=function(t){if(!this._cacheData||!this._cacheData.sprite){var a=this.alpha;this.alpha=1,t.batch.flush();var e=this.getLocalBounds(null,!0).clone();if(this.filters){var i=this.filters[0].padding;e.pad(i)}e.ceil(settings.settings.RESOLUTION);var s=t.renderTexture.current,r=t.renderTexture.sourceFrame.clone(),n=t.projection.transform,h=core.RenderTexture.create({width:e.width,height:e.height,resolution:this.cacheAsBitmapResolution||t.resolution}),o="cacheAsBitmap_"+utils.uid();this._cacheData.textureCacheId=o,core.BaseTexture.addToCache(h.baseTexture,o),core.Texture.addToCache(h,o);var c=this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:h,clear:!0,transform:c,skipUpdateTransform:!1}),t.projection.transform=n,t.renderTexture.bind(s,r),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var l=new sprite.Sprite(h);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-e.x/e.width,l.anchor.y=-e.y/e.height,l.alpha=a,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=l.containsPoint.bind(l)}},display.DisplayObject.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},display.DisplayObject.prototype._initCachedDisplayObjectCanvas=function(t){if(!this._cacheData||!this._cacheData.sprite){var a=this.getLocalBounds(null,!0),e=this.alpha;this.alpha=1;var i=t.context,s=t._projTransform;a.ceil(settings.settings.RESOLUTION);var r=core.RenderTexture.create({width:a.width,height:a.height}),n="cacheAsBitmap_"+utils.uid();this._cacheData.textureCacheId=n,core.BaseTexture.addToCache(r.baseTexture,n),core.Texture.addToCache(r,n);var h=_tempMatrix;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=a.x,h.ty-=a.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:r,clear:!0,transform:h,skipUpdateTransform:!1}),t.context=i,t._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var o=new sprite.Sprite(r);o.transform.worldTransform=this.transform.worldTransform,o.anchor.x=-a.x/a.width,o.anchor.y=-a.y/a.height,o.alpha=e,o._bounds=this._bounds,this._cacheData.sprite=o,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=o.containsPoint.bind(o)}},display.DisplayObject.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},display.DisplayObject.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},display.DisplayObject.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,core.BaseTexture.removeFromCache(this._cacheData.textureCacheId),core.Texture.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},display.DisplayObject.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},exports.CacheData=CacheData;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@pixi/core"),sprite=require("@pixi/sprite"),display=require("@pixi/display"),math=require("@pixi/math"),utils=require("@pixi/utils"),settings=require("@pixi/settings"),_tempMatrix=new math.Matrix;display.DisplayObject.prototype._cacheAsBitmap=!1,display.DisplayObject.prototype._cacheData=null,display.DisplayObject.prototype._cacheAsBitmapResolution=null;var CacheData=function(){return function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}();Object.defineProperties(display.DisplayObject.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(t){var a;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new CacheData),(a=this._cacheData).originalRender=this.render,a.originalRenderCanvas=this.renderCanvas,a.originalUpdateTransform=this.updateTransform,a.originalCalculateBounds=this.calculateBounds,a.originalGetLocalBounds=this.getLocalBounds,a.originalDestroy=this.destroy,a.originalContainsPoint=this.containsPoint,a.originalMask=this._mask,a.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((a=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=a.originalRender,this.renderCanvas=a.originalRenderCanvas,this.calculateBounds=a.originalCalculateBounds,this.getLocalBounds=a.originalGetLocalBounds,this.destroy=a.originalDestroy,this.updateTransform=a.originalUpdateTransform,this.containsPoint=a.originalContainsPoint,this._mask=a.originalMask,this.filterArea=a.originalFilterArea))}}}),display.DisplayObject.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},display.DisplayObject.prototype._initCachedDisplayObject=function(t){if(!this._cacheData||!this._cacheData.sprite){var a=this.alpha;this.alpha=1,t.batch.flush();var e=this.getLocalBounds(null,!0).clone();if(this.filters){var i=this.filters[0].padding;e.pad(i)}e.ceil(settings.settings.RESOLUTION);var s=t.renderTexture.current,r=t.renderTexture.sourceFrame.clone(),n=t.renderTexture.destinationFrame.clone(),h=t.projection.transform,o=core.RenderTexture.create({width:e.width,height:e.height,resolution:this.cacheAsBitmapResolution||t.resolution}),c="cacheAsBitmap_"+utils.uid();this._cacheData.textureCacheId=c,core.BaseTexture.addToCache(o.baseTexture,c),core.Texture.addToCache(o,c);var l=this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:o,clear:!0,transform:l,skipUpdateTransform:!1}),t.projection.transform=h,t.renderTexture.bind(s,r,n),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var d=new sprite.Sprite(o);d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-e.x/e.width,d.anchor.y=-e.y/e.height,d.alpha=a,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=d.containsPoint.bind(d)}},display.DisplayObject.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},display.DisplayObject.prototype._initCachedDisplayObjectCanvas=function(t){if(!this._cacheData||!this._cacheData.sprite){var a=this.getLocalBounds(null,!0),e=this.alpha;this.alpha=1;var i=t.context,s=t._projTransform;a.ceil(settings.settings.RESOLUTION);var r=core.RenderTexture.create({width:a.width,height:a.height}),n="cacheAsBitmap_"+utils.uid();this._cacheData.textureCacheId=n,core.BaseTexture.addToCache(r.baseTexture,n),core.Texture.addToCache(r,n);var h=_tempMatrix;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=a.x,h.ty-=a.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:r,clear:!0,transform:h,skipUpdateTransform:!1}),t.context=i,t._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var o=new sprite.Sprite(r);o.transform.worldTransform=this.transform.worldTransform,o.anchor.x=-a.x/a.width,o.anchor.y=-a.y/a.height,o.alpha=e,o._bounds=this._bounds,this._cacheData.sprite=o,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=o.containsPoint.bind(o)}},display.DisplayObject.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},display.DisplayObject.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},display.DisplayObject.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,core.BaseTexture.removeFromCache(this._cacheData.textureCacheId),core.Texture.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},display.DisplayObject.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},exports.CacheData=CacheData;
//# sourceMappingURL=mixin-cache-as-bitmap.min.js.map
/*!
* @pixi/mixin-cache-as-bitmap - v6.0.0
* Compiled Tue, 02 Mar 2021 21:45:03 UTC
* @pixi/mixin-cache-as-bitmap - v6.0.1
* Compiled Wed, 24 Mar 2021 20:02:24 UTC
*

@@ -178,2 +178,3 @@ * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.

var cachedSourceFrame = renderer.renderTexture.sourceFrame.clone();
var cachedDestinationFrame = renderer.renderTexture.destinationFrame.clone();
var cachedProjectionTransform = renderer.projection.transform;

@@ -199,3 +200,3 @@ // We also store the filter stack - I will definitely look to change how this works a little later down the line.

renderer.projection.transform = cachedProjectionTransform;
renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame);
renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame, cachedDestinationFrame);
// renderer.filterManager.filterStack = stack;

@@ -202,0 +203,0 @@ this.render = this._renderCached;

/*!
* @pixi/mixin-cache-as-bitmap - v6.0.0
* Compiled Tue, 02 Mar 2021 21:45:03 UTC
* @pixi/mixin-cache-as-bitmap - v6.0.1
* Compiled Wed, 24 Mar 2021 20:02:24 UTC
*

@@ -8,3 +8,3 @@ * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.

*/
import{RenderTexture as t,BaseTexture as a,Texture as e}from"@pixi/core";import{Sprite as i}from"@pixi/sprite";import{DisplayObject as r}from"@pixi/display";import{Matrix as s}from"@pixi/math";import{uid as n}from"@pixi/utils";import{settings as h}from"@pixi/settings";var o=new s;r.prototype._cacheAsBitmap=!1,r.prototype._cacheData=null,r.prototype._cacheAsBitmapResolution=null;var c=function(){return function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}();Object.defineProperties(r.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(t){var a;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new c),(a=this._cacheData).originalRender=this.render,a.originalRenderCanvas=this.renderCanvas,a.originalUpdateTransform=this.updateTransform,a.originalCalculateBounds=this.calculateBounds,a.originalGetLocalBounds=this.getLocalBounds,a.originalDestroy=this.destroy,a.originalContainsPoint=this.containsPoint,a.originalMask=this._mask,a.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((a=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=a.originalRender,this.renderCanvas=a.originalRenderCanvas,this.calculateBounds=a.originalCalculateBounds,this.getLocalBounds=a.originalGetLocalBounds,this.destroy=a.originalDestroy,this.updateTransform=a.originalUpdateTransform,this.containsPoint=a.originalContainsPoint,this._mask=a.originalMask,this.filterArea=a.originalFilterArea))}}}),r.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},r.prototype._initCachedDisplayObject=function(r){if(!this._cacheData||!this._cacheData.sprite){var s=this.alpha;this.alpha=1,r.batch.flush();var c=this.getLocalBounds(null,!0).clone();if(this.filters){var l=this.filters[0].padding;c.pad(l)}c.ceil(h.RESOLUTION);var d=r.renderTexture.current,p=r.renderTexture.sourceFrame.clone(),u=r.projection.transform,m=t.create({width:c.width,height:c.height,resolution:this.cacheAsBitmapResolution||r.resolution}),_="cacheAsBitmap_"+n();this._cacheData.textureCacheId=_,a.addToCache(m.baseTexture,_),e.addToCache(m,_);var f=this.transform.localTransform.copyTo(o).invert().translate(-c.x,-c.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:m,clear:!0,transform:f,skipUpdateTransform:!1}),r.projection.transform=u,r.renderTexture.bind(d,p),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var C=new i(m);C.transform.worldTransform=this.transform.worldTransform,C.anchor.x=-c.x/c.width,C.anchor.y=-c.y/c.height,C.alpha=s,C._bounds=this._bounds,this._cacheData.sprite=C,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=C.containsPoint.bind(C)}},r.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},r.prototype._initCachedDisplayObjectCanvas=function(r){if(!this._cacheData||!this._cacheData.sprite){var s=this.getLocalBounds(null,!0),c=this.alpha;this.alpha=1;var l=r.context,d=r._projTransform;s.ceil(h.RESOLUTION);var p=t.create({width:s.width,height:s.height}),u="cacheAsBitmap_"+n();this._cacheData.textureCacheId=u,a.addToCache(p.baseTexture,u),e.addToCache(p,u);var m=o;this.transform.localTransform.copyTo(m),m.invert(),m.tx-=s.x,m.ty-=s.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:p,clear:!0,transform:m,skipUpdateTransform:!1}),r.context=l,r._projTransform=d,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var _=new i(p);_.transform.worldTransform=this.transform.worldTransform,_.anchor.x=-s.x/s.width,_.anchor.y=-s.y/s.height,_.alpha=c,_._bounds=this._bounds,this._cacheData.sprite=_,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=_.containsPoint.bind(_)}},r.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},r.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},r.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,a.removeFromCache(this._cacheData.textureCacheId),e.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},r.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)};export{c as CacheData};
import{RenderTexture as t,BaseTexture as a,Texture as e}from"@pixi/core";import{Sprite as i}from"@pixi/sprite";import{DisplayObject as r}from"@pixi/display";import{Matrix as s}from"@pixi/math";import{uid as n}from"@pixi/utils";import{settings as h}from"@pixi/settings";var o=new s;r.prototype._cacheAsBitmap=!1,r.prototype._cacheData=null,r.prototype._cacheAsBitmapResolution=null;var c=function(){return function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}();Object.defineProperties(r.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(t){var a;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new c),(a=this._cacheData).originalRender=this.render,a.originalRenderCanvas=this.renderCanvas,a.originalUpdateTransform=this.updateTransform,a.originalCalculateBounds=this.calculateBounds,a.originalGetLocalBounds=this.getLocalBounds,a.originalDestroy=this.destroy,a.originalContainsPoint=this.containsPoint,a.originalMask=this._mask,a.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((a=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=a.originalRender,this.renderCanvas=a.originalRenderCanvas,this.calculateBounds=a.originalCalculateBounds,this.getLocalBounds=a.originalGetLocalBounds,this.destroy=a.originalDestroy,this.updateTransform=a.originalUpdateTransform,this.containsPoint=a.originalContainsPoint,this._mask=a.originalMask,this.filterArea=a.originalFilterArea))}}}),r.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},r.prototype._initCachedDisplayObject=function(r){if(!this._cacheData||!this._cacheData.sprite){var s=this.alpha;this.alpha=1,r.batch.flush();var c=this.getLocalBounds(null,!0).clone();if(this.filters){var l=this.filters[0].padding;c.pad(l)}c.ceil(h.RESOLUTION);var d=r.renderTexture.current,p=r.renderTexture.sourceFrame.clone(),u=r.renderTexture.destinationFrame.clone(),m=r.projection.transform,_=t.create({width:c.width,height:c.height,resolution:this.cacheAsBitmapResolution||r.resolution}),f="cacheAsBitmap_"+n();this._cacheData.textureCacheId=f,a.addToCache(_.baseTexture,f),e.addToCache(_,f);var C=this.transform.localTransform.copyTo(o).invert().translate(-c.x,-c.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:_,clear:!0,transform:C,skipUpdateTransform:!1}),r.projection.transform=m,r.renderTexture.bind(d,p,u),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var g=new i(_);g.transform.worldTransform=this.transform.worldTransform,g.anchor.x=-c.x/c.width,g.anchor.y=-c.y/c.height,g.alpha=s,g._bounds=this._bounds,this._cacheData.sprite=g,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=g.containsPoint.bind(g)}},r.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},r.prototype._initCachedDisplayObjectCanvas=function(r){if(!this._cacheData||!this._cacheData.sprite){var s=this.getLocalBounds(null,!0),c=this.alpha;this.alpha=1;var l=r.context,d=r._projTransform;s.ceil(h.RESOLUTION);var p=t.create({width:s.width,height:s.height}),u="cacheAsBitmap_"+n();this._cacheData.textureCacheId=u,a.addToCache(p.baseTexture,u),e.addToCache(p,u);var m=o;this.transform.localTransform.copyTo(m),m.invert(),m.tx-=s.x,m.ty-=s.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:p,clear:!0,transform:m,skipUpdateTransform:!1}),r.context=l,r._projTransform=d,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var _=new i(p);_.transform.worldTransform=this.transform.worldTransform,_.anchor.x=-s.x/s.width,_.anchor.y=-s.y/s.height,_.alpha=c,_._bounds=this._bounds,this._cacheData.sprite=_,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=_.containsPoint.bind(_)}},r.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},r.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},r.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,a.removeFromCache(this._cacheData.textureCacheId),e.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},r.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)};export{c as CacheData};
//# sourceMappingURL=mixin-cache-as-bitmap.min.js.map
{
"name": "@pixi/mixin-cache-as-bitmap",
"version": "6.0.0",
"version": "6.0.1",
"main": "dist/cjs/mixin-cache-as-bitmap.js",

@@ -29,11 +29,11 @@ "module": "dist/esm/mixin-cache-as-bitmap.js",

"dependencies": {
"@pixi/canvas-renderer": "6.0.0",
"@pixi/core": "6.0.0",
"@pixi/display": "6.0.0",
"@pixi/math": "6.0.0",
"@pixi/settings": "6.0.0",
"@pixi/sprite": "6.0.0",
"@pixi/utils": "6.0.0"
"@pixi/canvas-renderer": "6.0.1",
"@pixi/core": "6.0.1",
"@pixi/display": "6.0.1",
"@pixi/math": "6.0.1",
"@pixi/settings": "6.0.1",
"@pixi/sprite": "6.0.1",
"@pixi/utils": "6.0.1"
},
"gitHead": "40b8c8d7d1a3e99df059b5d5c582975eb536b30a"
"gitHead": "dee35532f3e5c5abc6cad909f47aa3c32634a325"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc