* Upload texture to GPU * 上传纹理到 GPU
()
| 351 | * 上传纹理到 GPU |
| 352 | */ |
| 353 | private uploadTexture(): void { |
| 354 | if (!this._dirty || !this._onTextureUpload || !this._dirtyRegion) return; |
| 355 | |
| 356 | const r = this._dirtyRegion; |
| 357 | const imageData = this._ctx.getImageData(r.x, r.y, r.width, r.height); |
| 358 | this._onTextureUpload(imageData, r.x, r.y, r.width, r.height); |
| 359 | |
| 360 | this._dirty = false; |
| 361 | this._dirtyRegion = null; |
| 362 | this.version++; |
| 363 | } |
| 364 | |
| 365 | /** |
| 366 | * Get full canvas image data (for initial upload) |