(
seriesConfig,
pointBuffer,
pointCount,
visibleStartIndex,
visibleEndIndex,
xScale,
yScale,
gridArea,
rawBounds
)
| 358 | }; |
| 359 | |
| 360 | const prepare: ScatterDensityRenderer['prepare'] = ( |
| 361 | seriesConfig, |
| 362 | pointBuffer, |
| 363 | pointCount, |
| 364 | visibleStartIndex, |
| 365 | visibleEndIndex, |
| 366 | xScale, |
| 367 | yScale, |
| 368 | gridArea, |
| 369 | rawBounds |
| 370 | ) => { |
| 371 | assertNotDisposed(); |
| 372 | hasPrepared = true; |
| 373 | |
| 374 | const plotScissor = computePlotScissorDevicePx(gridArea); |
| 375 | const dpr = gridArea.devicePixelRatio; |
| 376 | const binSizeCss = Number.isFinite(seriesConfig.binSize) ? Math.max(1e-6, seriesConfig.binSize) : 2; |
| 377 | const binSizePx = Math.max(1, Math.round(binSizeCss * (Number.isFinite(dpr) && dpr > 0 ? dpr : 1))); |
| 378 | |
| 379 | const binCountX = Math.max(1, Math.ceil(plotScissor.w / binSizePx)); |
| 380 | const binCountY = Math.max(1, Math.ceil(plotScissor.h / binSizePx)); |
| 381 | |
| 382 | ensureBins(binCountX, binCountY); |
| 383 | ensureLut(seriesConfig); |
| 384 | |
| 385 | const normU32 = normalizationToU32(seriesConfig.densityNormalization); |
| 386 | |
| 387 | // Dirty detection. |
| 388 | if (lastPointBuffer !== pointBuffer) { |
| 389 | lastPointBuffer = pointBuffer; |
| 390 | computeBindGroup = null; |
| 391 | renderBindGroup = null; |
| 392 | computeDirty = true; |
| 393 | } |
| 394 | if (lastPointCount !== pointCount) { |
| 395 | lastPointCount = pointCount; |
| 396 | computeDirty = true; |
| 397 | } |
| 398 | if (lastVisibleStart !== visibleStartIndex || lastVisibleEnd !== visibleEndIndex) { |
| 399 | lastVisibleStart = visibleStartIndex; |
| 400 | lastVisibleEnd = visibleEndIndex; |
| 401 | computeDirty = true; |
| 402 | } |
| 403 | if (lastBinSizePx !== binSizePx || lastBinCountX !== binCountX || lastBinCountY !== binCountY) { |
| 404 | lastBinSizePx = binSizePx; |
| 405 | lastBinCountX = binCountX; |
| 406 | lastBinCountY = binCountY; |
| 407 | computeDirty = true; |
| 408 | } |
| 409 | if ( |
| 410 | !lastPlotScissor || |
| 411 | lastPlotScissor.x !== plotScissor.x || |
| 412 | lastPlotScissor.y !== plotScissor.y || |
| 413 | lastPlotScissor.w !== plotScissor.w || |
| 414 | lastPlotScissor.h !== plotScissor.h |
| 415 | ) { |
| 416 | lastPlotScissor = plotScissor; |
| 417 | computeDirty = true; |
nothing calls this directly
no test coverage detected