@luma.gl/test-utils
Advanced tools
Comparing version 9.1.0-alpha.9 to 9.1.0-alpha.10
@@ -1,2 +0,2 @@ | ||
import type { TextureProps, Sampler, SamplerProps, TextureViewProps } from '@luma.gl/core'; | ||
import type { TextureProps, Sampler, SamplerProps, TextureViewProps, CopyExternalImageOptions } from '@luma.gl/core'; | ||
import type { Texture1DData, Texture2DData, Texture3DData, TextureCubeData, TextureArrayData, TextureCubeArrayData } from '@luma.gl/core'; | ||
@@ -22,15 +22,7 @@ import { Texture } from '@luma.gl/core'; | ||
setSampler(sampler?: Sampler | SamplerProps): this; | ||
setImageData(options: { | ||
data?: any; | ||
width?: number; | ||
height?: number; | ||
}): this; | ||
setSubImageData(options: { | ||
data: any; | ||
width?: number; | ||
height?: number; | ||
x?: number; | ||
y?: number; | ||
}): void; | ||
copyExternalImage(options: CopyExternalImageOptions): { | ||
width: number; | ||
height: number; | ||
}; | ||
} | ||
//# sourceMappingURL=null-texture.d.ts.map |
@@ -49,11 +49,4 @@ // luma.gl | ||
initialize(props = {}) { | ||
const data = props.data; | ||
if (data instanceof Promise) { | ||
data.then(resolvedImageData => this.initialize(Object.assign({}, props, { | ||
pixels: resolvedImageData, | ||
data: resolvedImageData | ||
}))); | ||
return this; | ||
} | ||
this.setImageData(props); | ||
// const data = props.data; | ||
// this.setImageData(props); | ||
this.setSampler(props.sampler); | ||
@@ -77,12 +70,11 @@ this.view = new NullTextureView(this.device, { | ||
} | ||
setImageData(options) { | ||
copyExternalImage(options) { | ||
this.trackDeallocatedMemory('Texture'); | ||
const { data } = options; | ||
if (data && data.byteLength) { | ||
this.trackAllocatedMemory(data.byteLength, 'Texture'); | ||
} | ||
else { | ||
const bytesPerPixel = 4; | ||
this.trackAllocatedMemory(this.width * this.height * bytesPerPixel, 'Texture'); | ||
} | ||
const { image: data } = options; | ||
// if (data && data.byteLength) { | ||
// this.trackAllocatedMemory(data.byteLength, 'Texture'); | ||
// } else { | ||
const bytesPerPixel = 4; | ||
this.trackAllocatedMemory(this.width * this.height * bytesPerPixel, 'Texture'); | ||
// } | ||
const width = options.width ?? data.width; | ||
@@ -92,10 +84,4 @@ const height = options.height ?? data.height; | ||
this.height = height; | ||
return this; | ||
return { width, height }; | ||
} | ||
setSubImageData(options) { | ||
// const {data, x = 0, y = 0} = options; | ||
// const width = options.width ?? (data as ImageBitmap).width; | ||
// const height = options.height ?? (data as ImageBitmap).height; | ||
// assert(width + x <= this.width && height + y <= this.height); | ||
} | ||
} |
{ | ||
"name": "@luma.gl/test-utils", | ||
"version": "9.1.0-alpha.9", | ||
"version": "9.1.0-alpha.10", | ||
"description": "Automated WebGL testing utilities with Puppeteer and image diffing", | ||
@@ -49,3 +49,3 @@ "type": "module", | ||
}, | ||
"gitHead": "ff05b21269181dbb782ba7c8c1546900288ee6a1" | ||
"gitHead": "f419cdc284e87b553df60af49d2888ac7dbbf288" | ||
} |
@@ -5,4 +5,10 @@ // luma.gl | ||
import type {TextureProps, Sampler, SamplerProps, TextureViewProps} from '@luma.gl/core'; | ||
import type { | ||
TextureProps, | ||
Sampler, | ||
SamplerProps, | ||
TextureViewProps, | ||
CopyExternalImageOptions | ||
} from '@luma.gl/core'; | ||
import type { | ||
Texture1DData, | ||
@@ -78,18 +84,5 @@ Texture2DData, | ||
initialize(props: TextureProps = {}): this { | ||
const data = props.data; | ||
// const data = props.data; | ||
// this.setImageData(props); | ||
if (data instanceof Promise) { | ||
data.then(resolvedImageData => | ||
this.initialize( | ||
Object.assign({}, props, { | ||
pixels: resolvedImageData, | ||
data: resolvedImageData | ||
}) | ||
) | ||
); | ||
return this; | ||
} | ||
this.setImageData(props); | ||
this.setSampler(props.sampler); | ||
@@ -117,13 +110,13 @@ | ||
setImageData(options: {data?: any; width?: number; height?: number}) { | ||
copyExternalImage(options: CopyExternalImageOptions): {width: number; height: number} { | ||
this.trackDeallocatedMemory('Texture'); | ||
const {data} = options; | ||
const {image: data} = options; | ||
if (data && data.byteLength) { | ||
this.trackAllocatedMemory(data.byteLength, 'Texture'); | ||
} else { | ||
const bytesPerPixel = 4; | ||
this.trackAllocatedMemory(this.width * this.height * bytesPerPixel, 'Texture'); | ||
} | ||
// if (data && data.byteLength) { | ||
// this.trackAllocatedMemory(data.byteLength, 'Texture'); | ||
// } else { | ||
const bytesPerPixel = 4; | ||
this.trackAllocatedMemory(this.width * this.height * bytesPerPixel, 'Texture'); | ||
// } | ||
@@ -136,11 +129,4 @@ const width = options.width ?? (data as ImageBitmap).width; | ||
return this; | ||
return {width, height}; | ||
} | ||
setSubImageData(options: {data: any; width?: number; height?: number; x?: number; y?: number}) { | ||
// const {data, x = 0, y = 0} = options; | ||
// const width = options.width ?? (data as ImageBitmap).width; | ||
// const height = options.height ?? (data as ImageBitmap).height; | ||
// assert(width + x <= this.width && height + y <= this.height); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
276714
5132