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

visgl / luma.gl / 17192022436

24 Aug 2025 06:02PM UTC coverage: 62.079% (-13.2%) from 75.234%
17192022436

Pull #2437

github

web-flow
Merge 562c391b0 into 8314ecefa
Pull Request #2437: test(engine): add ShaderPassRenderer test

956 of 1559 branches covered (61.32%)

Branch coverage included in aggregate %.

491 of 666 new or added lines in 7 files covered. (73.72%)

5291 existing lines in 117 files now uncovered.

23238 of 37414 relevant lines covered (62.11%)

3.53 hits per line

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

34.38
/modules/arrow/src/attribute-utils/attribute-utils.ts
1
// luma.gl
1✔
2
// SPDX-License-Identifier: MIT
1✔
3
// Copyright (c) vis.gl contributors
1✔
4

1✔
5
import {TypedArray} from '@math.gl/types';
1✔
6

1✔
7
/**
1✔
8
 * Expand an array from "one element per geometry" to "one element per coordinate"
1✔
9
 *
1✔
10
 * @param input: the input array to expand
1✔
11
 * @param size : the number of nested elements in the input array per geometry. So for example, for RGB data this would be 3, for RGBA this would be 4. For radius, this would be 1.
1✔
12
 * @param geomOffsets : an offsets array mapping from the geometry to the coordinate indexes. So in the case of a LineStringArray, this is retrieved directly from the GeoArrow storage. In the case of a PolygonArray, this comes from the resolved indexes that need to be given to the SolidPolygonLayer anyways.
1✔
13
 *
1✔
14
 * @return values expanded to be per-coordinate
1✔
15
 */
1✔
16
export function expandArrayToCoords<T extends TypedArray>(
1✔
UNCOV
17
  input: T,
×
UNCOV
18
  size: number,
×
UNCOV
19
  geomOffsets: Int32Array
×
UNCOV
20
): T {
×
UNCOV
21
  const numCoords = geomOffsets[geomOffsets.length - 1];
×
UNCOV
22
  // @ts-expect-error
×
UNCOV
23
  const outputArray: T = new input.constructor(numCoords * size);
×
UNCOV
24

×
UNCOV
25
  // geomIdx is an index into the geomOffsets array
×
UNCOV
26
  // geomIdx is also the geometry/table index
×
UNCOV
27
  for (let geomIdx = 0; geomIdx < geomOffsets.length - 1; geomIdx++) {
×
UNCOV
28
    // geomOffsets maps from the geometry index to the coord index
×
UNCOV
29
    // So here we get the range of coords that this geometry covers
×
UNCOV
30
    const lastCoordIdx = geomOffsets[geomIdx];
×
UNCOV
31
    const nextCoordIdx = geomOffsets[geomIdx + 1];
×
UNCOV
32

×
UNCOV
33
    // Iterate over this range of coord indices
×
UNCOV
34
    for (let coordIdx = lastCoordIdx; coordIdx < nextCoordIdx; coordIdx++) {
×
UNCOV
35
      // Iterate over size
×
UNCOV
36
      for (let i = 0; i < size; i++) {
×
UNCOV
37
        // Copy from the geometry index in `input` to the coord index in
×
UNCOV
38
        // `output`
×
UNCOV
39
        outputArray[coordIdx * size + i] = input[geomIdx * size + i];
×
UNCOV
40
      }
×
UNCOV
41
    }
×
UNCOV
42
  }
×
UNCOV
43

×
UNCOV
44
  return outputArray;
×
UNCOV
45
}
×
46

1✔
47
/**
1✔
48
 * Invert offsets so that lookup can go in the opposite direction
1✔
49
 */
1✔
50
export function invertOffsets(offsets: Int32Array): Uint32Array {
1✔
51
  const largestOffset = offsets[offsets.length - 1];
×
52

×
53
  const invertedOffsets = new Uint32Array(largestOffset);
×
54
  for (let arrayIdx = 0; arrayIdx < offsets.length - 1; arrayIdx++) {
×
55
    const thisOffset = offsets[arrayIdx];
×
56
    const nextOffset = offsets[arrayIdx + 1];
×
57
    for (let offset = thisOffset; offset < nextOffset; offset++) {
×
58
      invertedOffsets[offset] = arrayIdx;
×
59
    }
×
60
  }
×
61

×
62
  return invertedOffsets;
×
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

© 2026 Coveralls, Inc