dirtyId -> version

This commit is contained in:
Daniel Imms
2022-11-23 08:51:06 -08:00
parent d4ee0309d9
commit 1880399849
5 changed files with 15 additions and 15 deletions
+6 -6
View File
@@ -61,7 +61,7 @@ export class TextureAtlas implements ITextureAtlas {
// The texture that the atlas is drawn to
private _pages: AtlasPage[] = [];
public get pages(): { canvas: HTMLCanvasElement, dirtyId: number }[] { return this._pages; }
public get pages(): { canvas: HTMLCanvasElement, version: number }[] { return this._pages; }
// The set of atlas pages that can be written to
private _activePages: AtlasPage[] = [];
@@ -179,7 +179,7 @@ export class TextureAtlas implements ITextureAtlas {
// Merge into the new page
const mergedPage = this._mergePages(mergingPages, mergedPageIndex);
mergedPage.dirtyId++;
mergedPage.version++;
// Replace the first _merging_ page with the _merged_ page
this._pages[mergedPageIndex] = mergedPage;
@@ -238,7 +238,7 @@ export class TextureAtlas implements ITextureAtlas {
for (const g of adjustingPage.glyphs) {
g.texturePage--;
}
adjustingPage.dirtyId++;
adjustingPage.version++;
}
}
@@ -826,7 +826,7 @@ export class TextureAtlas implements ITextureAtlas {
rasterizedGlyph.size.y
);
activePage.addGlyph(rasterizedGlyph);
activePage.dirtyId++;
activePage.version++;
return rasterizedGlyph;
}
@@ -938,7 +938,7 @@ class AtlasPage {
/**
* Used to check whether the canvas of the atlas page has changed.
*/
public dirtyId = 0;
public version = 0;
// Texture atlas current positioning data. The texture packing strategy used is to fill from
// left-to-right and top-to-bottom. When the glyph being written is less than half of the current
@@ -981,7 +981,7 @@ class AtlasPage {
this.currentRow.y = 0;
this.currentRow.height = 0;
this.fixedRows.length = 0;
this.dirtyId++;
this.version++;
}
}
+1 -1
View File
@@ -87,7 +87,7 @@ export interface IRenderer extends IDisposable {
}
export interface ITextureAtlas extends IDisposable {
readonly pages: { canvas: HTMLCanvasElement, dirtyId: number }[];
readonly pages: { canvas: HTMLCanvasElement, version: number }[];
onAddTextureAtlasCanvas: IEvent<HTMLCanvasElement>;
onRemoveTextureAtlasCanvas: IEvent<HTMLCanvasElement>;