Font: optimization, add internal __fontPathWithoutDirectory variable, just for cpp/neko/nodejs, for avoiding lots of function calls in text rendering in openfl on those targets
This commit is contained in:
@@ -13,6 +13,10 @@ import js.html.CanvasElement;
|
|||||||
import js.html.CanvasRenderingContext2D;
|
import js.html.CanvasRenderingContext2D;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
#if (cpp || neko || nodejs)
|
||||||
|
import haxe.io.Path;
|
||||||
|
#end
|
||||||
|
|
||||||
#if !macro
|
#if !macro
|
||||||
@:build(lime.system.CFFI.build())
|
@:build(lime.system.CFFI.build())
|
||||||
#end
|
#end
|
||||||
@@ -38,7 +42,9 @@ class Font {
|
|||||||
public var unitsPerEM (get, null):Int;
|
public var unitsPerEM (get, null):Int;
|
||||||
|
|
||||||
@:noCompletion private var __fontPath:String;
|
@:noCompletion private var __fontPath:String;
|
||||||
|
#if (cpp || neko || nodejs)
|
||||||
|
@:noCompletion private var __fontPathWithoutDirectory:String;
|
||||||
|
#end
|
||||||
|
|
||||||
public function new (name:String = null) {
|
public function new (name:String = null) {
|
||||||
|
|
||||||
@@ -356,6 +362,8 @@ class Font {
|
|||||||
|
|
||||||
#if (cpp || neko || nodejs)
|
#if (cpp || neko || nodejs)
|
||||||
|
|
||||||
|
__fontPathWithoutDirectory = null;
|
||||||
|
|
||||||
src = lime_font_load (bytes);
|
src = lime_font_load (bytes);
|
||||||
|
|
||||||
if (src != null && name == null) {
|
if (src != null && name == null) {
|
||||||
@@ -375,6 +383,8 @@ class Font {
|
|||||||
|
|
||||||
#if (cpp || neko || nodejs)
|
#if (cpp || neko || nodejs)
|
||||||
|
|
||||||
|
__fontPathWithoutDirectory = Path.withoutDirectory (__fontPath);
|
||||||
|
|
||||||
src = lime_font_load (__fontPath);
|
src = lime_font_load (__fontPath);
|
||||||
|
|
||||||
if (src != null && name == null) {
|
if (src != null && name == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user