• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / deck.gl / 13375517267

17 Feb 2025 05:14PM CUT coverage: 91.607%. Remained the same
13375517267

Pull #9440

github

web-flow
Merge 4e280d9d2 into 95884c441
Pull Request #9440: chore(deps): bump actions/setup-python from 4.7.1 to 5.4.0

6692 of 7328 branches covered (91.32%)

Branch coverage included in aggregate %.

54112 of 59047 relevant lines covered (91.64%)

14865.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/modules/extensions/src/utils/debug.ts
1
// deck.gl
×
2
// SPDX-License-Identifier: MIT
×
3
// Copyright (c) vis.gl contributors
×
4

×
5
/* global document */
×
6

×
7
import {Framebuffer} from '@luma.gl/core';
×
8

×
9
/** Debug utility to draw FBO contents onto screen */
×
10
// eslint-disable-next-line
×
11
export const debugFBO = function (
×
12
  fbo: Framebuffer,
×
13
  {minimap, opaque}: {minimap?: boolean; opaque?: boolean} = {}
×
14
) {
×
15
  const color = fbo.device.readPixelsToArrayWebGL(fbo);
×
16
  let canvas = document.getElementById('fbo-canvas') as HTMLCanvasElement;
×
17
  const canvasHeight = (minimap ? 2 : 1) * fbo.height;
×
18
  if (!canvas) {
×
19
    canvas = document.createElement('canvas');
×
20
    canvas.id = 'fbo-canvas';
×
21
    canvas.style.zIndex = '100';
×
22
    canvas.style.position = 'absolute';
×
23
    canvas.style.top = '0';
×
24
    canvas.style.right = '0';
×
25
    canvas.style.border = 'blue 1px solid';
×
26
    canvas.style.transform = 'scaleY(-1)';
×
27
    document.body.appendChild(canvas);
×
28
  }
×
29
  if (canvas.width !== fbo.width || canvas.height !== canvasHeight) {
×
30
    canvas.width = fbo.width;
×
31
    canvas.height = canvasHeight;
×
32
    canvas.style.width = '400px';
×
33
  }
×
34
  const ctx = canvas.getContext('2d')!;
×
35
  const imageData = ctx.createImageData(canvas.width, canvas.height);
×
36

×
37
  // Minimap
×
38
  if (minimap) {
×
39
    const zoom = 8; // Zoom factor for minimap
×
40
    const {width, height} = canvas;
×
41
    for (let y = 0; y < height; y++) {
×
42
      for (let x = 0; x < width; x++) {
×
43
        const d = 4 * (x + y * width); // destination pixel
×
44
        const s = 4 * (Math.floor(x / zoom) + Math.floor(y / zoom) * width); // source
×
45
        imageData.data[d + 0] = color[s + 0];
×
46
        imageData.data[d + 1] = color[s + 1];
×
47
        imageData.data[d + 2] = color[s + 2];
×
48
        imageData.data[d + 3] = opaque ? 255 : color[s + 3];
×
49
      }
×
50
    }
×
51
  }
×
52

×
53
  // Full map
×
54
  const offset = minimap ? color.length : 0;
×
55
  for (let i = 0; i < color.length; i += 4) {
×
56
    imageData.data[offset + i + 0] = color[i + 0];
×
57
    imageData.data[offset + i + 1] = color[i + 1];
×
58
    imageData.data[offset + i + 2] = color[i + 2];
×
59
    imageData.data[offset + i + 3] = opaque ? 255 : color[i + 3];
×
60
  }
×
61

×
62
  ctx.putImageData(imageData, 0, 0);
×
63
};
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc