Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit c84fade

Browse files
committed
Add OffscreenCanvas, BitmapRenderer context and ImageBitmap
1 parent f38fe81 commit c84fade

2 files changed

Lines changed: 104 additions & 0 deletions

File tree

scripts/9/data.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,52 @@ var tests = [
17001700

17011701
}
17021702
]
1703+
}, {
1704+
id: 'offscreen',
1705+
status: 'experimental',
1706+
name: 'Offscreen',
1707+
items: [
1708+
{
1709+
id: 'context',
1710+
name: 'Bitmap Renderer Context',
1711+
value: 1,
1712+
urls: [
1713+
[ 'whatwg', 'https://html.spec.whatwg.org/multipage/scripting.html#imagebitmaprenderingcontext' ]
1714+
]
1715+
}, {
1716+
id: 'bitmap',
1717+
name: 'Bitmap Data',
1718+
value: 1,
1719+
urls: [
1720+
[ 'whatwg', 'https://html.spec.whatwg.org/multipage/webappapis.html#imagebitmap' ]
1721+
]
1722+
},
1723+
1724+
'<strong>Offscreen Canvas</strong>',
1725+
1726+
{
1727+
id: 'canvas',
1728+
name: 'Offscreen Canvas API',
1729+
value: 1,
1730+
urls: [
1731+
[ 'whatwg', 'https://html.spec.whatwg.org/multipage/scripting.html#offscreencanvas' ]
1732+
]
1733+
}, {
1734+
id: '2d',
1735+
name: '2D support',
1736+
value: 0,
1737+
urls: [
1738+
[ 'whatwg', 'https://html.spec.whatwg.org/multipage/scripting.html#dom-offscreencanvas-getcontext' ]
1739+
]
1740+
}, {
1741+
id: 'webgl',
1742+
name: '3D support',
1743+
value: 0,
1744+
urls: [
1745+
[ 'whatwg', 'https://html.spec.whatwg.org/multipage/scripting.html#dom-offscreencanvas-getcontext' ]
1746+
]
1747+
}
1748+
]
17031749
}, {
17041750
id: 'animation',
17051751
status: 'stable',

scripts/9/engine.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3113,6 +3113,64 @@ Test9 = (function () {
31133113
},
31143114

31153115

3116+
/* offscreen */
3117+
3118+
function (results) {
3119+
var canvas = document.createElement('canvas');
3120+
3121+
/* bitmap */
3122+
3123+
results.addItem({
3124+
key: 'offscreen.context',
3125+
passed: !!(canvas.getContext && typeof ImageBitmapRenderingContext != 'undefined' && canvas.getContext('bitmaprenderer') instanceof ImageBitmapRenderingContext)
3126+
});
3127+
3128+
results.addItem({
3129+
key: 'offscreen.bitmap',
3130+
passed: 'ImageBitmap' in window
3131+
});
3132+
3133+
/* offscreen canvas */
3134+
3135+
var passed;
3136+
3137+
results.addItem({
3138+
key: 'offscreen.canvas',
3139+
passed: 'OffscreenCanvas' in window
3140+
});
3141+
3142+
passed = false;
3143+
3144+
if ('OffscreenCanvas' in window) {
3145+
try {
3146+
var offscreen = new OffscreenCanvas(16, 16);
3147+
var context = offscreen.getContext('webgl');
3148+
passed = context instanceof WebGLRenderingContext;
3149+
} catch (e) { }
3150+
}
3151+
3152+
results.addItem({
3153+
key: 'offscreen.webgl',
3154+
passed: passed
3155+
});
3156+
3157+
passed = false;
3158+
3159+
if ('OffscreenCanvas' in window) {
3160+
try {
3161+
var offscreen = new OffscreenCanvas(16, 16);
3162+
var context = offscreen.getContext('2d');
3163+
passed = context instanceof CanvasRenderingContext2D;
3164+
} catch (e) { }
3165+
}
3166+
3167+
results.addItem({
3168+
key: 'offscreen.2d',
3169+
passed: passed
3170+
});
3171+
},
3172+
3173+
31163174
/* webgl */
31173175

31183176
function (results) {

0 commit comments

Comments
 (0)