Skip to content

Commit adbf6ab

Browse files
authored
Merge pull request #168 from stackgl/166-const-let-and-precheckFramebufferStatus-high-cpu
FIX #166 const let and precheck framebuffer status high cpu
2 parents 60c7349 + 1648dc2 commit adbf6ab

36 files changed

+4893
-4779
lines changed

binding.gyp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
'VERSION=1.0.0'
1414
],
1515
'sources': [
16-
'src/bindings.cc',
17-
'src/webgl.cc',
18-
'src/procs.cc'
16+
'src/native/bindings.cc',
17+
'src/native/webgl.cc',
18+
'src/native/procs.cc'
1919
],
2020
'include_dirs': [
2121
"<!(node -e \"require('nan')\")",

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
if (typeof WebGLRenderingContext !== 'undefined') {
2-
module.exports = require('./browser_index')
2+
module.exports = require('./src/javascript/browser-index')
33
} else {
4-
module.exports = require('./node_index')
4+
module.exports = require('./src/javascript/node-index')
55
}

node_index.js

Lines changed: 0 additions & 129 deletions
This file was deleted.
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
'use strict'
2-
31
function createContext (width, height, options) {
42
width = width | 0
53
height = height | 0
64
if (!(width > 0 && height > 0)) {
75
return null
86
}
97

10-
var canvas = document.createElement('canvas')
8+
const canvas = document.createElement('canvas')
119
if (!canvas) {
1210
return null
1311
}
14-
var gl
12+
let gl
1513
canvas.width = width
1614
canvas.height = height
1715

@@ -25,24 +23,24 @@ function createContext (width, height, options) {
2523
}
2624
}
2725

28-
var _getExtension = gl.getExtension
29-
var extDestroy = {
26+
const _getExtension = gl.getExtension
27+
const extDestroy = {
3028
destroy: function () {
31-
var loseContext = _getExtension.call(gl, 'WEBGL_lose_context')
29+
const loseContext = _getExtension.call(gl, 'WEBGL_lose_context')
3230
if (loseContext) {
3331
loseContext.loseContext()
3432
}
3533
}
3634
}
3735

38-
var extResize = {
36+
const extResize = {
3937
resize: function (w, h) {
4038
canvas.width = w
4139
canvas.height = h
4240
}
4341
}
4442

45-
var _supportedExtensions = gl.getSupportedExtensions().slice()
43+
const _supportedExtensions = gl.getSupportedExtensions().slice()
4644
_supportedExtensions.push(
4745
'STACKGL_destroy_context',
4846
'STACKGL_resize_drawingbuffer')
@@ -51,7 +49,7 @@ function createContext (width, height, options) {
5149
}
5250

5351
gl.getExtension = function (extName) {
54-
var name = extName.toLowerCase()
52+
const name = extName.toLowerCase()
5553
if (name === 'stackgl_resize_drawingbuffer') {
5654
return extResize
5755
}

0 commit comments

Comments
 (0)