sync code

Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IB3O7B?from=project-issue

Signed-off-by: 杨云飞 <yangyunfei19@h-partners.com>
This commit is contained in:
杨云飞 2024-11-19 16:37:42 +08:00
parent 0095d534b3
commit 5c87de6e69
9 changed files with 86 additions and 38 deletions

View File

@ -55,7 +55,6 @@ class VmThreadControl;
class GlobalEnvConstants;
enum class ElementsKind : uint8_t;
// NOTE: remove
class MachineCode;
using JitCodeVector = std::vector<std::tuple<MachineCode*, std::string, uintptr_t>>;
using JitCodeMapVisitor = std::function<void(std::map<JSTaggedType, JitCodeVector*>&)>;

View File

@ -281,8 +281,8 @@ void RuntimeStubs::CopyTypedArrayBuffer(JSTypedArray *srcArray, JSTypedArray *ta
}
JSTaggedValue srcBuffer = srcArray->GetViewedArrayBufferOrByteArray();
JSTaggedValue targetBuffer = targetArray->GetViewedArrayBufferOrByteArray();
uint32_t srcByteIndex = static_cast<uint32_t>(srcStartPos * elementSize + srcArray->GetByteOffset());
uint32_t targetByteIndex = static_cast<uint32_t>(tarStartPos * elementSize + targetArray->GetByteOffset());
uint32_t srcByteIndex = static_cast<uint32_t>(srcStartPos * elementSize) + srcArray->GetByteOffset();
uint32_t targetByteIndex = static_cast<uint32_t>(tarStartPos * elementSize) + targetArray->GetByteOffset();
uint8_t *srcBuf = (uint8_t *)builtins::BuiltinsArrayBuffer::GetDataPointFromBuffer(srcBuffer, srcByteIndex);
uint8_t *targetBuf = (uint8_t *)builtins::BuiltinsArrayBuffer::GetDataPointFromBuffer(targetBuffer,
targetByteIndex);

View File

