@@ -1419,8 +1419,7 @@ this.createjs = this.createjs||{};
14191419 var storeBatchTemp = this . _batchTextureTemp ;
14201420
14211421 var filterCount = manager . _filterCount , filtersLeft = filterCount ;
1422- var backupWidth = this . _viewportWidth , backupHeight = this . _viewportHeight ;
1423- this . updateViewport ( manager . _drawWidth , manager . _drawHeight ) ;
1422+ this . _updateDrawingSurface ( manager . _drawWidth , manager . _drawHeight ) ;
14241423
14251424 this . _batchTextureOutput = ( manager . _filterCount % 2 ) ? manager . _bufferTextureConcat : manager . _bufferTextureOutput ;
14261425 this . _batchTextureConcat = ( manager . _filterCount % 2 ) ? manager . _bufferTextureOutput : manager . _bufferTextureConcat ;
@@ -1461,7 +1460,7 @@ this.createjs = this.createjs||{};
14611460 this . _batchTextureConcat = storeBatchConcat ;
14621461 this . _batchTextureTemp = storeBatchTemp ;
14631462
1464- this . updateViewport ( backupWidth , backupHeight ) ;
1463+ this . _updateDrawingSurface ( ) ;
14651464 return true ;
14661465 } ;
14671466
@@ -1583,30 +1582,17 @@ this.createjs = this.createjs||{};
15831582 p . updateViewport = function ( width , height ) {
15841583 this . _viewportWidth = width | 0 ;
15851584 this . _viewportHeight = height | 0 ;
1586- var gl = this . _webGLContext ;
15871585
1588- if ( gl ) {
1589- gl . viewport ( 0 , 0 , this . _viewportWidth , this . _viewportHeight ) ;
1590-
1591- // WebGL works with a -1,1 space on its screen. It also follows Y-Up
1592- // we need to flip the y, scale and then translate the co-ordinates to match this
1593- // additionally we offset into they Y so the polygons are inside the camera's "clipping" plane
1594- this . _projectionMatrix = new Float32Array ( [
1595- 2 / this . _viewportWidth , 0 , 0 , 0 ,
1596- 0 , - 2 / this . _viewportHeight , 0 , 0 ,
1597- 0 , 0 , 1 , 0 ,
1598- - 1 , 1 , 0 , 1
1599- ] ) ;
1600-
1601- if ( this . _bufferTextureOutput !== this && this . _bufferTextureOutput !== null ) {
1602- this . resizeTexture ( this . _bufferTextureOutput , this . _viewportWidth , this . _viewportHeight ) ;
1603- }
1604- if ( this . _bufferTextureConcat !== null ) {
1605- this . resizeTexture ( this . _bufferTextureConcat , this . _viewportWidth , this . _viewportHeight ) ;
1606- }
1607- if ( this . _bufferTextureTemp !== null ) {
1608- this . resizeTexture ( this . _bufferTextureTemp , this . _viewportWidth , this . _viewportHeight ) ;
1609- }
1586+ this . _updateDrawingSurface ( width , height ) ;
1587+
1588+ if ( this . _bufferTextureOutput !== this && this . _bufferTextureOutput !== null ) {
1589+ this . resizeTexture ( this . _bufferTextureOutput , this . _viewportWidth , this . _viewportHeight ) ;
1590+ }
1591+ if ( this . _bufferTextureConcat !== null ) {
1592+ this . resizeTexture ( this . _bufferTextureConcat , this . _viewportWidth , this . _viewportHeight ) ;
1593+ }
1594+ if ( this . _bufferTextureTemp !== null ) {
1595+ this . resizeTexture ( this . _bufferTextureTemp , this . _viewportWidth , this . _viewportHeight ) ;
16101596 }
16111597 } ;
16121598
@@ -1810,6 +1796,29 @@ this.createjs = this.createjs||{};
18101796 } ;
18111797
18121798// private methods:
1799+ /**
1800+ * Changes the active drawing surface and view matrix to the correct parameters without polluting the concept
1801+ * of the current stage size
1802+ * @param {uint } [w=_viewportWidth] The width of the surface in pixels, defaults to _viewportWidth
1803+ * @param {uint } [h=_viewportHeight] The height of the surface in pixels, defaults to _viewportHeight
1804+ */
1805+ p . _updateDrawingSurface = function ( w , h ) {
1806+ if ( w === undefined ) { w = this . _viewportWidth ; }
1807+ if ( h === undefined ) { h = this . _viewportHeight ; }
1808+
1809+ this . _webGLContext . viewport ( 0 , 0 , w , h ) ;
1810+
1811+ // WebGL works with a -1,1 space on its screen. It also follows Y-Up
1812+ // we need to flip the y, scale and then translate the co-ordinates to match this
1813+ // additionally we offset into they Y so the polygons are inside the camera's "clipping" plane
1814+ this . _projectionMatrix = new Float32Array ( [
1815+ 2 / w , 0 , 0 , 0 ,
1816+ 0 , - 2 / h , 0 , 0 ,
1817+ 0 , 0 , 1 , 0 ,
1818+ - 1 , 1 , 0 , 1
1819+ ] ) ;
1820+ } ;
1821+
18131822 /**
18141823 * Returns a base texture that has no image or data loaded. Not intended for loading images. In some error cases,
18151824 * the texture creation will fail. This function differs from {{#crossLink "StageGL/getBaseTexture"}}{{/crossLink}}
0 commit comments