Compare commits

..

21 Commits

Author SHA1 Message Date
Renovate Bot
f6c314259e chore(deps): update dependency webpack to v5 2021-08-02 12:57:41 +00:00
renovate[bot]
4afa7f5f8b Merge pull request #934 from LLK/renovate/scratch-svg-renderer-0.x
fix(deps): update dependency scratch-svg-renderer to v0.2.0-prerelease.20210727023023
2021-07-27 08:33:51 +00:00
Renovate Bot
6fb49c0f8b fix(deps): update dependency scratch-svg-renderer to v0.2.0-prerelease.20210727023023 2021-07-27 07:18:11 +00:00
Christopher Willis-Ford
bce6246084 Merge pull request #923 from LLK/renovate/npm-json-vulnerability
chore(deps): pin dependency json to v9.0.6 [security]
2021-07-26 16:36:15 -07:00
Renovate Bot
bb7229d22f chore(deps): pin dependency json to v9.0.6 [security] 2021-07-26 23:34:05 +00:00
Christopher Willis-Ford
d34510dcde Merge pull request #926 from LLK/renovate/playwright-monorepo
chore(deps): pin dependency playwright-chromium to 1.13.0
2021-07-26 16:33:43 -07:00
Renovate Bot
aae7d29f0b chore(deps): pin dependency playwright-chromium to 1.13.0 2021-07-26 23:32:07 +00:00
Christopher Willis-Ford
e99ff82182 Merge pull request #925 from LLK/renovate/pin-dependencies
chore(deps): pin dependencies
2021-07-26 16:31:39 -07:00
Renovate Bot
97a90ca09a chore(deps): pin dependencies 2021-07-26 23:19:25 +00:00
Christopher Willis-Ford
998479973e Merge pull request #924 from LLK/renovate/babel-monorepo
chore(deps): pin dependencies
2021-07-26 16:19:00 -07:00
Renovate Bot
16704af7d3 chore(deps): pin dependencies 2021-07-26 23:12:36 +00:00
Christopher Willis-Ford
01c008ed11 Merge pull request #922 from LLK/renovate/configure
Configure Renovate
2021-07-26 16:12:08 -07:00
Christopher Willis-Ford
e9ac9a23c2 use scratch-renovate-config:conservative, customized
Prevent auto-merge for scratch-vm to avoid depdency update cycle
2021-07-26 14:06:30 -07:00
Renovate Bot
65db4f201f chore(deps): add renovate.json 2021-07-26 20:59:14 +00:00
DD Liu
786178f2ad Merge pull request #912 from fsih/updateDeps
Update svg renderer dependency
2021-06-29 17:33:31 -04:00
DD Liu
01a4057fe3 Merge pull request #621 from adroitwhiz/stamp-pen-layer-scale
Take render target dimensions into account when drawing
2021-06-29 17:07:45 -04:00
DD Liu
df4fb26094 Remove redundant test 2021-06-29 16:53:00 -04:00
DD Liu
b6ed521b16 Update svg renderer dependency 2021-06-29 16:34:36 -04:00
adroitwhiz
438e0491b7 Pass size to _drawThese when extracting drawable 2020-11-13 18:31:21 -05:00
adroitwhiz
26fe38c0d8 Take render target size into account when drawing 2020-11-09 18:30:48 -05:00
adroitwhiz
5b36e937e2 Inline the last _getDrawableScreenSpaceScale call 2020-11-09 18:28:50 -05:00
5 changed files with 67 additions and 41 deletions

1
.gitattributes vendored
View File

@@ -14,6 +14,7 @@
*.js text eol=lf
*.js.map text eol=lf
*.json text eol=lf
*.json5 text eol=lf
*.md text eol=lf
*.vert text eol=lf
*.xml text eol=lf

View File

@@ -19,10 +19,6 @@ cache:
jobs:
include:
- stage: test
script:
- npm run lint
- npm run docs
- npm run tap
- stage: deploy
node_js: 10
script: npm run build

View File

@@ -24,26 +24,30 @@
"watch": "webpack --progress --colors --watch --watch-poll"
},
"devDependencies": {
"babel-core": "^6.23.1",
"babel-eslint": "^10.1.0",
"babel-loader": "^7.1.4",
"babel-polyfill": "^6.22.0",
"babel-preset-env": "^1.6.1",
"copy-webpack-plugin": "^4.5.1",
"docdash": "^0.4.0",
"eslint": "^7.13.0",
"eslint-config-scratch": "^6.0.0",
"gh-pages": "^1.0.0",
"jsdoc": "^3.6.0",
"json": "^9.0.4",
"playwright-chromium": "^1.0.1",
"babel-core": "6.26.3",
"babel-eslint": "10.1.0",
"babel-loader": "7.1.5",
"babel-polyfill": "6.26.0",
"babel-preset-env": "1.7.0",
"copy-webpack-plugin": "4.6.0",
"docdash": "0.4.0",
"eslint": "7.31.0",
"eslint-config-scratch": "6.0.0",
"gh-pages": "1.2.0",
"jsdoc": "3.6.7",
"json": "9.0.6",
"playwright-chromium": "1.13.0",
"scratch-render-fonts": "1.0.0-prerelease.20210401210003",
"scratch-vm": "0.2.0-prerelease.20201125065300",
"tap": "^11.0.0",
"travis-after-all": "^1.4.4",
"uglifyjs-webpack-plugin": "^1.2.5",
"webpack": "^4.8.0",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.4"
"tap": "11.1.5",
"travis-after-all": "1.4.5",
"uglifyjs-webpack-plugin": "1.3.0",
"webpack": "5.48.0",
"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.2"
},
"peerDependencies": {
"scratch-render-fonts": "^1.0.0-prerelease"
},
"dependencies": {
"grapheme-breaker": "0.3.2",
@@ -53,7 +57,7 @@
"minilog": "3.1.0",
"raw-loader": "^0.5.1",
"scratch-storage": "^1.0.0",
"scratch-svg-renderer": "0.2.0-prerelease.20210317184701",
"scratch-svg-renderer": "0.2.0-prerelease.20210727023023",
"twgl.js": "4.4.0"
}
}

