Merge pull request #80 from Arteris/master

Handle cases where depths appear multiple times
This commit is contained in:
Andrey Sidorov 2016-05-18 09:14:33 +10:00
commit 1d77f21ec7

View file

@ -32,8 +32,11 @@ function readVisuals(bl, visuals, n_visuals, cb)
}); });
} }
function readDepths(bl, display, depths, n_depths, cb) function readScreens(bl, display, cbDisplayReady)
{ {
var numParsedDepths = 0;
var readDepths = function(bl, display, depths, n_depths, cb)
{
if (n_depths == 0) if (n_depths == 0)
{ {
cb(); cb();
@ -46,17 +49,22 @@ function readDepths(bl, display, depths, n_depths, cb)
var visuals = {}; var visuals = {};
readVisuals(bl, visuals, n_visuals, function() readVisuals(bl, visuals, n_visuals, function()
{ {
if (dep in depths) {
for (var visual in visuals) {
depths[dep][visual] = visuals[visual];
}
} else {
depths[dep] = visuals; depths[dep] = visuals;
if (Object.keys(depths).length == n_depths) }
numParsedDepths++;
if (numParsedDepths == n_depths)
cb(); cb();
else else
readDepths(bl, display, depths, n_depths, cb); readDepths(bl, display, depths, n_depths, cb);
}); });
}); });
} }
function readScreens(bl, display, cbDisplayReady)
{
// for (i=0; i < display.screen_num; ++i) // for (i=0; i < display.screen_num; ++i)
{ {
var scr = {}; var scr = {};