Skip to content

Commit

Permalink
fix #2034, fix tile debug rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
ansis committed Feb 5, 2016
1 parent 614bebe commit d73ac0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions js/render/draw_debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ var browser = require('../util/browser');

module.exports = drawDebug;

function drawDebug(painter, coords) {
function drawDebug(painter, source, coords) {
if (painter.isOpaquePass) return;
if (!painter.options.debug) return;

for (var i = 0; i < coords.length; i++) {
drawDebugTile(painter, coords[i]);
drawDebugTile(painter, source, coords[i]);
}
}

function drawDebugTile(painter, coord) {
function drawDebugTile(painter, source, coord) {
var gl = painter.gl;

var shader = painter.debugShader;
gl.switchShader(shader, painter.calculatePosMatrix(coord));
gl.switchShader(shader, painter.calculatePosMatrix(coord, source.maxzoom));

// draw bounding rectangle
gl.bindBuffer(gl.ARRAY_BUFFER, painter.debugBuffer);
Expand Down
4 changes: 3 additions & 1 deletion js/render/painter.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ Painter.prototype.renderPass = function(options) {
this.renderLayer(this, source, layer, coords);
}

draw.debug(this, coords);
if (source) {
draw.debug(this, source, coords);
}
}
};

Expand Down

0 comments on commit d73ac0f

Please sign in to comment.