16
renovate.json5 Normal file
View File

@@ -0,0 +1,16 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>LLK/scratch-renovate-config:conservative"
],
"packageRules": [
// Don't auto-merge scratch-vm since that will cause a never-ending cycle of dependency updates. Ideally, updating
// scratch-vm in scratch-render shouldn't make a scratch-render release. Once that's true we can remove this rule.
{
"matchPackageNames": ["scratch-vm"],
"automerge": false
}
]
}

View File

@@ -653,7 +653,10 @@ class RenderWebGL extends EventEmitter {
gl.clearColor(...this._backgroundColor4f);
gl.clear(gl.COLOR_BUFFER_BIT);
this._drawThese(this._drawList, ShaderManager.DRAW_MODE.default, this._projection);
this._drawThese(this._drawList, ShaderManager.DRAW_MODE.default, this._projection, {
framebufferWidth: gl.canvas.width,
framebufferHeight: gl.canvas.height
});
if (this._snapshotCallbacks.length > 0) {
const snapshot = gl.canvas.toDataURL();
this._snapshotCallbacks.forEach(cb => cb(snapshot));
@@ -1209,9 +1212,15 @@ class RenderWebGL extends EventEmitter {
gl.clearColor(0, 0, 0, 0);
gl.clear(gl.COLOR_BUFFER_BIT);
// Don't apply the ghost effect. TODO: is this an intentional design decision?
this._drawThese([drawableID], ShaderManager.DRAW_MODE.straightAlpha, projection,
{effectMask: ~ShaderManager.EFFECT_INFO.ghost.mask});
{
// Don't apply the ghost effect. TODO: is this an intentional design decision?
effectMask: ~ShaderManager.EFFECT_INFO.ghost.mask,
// We're doing this in screen-space, so the framebuffer dimensions should be those of the canvas in
// screen-space. This is used to ensure SVG skins are rendered at the proper resolution.
framebufferWidth: canvas.width,
framebufferHeight: canvas.height
});
const data = new Uint8Array(Math.floor(clampedWidth * clampedHeight * 4));
gl.readPixels(0, 0, clampedWidth, clampedHeight, gl.RGBA, gl.UNSIGNED_BYTE, data);
@@ -1713,18 +1722,6 @@ class RenderWebGL extends EventEmitter {
this._regionId = null;
}
/**
* Get the screen-space scale of a drawable, as percentages of the drawable's "normal" size.
* @param {Drawable} drawable The drawable whose screen-space scale we're fetching.
* @returns {Array<number>} The screen-space X and Y dimensions of the drawable's scale, as percentages.
*/
_getDrawableScreenSpaceScale (drawable) {
return [
drawable.scale[0] * this._gl.canvas.width / this._nativeSize[0],
drawable.scale[1] * this._gl.canvas.height / this._nativeSize[1]
];
}
/**
* Draw a set of Drawables, by drawable ID
* @param {Array<int>} drawables The Drawable IDs to draw, possibly this._drawList.
@@ -1735,6 +1732,8 @@ class RenderWebGL extends EventEmitter {
* @param {object.<string,*>} opts.extraUniforms Extra uniforms for the shaders.
* @param {int} opts.effectMask Bitmask for effects to allow
* @param {boolean} opts.ignoreVisibility Draw all, despite visibility (e.g. stamping, touching color)
* @param {int} opts.framebufferWidth The width of the framebuffer being drawn onto. Defaults to "native" width
* @param {int} opts.framebufferHeight The height of the framebuffer being drawn onto. Defaults to "native" height
* @private
*/
_drawThese (drawables, drawMode, projection, opts = {}) {
@@ -1742,6 +1741,11 @@ class RenderWebGL extends EventEmitter {
const gl = this._gl;
let currentShader = null;
const framebufferSpaceScaleDiffers = (
'framebufferWidth' in opts && 'framebufferHeight' in opts &&
opts.framebufferWidth !== this._nativeSize[0] && opts.framebufferHeight !== this._nativeSize[1]
);
const numDrawables = drawables.length;
for (let drawableIndex = 0; drawableIndex < numDrawables; ++drawableIndex) {
const drawableID = drawables[drawableIndex];
@@ -1756,8 +1760,13 @@ class RenderWebGL extends EventEmitter {
// the ignoreVisibility flag is used (e.g. for stamping or touchingColor).
if (!drawable.getVisible() && !opts.ignoreVisibility) continue;
// Combine drawable scale with the native vs. backing pixel ratio
const drawableScale = this._getDrawableScreenSpaceScale(drawable);
// drawableScale is the "framebuffer-pixel-space" scale of the drawable, as percentages of the drawable's
// "native size" (so 100 = same as skin's "native size", 200 = twice "native size").
// If the framebuffer dimensions are the same as the stage's "native" size, there's no need to calculate it.
const drawableScale = framebufferSpaceScaleDiffers ? [
drawable.scale[0] * opts.framebufferWidth / this._nativeSize[0],
drawable.scale[1] * opts.framebufferHeight / this._nativeSize[1]
] : drawable.scale;
// If the skin or texture isn't ready yet, skip it.
if (!drawable.skin || !drawable.skin.getTexture(drawableScale)) continue;