@galacean/engine 0.0.0-experimental-1.4-small-language.0 → 0.0.0-experimental-1.4-small-language.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -6272,7 +6272,11 @@
6272
6272
  }
6273
6273
  if (width > 0 && height > 0 && data) {
6274
6274
  charInfo.bufferOffset = new Vector2(this._curX, this._curY);
6275
- texture.setPixelBuffer(data, 0, this._curX, this._curY, width, height);
6275
+ if (_instanceof1$2(data, Uint8Array)) {
6276
+ texture.setPixelBuffer(data, 0, this._curX, this._curY, width, height);
6277
+ } else {
6278
+ texture.setImageSource(data, 0, false, false, this._curX, this._curY);
6279
+ }
6276
6280
  texture.generateMipmaps();
6277
6281
  }
6278
6282
  var textureSizeReciprocal = 1.0 / textureSize;
@@ -6626,6 +6630,7 @@
6626
6630
  context.clearRect(0, 0, width, height);
6627
6631
  context.textBaseline = "middle";
6628
6632
  context.fillStyle = "#fff";
6633
+ context.lineJoin = 'round';
6629
6634
  if (actualBoundingBoxLeft > 0) {
6630
6635
  context.fillText(measureString, actualBoundingBoxLeft, baseline);
6631
6636
  } else {
@@ -6641,19 +6646,24 @@
6641
6646
  var size = 0;
6642
6647
  var integerW = canvas.width;
6643
6648
  var integerWReciprocal = 1.0 / integerW;
6644
- for(var i = 0; i < len; i += 4){
6645
- if (colorData[i + 3] !== 0) {
6646
- var idx = i * 0.25;
6647
- y = ~~(idx * integerWReciprocal);
6648
- if (top === -1) {
6649
- top = y;
6650
- }
6651
- if (y > bottom) {
6652
- bottom = y;
6649
+ if (this.useImageData) {
6650
+ for(var i = 0; i < len; i += 4){
6651
+ if (colorData[i + 3] !== 0) {
6652
+ var idx = i * 0.25;
6653
+ y = ~~(idx * integerWReciprocal);
6654
+ if (top === -1) {
6655
+ top = y;
6656
+ }
6657
+ if (y > bottom) {
6658
+ bottom = y;
6659
+ }
6660
+ } else {
6661
+ colorData[i] = colorData[i + 1] = colorData[i + 2] = 255;
6653
6662
  }
6654
- } else {
6655
- colorData[i] = colorData[i + 1] = colorData[i + 2] = 255;
6656
6663
  }
6664
+ } else {
6665
+ top = 0;
6666
+ bottom = height - 1;
6657
6667
  }
6658
6668
  if (top !== -1 && bottom !== -1) {
6659
6669
  ascent = baseline - top;
@@ -6664,9 +6674,13 @@
6664
6674
  if (isChar) {
6665
6675
  var data = null;
6666
6676
  if (size > 0) {
6667
- var lineIntegerW = integerW * 4;
6668
- // gl.texSubImage2D uploading data of type Uint8ClampedArray is not supported in some devices(eg: IphoneX IOS 13.6.1).
6669
- data = new Uint8Array(colorData.buffer, top * lineIntegerW, size * lineIntegerW);
6677
+ if (this.useImageData) {
6678
+ // gl.texSubImage2D uploading data of type Uint8ClampedArray is not supported in some devices(eg: IphoneX IOS 13.6.1).
6679
+ var lineIntegerW = integerW * 4;
6680
+ data = new Uint8Array(colorData.buffer, top * lineIntegerW, size * lineIntegerW);
6681
+ } else {
6682
+ data = canvas;
6683
+ }
6670
6684
  }
6671
6685
  return {
6672
6686
  char: measureString,
@@ -6729,6 +6743,7 @@
6729
6743
  "emoji",
6730
6744
  "fangsong"
6731
6745
  ];
6746
+ TextUtils.useImageData = true;
6732
6747
  // _extendHeight used to extend the height of canvas, because in miniprogram performance is different from h5.
6733
6748
  /** @internal */ TextUtils._extendHeight = 0;
6734
6749
  /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|ÉqÅ";
@@ -6830,7 +6845,11 @@
6830
6845
  var data = TextUtils.measureChar(charInfo.char, nativeFontString).data;
6831
6846
  if (charInfo.w > 0 && charInfo.h > 0 && data) {
6832
6847
  var bufferOffset = charInfo.bufferOffset;
6833
- texture.setPixelBuffer(data, 0, bufferOffset.x, bufferOffset.y, charInfo.w, charInfo.h);
6848
+ if (_instanceof1$2(data, Uint8Array)) {
6849
+ texture.setPixelBuffer(data, 0, bufferOffset.x, bufferOffset.y, charInfo.w, charInfo.h);
6850
+ } else {
6851
+ texture.setImageSource(data, 0, false, false, bufferOffset.x, bufferOffset.y);
6852
+ }
6834
6853
  }
6835
6854
  }
6836
6855
  texture.generateMipmaps();
@@ -50344,7 +50363,7 @@
50344
50363
  ], EXT_texture_webp);
50345
50364
 
50346
50365
  //@ts-ignore
50347
- var version = "0.0.0-experimental-1.4-small-language.0";
50366
+ var version = "0.0.0-experimental-1.4-small-language.2";
50348
50367
  console.log("Galacean Engine Version: " + version);
50349
50368
  for(var key in CoreObjects){
50350
50369
  Loader.registerClass(key, CoreObjects[key]);