Compare commits

..

1 Commits

Author SHA1 Message Date
AncTe
43455b251f
Merge f9b6d8271e into 820dc5bf4c 2025-10-22 06:44:30 +00:00
2 changed files with 1 additions and 41 deletions

View File

@ -3,7 +3,6 @@ import {
IRect, IRect,
ITexture, ITexture,
ITextureAnimater, ITextureAnimater,
ITextureComposedData,
ITextureRenderable, ITextureRenderable,
ITextureSplitter, ITextureSplitter,
SizedCanvasImageSource SizedCanvasImageSource
@ -14,7 +13,6 @@ export class Texture<T = unknown, A = unknown> implements ITexture<T, A> {
animater: ITextureAnimater<T, A> | null = null; animater: ITextureAnimater<T, A> | null = null;
width: number; width: number;
height: number; height: number;
isBitmap: boolean = false;
/** 裁剪矩形的左边框位置 */ /** 裁剪矩形的左边框位置 */
private cl: number; private cl: number;
@ -61,18 +59,7 @@ export class Texture<T = unknown, A = unknown> implements ITexture<T, A> {
async toBitmap(): Promise<void> { async toBitmap(): Promise<void> {
if (this.source instanceof ImageBitmap) return; if (this.source instanceof ImageBitmap) return;
this.source = await createImageBitmap( this.source = await createImageBitmap(this.source);
this.source,
this.cl,
this.ct,
this.width,
this.height
);
this.cl = 0;
this.ct = 0;
this.cr = this.width;
this.cb = this.height;
this.isBitmap = true;
} }
split<U>(splitter: ITextureSplitter<U>, data: U): Generator<ITexture> { split<U>(splitter: ITextureSplitter<U>, data: U): Generator<ITexture> {
@ -123,23 +110,6 @@ export class Texture<T = unknown, A = unknown> implements ITexture<T, A> {
this.animater = null; this.animater = null;
} }
toAsset(asset: ITextureComposedData): boolean {
const rect = asset.assetMap.get(this);
if (!rect) return false;
if (this.isBitmap && this.source instanceof ImageBitmap) {
this.source.close();
}
this.isBitmap = false;
this.source = asset.texture.source;
this.cl = rect.x;
this.ct = rect.y;
this.width = rect.w;
this.height = rect.h;
this.cr = rect.x + rect.w;
this.cb = rect.y + rect.h;
return true;
}
/** /**
* *
* *

View File

@ -98,9 +98,6 @@ export interface ITexture<T = unknown, A = unknown> {
/** 贴图高度 */ /** 贴图高度 */
readonly height: number; readonly height: number;
/** 当前贴图是否是完整 bitmap 图像 */
readonly isBitmap: boolean;
/** /**
* bitmap ImageBitmap * bitmap ImageBitmap
*/ */
@ -154,13 +151,6 @@ export interface ITexture<T = unknown, A = unknown> {
* 使 * 使
*/ */
dispose(): void; dispose(): void;
/**
*
* @param asset
* @returns `false`
*/
toAsset(asset: ITextureComposedData): boolean;
} }
export interface ITextureStore { export interface ITextureStore {