Remove IGlyphIdentifier in-between object

This was being constructed for every character draw
This commit is contained in:
Daniel Imms
2018-09-14 09:58:49 -07:00
parent 5c873c1ce2
commit 04f2d52f26
6 changed files with 88 additions and 56 deletions
+15 -4
View File
@@ -3,8 +3,6 @@
* @license MIT
*/
import { IGlyphIdentifier } from './Types';
export default abstract class BaseCharAtlas {
private _didWarmUp: boolean = false;
@@ -39,14 +37,27 @@ export default abstract class BaseCharAtlas {
* do nothing and return false in that case.
*
* @param ctx Where to draw the character onto.
* @param glyph Information about what to draw
* @param chars The character(s) to draw. This is typically a single character bug can be made up
* of multiple when character joiners are used.
* @param code The character code.
* @param bg The background color.
* @param fg The foreground color.
* @param bold Whether the text is bold.
* @param dim Whether the text is dim.
* @param italic Whether the text is italic.
* @param x The position on the context to start drawing at
* @param y The position on the context to start drawing at
* @returns The success state. True if we drew the character.
*/
public abstract draw(
ctx: CanvasRenderingContext2D,
glyph: IGlyphIdentifier,
chars: string,
code: number,
bg: number,
fg: number,
bold: boolean,
dim: boolean,
italic: boolean,
x: number,
y: number
): boolean;