@ -17,8 +17,8 @@ const { X2DFast } = require('../graphics/X2DFast');
class XScroll {
constructor(options) {
if (options['type']) {
this.type_ = options['type'];
if (options.type) {
this.type_ = options.type;
}
else {
this.type_ = 'right';

View File

@ -119,16 +119,36 @@ export class X2DFast {
static testTransform(x, y, sw, sh, ra, ox, oy, realw, realh) {
X2DFast.tmpMat.unit();
if (ox === -1) ox = 0;
if (ox === -2) ox = Math.floor(realw / 2);
if (ox === -3) ox = realw;
if (oy === -1) oy = 0;
if (oy === -2) oy = Math.floor(realh / 2);
if (oy === -3) oy = realh;
if (ox !== 0 || oy !== 0) X2DFast.tmpMat.move(-ox, -oy, 0);
if (sw !== 1 || sh !== 1) X2DFast.tmpMat.scale(sw, sh, 1);
if (ra !== 0) X2DFast.tmpMat.rotate(0, 0, ra);
if (x !== 0 || y !== 0) X2DFast.tmpMat.move(x, y, 0);
if (ox === -1) {
ox = 0;
}
if (ox === -2) {
ox = Math.floor(realw / 2);
}
if (ox === -3) {
ox = realw;
}
if (oy === -1) {
oy = 0;
}
if (oy === -2) {
oy = Math.floor(realh / 2);
}
if (oy === -3) {
oy = realh;
}
if (ox !== 0 || oy !== 0) {
X2DFast.tmpMat.move(-ox, -oy, 0);
}
if (sw !== 1 || sh !== 1) {
X2DFast.tmpMat.scale(sw, sh, 1);
}
if (ra !== 0) {
X2DFast.tmpMat.rotate(0, 0, ra);
}
if (x !== 0 || y !== 0) {
X2DFast.tmpMat.move(x, y, 0);
}
}
clearBuffer() {
this.ridDict = {};
@ -182,7 +202,9 @@ export class X2DFast {
let intX = parseInt(x);
let intY = parseInt(y);
let pcut = XTexture.gi().allCuts[cid];
if (pcut === null) return;
if (pcut === null) {
return;
}
if (!(pcut.rid in this.ridDict)) {
if (this.ridPoint >= 16) {
this.freshBuffer();
@ -208,7 +230,9 @@ export class X2DFast {
}
freshBuffer() {
XTexture.gi()._FreshText();
if (this.drawCount === 0) return;
if (this.drawCount === 0) {
return;
}
let ps = XShader.gi().use(XShader.ID_SHADER_FAST);
for (let rid in this.ridDict) {
gl.activeTexture(gl.TEXTURE0 + this.ridDict[rid]);

View File

@ -17,7 +17,9 @@ import { gl } from '../GLFrame.js';
export class XTexture {
static gi() {
if (XTexture.pinstance_ === null) XTexture.pinstance_ = new XTexture();
if (XTexture.pinstance_ === null) {
XTexture.pinstance_ = new XTexture();
}
return XTexture.pinstance_;
}
constructor() {
@ -103,10 +105,16 @@ export class XTexture {
}
}
TmpCut(rid, x = 0, y = 0, w = -1, h = -1, ww = 1024, hh = 1024) {
if (this.ximages[rid].stat !== 1) return -1;
if (this.ximages[rid].stat !== 1) {
return -1;
}
if (w === -1) w = ww;
if (h === -1) h = hh;
if (w === -1) {
w = ww;
}
if (h === -1) {
h = hh;
}
this.allCuts[this.tmpCutid] = {
rid: rid,
x: x,
@ -126,10 +134,18 @@ export class XTexture {
return this.tmpCutid - 1;
}
makeCut(rid, x = 0, y = 0, w = -1, h = -1, ww = -1, hh = -1) {
if (ww === -1) ww = this.ximages[rid].w;
if (hh === -1) hh = this.ximages[rid].h;
if (w ===-1) w = ww;
if (h === -1) h = hh;
if (ww === -1) {
ww = this.ximages[rid].w;
}
if (hh === -1) {
hh = this.ximages[rid].h;
}
if (w ===-1) {
w = ww;
}
if (h === -1) {
h = hh;
}
this.allCuts[this.aiCutid] = {
rid: rid,
x: x,
@ -198,7 +214,9 @@ export class XTexture {
h -= 1;
for (x = 0; x < 128; x++) {
let p = (h * 1024 + x) * 4;
if (imgd[p] !== 0) break;
if (imgd[p] !== 0) {
break;
}
}
}
let y = h;
@ -206,7 +224,9 @@ export class XTexture {
w -= 1;
for (y = 0; y < h; y++) {
let p = (y * 1024 + w) * 4;
if (imgd[p] !== 0) break;
if (imgd[p] !== 0) {
break;
}
}
}
return this.textCtx.getImageData(0, 0, w + 1, h + 1);

View File

@ -26,8 +26,8 @@ canvas.height = window.innerHeight;
function myDraw() {
if (
canvas.width != window.innerWidth - sideWidth ||
canvas.height != window.innerHeight
canvas.width !== window.innerWidth - sideWidth ||
canvas.height !== window.innerHeight
) {
canvas.width = window.innerWidth - sideWidth;
canvas.height = window.innerHeight;

View File

@ -715,6 +715,7 @@ class IrViewer {
}
return true;
}
return false;
}
checkDrapSelect_(msg, x, y) {
@ -732,6 +733,7 @@ class IrViewer {
}
return true;
}
return false;
}
checkSearchInput(msg, x, y) {
@ -759,7 +761,9 @@ class IrViewer {
}
return true;
}
return false;
}
return false;
}
checkMsg(msg, x, y) {
@ -790,6 +794,7 @@ class IrViewer {
}
this.selectPoint_ = [];
}
return false;
}
onTouch(msg, x, y) {