@blotch/angular-lynx-native 22.3.1 → 22.3.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/README.md +41 -15
- package/dist/android/project.d.ts +90 -1
- package/dist/android/project.d.ts.map +1 -1
- package/dist/android/project.js +369 -5
- package/dist/eject.d.ts +15 -1
- package/dist/eject.d.ts.map +1 -1
- package/dist/eject.js +13 -2
- package/dist/features.d.ts +70 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/features.js +115 -0
- package/dist/generate.d.ts +17 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +12 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/ios/build.d.ts.map +1 -1
- package/dist/ios/build.js +8 -2
- package/dist/ios/frameworks.d.ts +6 -5
- package/dist/ios/frameworks.d.ts.map +1 -1
- package/dist/ios/frameworks.js +46 -15
- package/dist/ios/project.d.ts +173 -11
- package/dist/ios/project.d.ts.map +1 -1
- package/dist/ios/project.js +767 -33
- package/dist/options.d.ts +140 -1
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +127 -0
- package/dist/permissions.d.ts +18 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +63 -3
- package/package.json +1 -1
- package/templates/android/README.md +35 -2
- package/templates/android/angular-lynx.properties +2 -0
- package/templates/android/app/build.gradle.kts +51 -2
- package/templates/android/app/src/main/AndroidManifest.xml +14 -3
- package/templates/android/app/src/main/java/dev/angularlynx/shell/BarcodeScannerModule.kt +144 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/BiometricsModule.kt +433 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/BitmapPresenter.kt +98 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/BitmapRendererContext.kt +175 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/BluetoothModule.kt +1288 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/CalendarModule.kt +127 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/Canvas2DContext.kt +1557 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/Canvas2DOps.kt +63 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/CanvasFilter.kt +357 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/CanvasUI.kt +4 -3
- package/templates/android/app/src/main/java/dev/angularlynx/shell/FilePickerModule.kt +263 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/HapticsModule.kt +82 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/MainActivity.kt +376 -6
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ModuleBytes.kt +58 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/MotionModule.kt +332 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/NfcModule.kt +274 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/PermissionRequests.kt +25 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/PhotoLibraryModule.kt +168 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ShareTargetModule.kt +234 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ShellApplication.kt +6 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ShellModule.kt +47 -3
- package/templates/android/app/src/main/java/dev/angularlynx/shell/StoreReviewModule.kt +66 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/SystemFontFamilies.kt +68 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/TrackingModule.kt +74 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/VideoFrameTarget.kt +429 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/VideoUI.kt +676 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLContext.kt +128 -13
- package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLModule.kt +493 -65
- package/templates/android/app/src/main/java/dev/angularlynx/shell/WifiModule.kt +429 -0
- package/templates/android/app/src/main/res/values/biometrics.xml +9 -0
- package/templates/android/app/src/main/res/values/share_target.xml +11 -0
- package/templates/android/app/src/main/res/xml/backup_rules.xml +5 -3
- package/templates/android/app/src/main/res/xml/data_extraction_rules.xml +6 -3
- package/templates/android/build.gradle.kts +1 -1
- package/templates/android/gradle/wrapper/gradle-wrapper.properties +2 -2
- package/templates/ios/App/AngularLynxBitmapRendererContext.m +188 -0
- package/templates/ios/App/AngularLynxCanvas2DContext.m +2467 -0
- package/templates/ios/App/AngularLynxCanvas2DOps.h +61 -0
- package/templates/ios/App/AngularLynxVideo.h +37 -0
- package/templates/ios/App/AngularLynxVideo.m +435 -0
- package/templates/ios/App/AngularLynxWebGL.h +69 -7
- package/templates/ios/App/AngularLynxWebGL.m +538 -29
- package/templates/ios/App/AngularLynxWebGLContext.m +148 -46
- package/templates/ios/App/AppDelegate.swift +34 -2
- package/templates/ios/App/AppleSignInButton.swift +106 -0
- package/templates/ios/App/AppleSignInModule.swift +222 -0
- package/templates/ios/App/BarcodeScannerModule.swift +284 -0
- package/templates/ios/App/BiometricsModule.swift +256 -0
- package/templates/ios/App/BluetoothModule.swift +1086 -0
- package/templates/ios/App/CalendarModule.swift +158 -0
- package/templates/ios/App/FilePickerModule.swift +240 -0
- package/templates/ios/App/HapticsModule.swift +90 -0
- package/templates/ios/App/Info.plist +2 -0
- package/templates/ios/App/LynxViewController.swift +210 -6
- package/templates/ios/App/MotionModule.swift +430 -0
- package/templates/ios/App/NfcModule.swift +346 -0
- package/templates/ios/App/PhotoLibraryModule.swift +169 -0
- package/templates/ios/App/ShareTargetModule.swift +150 -0
- package/templates/ios/App/ShellModule.swift +17 -0
- package/templates/ios/App/StoreReviewModule.swift +61 -0
- package/templates/ios/App/TrackingModule.swift +121 -0
- package/templates/ios/App/WifiModule.swift +237 -0
- package/templates/ios/App/XElementRegistry.swift +13 -3
- package/templates/ios/ShareExtension/Info.plist +42 -0
- package/templates/ios/ShareExtension/ShareViewController.swift +387 -0
|
@@ -41,7 +41,7 @@ private const val EGL_OPENGL_ES3_BIT = 0x40
|
|
|
41
41
|
* making two at once. The UI thread waits for a batch only when the surface
|
|
42
42
|
* comes, goes or resizes.
|
|
43
43
|
*/
|
|
44
|
-
class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
44
|
+
class WebGLContext(override val canvasId: String, attributes: ReadableMap?) : CanvasContext {
|
|
45
45
|
private val display: EGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY)
|
|
46
46
|
private val config: EGLConfig
|
|
47
47
|
private var context: EGLContext
|
|
@@ -54,6 +54,7 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
54
54
|
private val depth = attributes.flag("depth", true)
|
|
55
55
|
private val stencil = attributes.flag("stencil", false)
|
|
56
56
|
private val preserveDrawingBuffer = attributes.flag("preserveDrawingBuffer", false)
|
|
57
|
+
private val premultipliedAlpha = attributes.flag("premultipliedAlpha", true)
|
|
57
58
|
private var samples = 0
|
|
58
59
|
|
|
59
60
|
// The default framebuffer, multisampled when antialias is on, and the
|
|
@@ -174,7 +175,7 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
174
175
|
// --- The view ------------------------------------------------------------
|
|
175
176
|
|
|
176
177
|
@Synchronized
|
|
177
|
-
fun attachView(canvas: CanvasUI?) {
|
|
178
|
+
override fun attachView(canvas: CanvasUI?) {
|
|
178
179
|
if (view === canvas) return
|
|
179
180
|
view = canvas
|
|
180
181
|
canvas?.setOpaque(!alpha)
|
|
@@ -183,7 +184,7 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
183
184
|
|
|
184
185
|
/** The view's surface came, went or changed size. */
|
|
185
186
|
@Synchronized
|
|
186
|
-
fun surfaceChanged() {
|
|
187
|
+
override fun surfaceChanged() {
|
|
187
188
|
if (destroyed) return
|
|
188
189
|
val texture = view?.surface
|
|
189
190
|
if (texture !== windowTexture) {
|
|
@@ -279,6 +280,11 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
279
280
|
val discard = GLES30.glIsEnabled(GLES30.GL_RASTERIZER_DISCARD)
|
|
280
281
|
|
|
281
282
|
GLES30.glBindFramebuffer(GLES30.GL_DRAW_FRAMEBUFFER, framebuffer)
|
|
283
|
+
// The app may have drawn to no color buffer (drawBuffers([NONE]) on
|
|
284
|
+
// the default framebuffer), which glClear would then skip: the color
|
|
285
|
+
// attachment is selected for the clear, and the app's choice put back.
|
|
286
|
+
val drawBuffer = IntArray(1).also { GLES30.glGetIntegerv(GLES30.GL_DRAW_BUFFER0, it, 0) }
|
|
287
|
+
GLES30.glDrawBuffers(1, intArrayOf(GLES30.GL_COLOR_ATTACHMENT0), 0)
|
|
282
288
|
GLES30.glDisable(GLES30.GL_SCISSOR_TEST)
|
|
283
289
|
GLES30.glDisable(GLES30.GL_RASTERIZER_DISCARD)
|
|
284
290
|
GLES30.glClearColor(0f, 0f, 0f, 0f)
|
|
@@ -289,6 +295,7 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
289
295
|
GLES30.glStencilMask(-1)
|
|
290
296
|
GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT or GLES30.GL_DEPTH_BUFFER_BIT or GLES30.GL_STENCIL_BUFFER_BIT)
|
|
291
297
|
|
|
298
|
+
GLES30.glDrawBuffers(1, drawBuffer, 0)
|
|
292
299
|
GLES30.glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3])
|
|
293
300
|
GLES30.glClearDepthf(clearDepth[0])
|
|
294
301
|
GLES30.glClearStencil(ints[0])
|
|
@@ -361,6 +368,11 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
361
368
|
GLES30.glPixelStorei(GLES30.GL_PACK_ROW_LENGTH, 0)
|
|
362
369
|
GLES30.glPixelStorei(GLES30.GL_PACK_SKIP_PIXELS, 0)
|
|
363
370
|
GLES30.glPixelStorei(GLES30.GL_PACK_SKIP_ROWS, 0)
|
|
371
|
+
// Its color is read whatever the app selected to read (NONE, say),
|
|
372
|
+
// and the selection is put back after.
|
|
373
|
+
GLES30.glBindFramebuffer(GLES30.GL_READ_FRAMEBUFFER, framebuffer)
|
|
374
|
+
val readBuffer = IntArray(1).also { GLES30.glGetIntegerv(GLES30.GL_READ_BUFFER, it, 0) }[0]
|
|
375
|
+
GLES30.glReadBuffer(GLES30.GL_COLOR_ATTACHMENT0)
|
|
364
376
|
var source = framebuffer
|
|
365
377
|
if (samples > 0) {
|
|
366
378
|
// GLES can't read a multisampled framebuffer: its samples are
|
|
@@ -381,6 +393,8 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
381
393
|
GLES30.glBindFramebuffer(GLES30.GL_READ_FRAMEBUFFER, source)
|
|
382
394
|
GLES30.glReadBuffer(GLES30.GL_COLOR_ATTACHMENT0)
|
|
383
395
|
GLES30.glReadPixels(0, 0, width, height, GLES30.GL_RGBA, GLES30.GL_UNSIGNED_BYTE, pixels)
|
|
396
|
+
GLES30.glBindFramebuffer(GLES30.GL_READ_FRAMEBUFFER, framebuffer)
|
|
397
|
+
GLES30.glReadBuffer(readBuffer)
|
|
384
398
|
GLES30.glBindBuffer(GLES30.GL_PIXEL_PACK_BUFFER, pack[0])
|
|
385
399
|
GLES30.glPixelStorei(GLES30.GL_PACK_ALIGNMENT, pack[1])
|
|
386
400
|
GLES30.glPixelStorei(GLES30.GL_PACK_ROW_LENGTH, pack[2])
|
|
@@ -392,6 +406,31 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
392
406
|
return DrawingBufferPixels(pixels, width, height, alpha)
|
|
393
407
|
}
|
|
394
408
|
|
|
409
|
+
/**
|
|
410
|
+
* The drawing buffer's pixels now, rows top to bottom, for another
|
|
411
|
+
* context to read: drawn on a 2D canvas or uploaded as a texture.
|
|
412
|
+
*/
|
|
413
|
+
override fun snapshot(): DecodedImage? {
|
|
414
|
+
val pixels = readDrawingBuffer() ?: return null
|
|
415
|
+
// GL's first row is the bottom of the image.
|
|
416
|
+
flipRows(pixels.rgba, pixels.width * 4, pixels.height)
|
|
417
|
+
return DecodedImage(pixels.rgba, pixels.width, pixels.height, premultipliedAlpha || !alpha)
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* After transferToImageBitmap() took the drawing buffer, it's cleared,
|
|
422
|
+
* even with preserveDrawingBuffer: the HTML spec gives the canvas a new
|
|
423
|
+
* bitmap, and says preserveDrawingBuffer has no effect on a transfer.
|
|
424
|
+
*/
|
|
425
|
+
@Synchronized
|
|
426
|
+
override fun clearForTransfer() {
|
|
427
|
+
if (destroyed) return
|
|
428
|
+
withCurrent {
|
|
429
|
+
clearDrawingBuffer()
|
|
430
|
+
restoreFramebuffers()
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
395
434
|
/**
|
|
396
435
|
* Shows the finished frame: copies the default framebuffer (resolving it
|
|
397
436
|
* when it's multisampled) into the TextureView's surface, scaled to its
|
|
@@ -487,15 +526,40 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
487
526
|
* into the bound PIXEL_UNPACK_BUFFER, bytes, or a decoded image converted
|
|
488
527
|
* to the format and type.
|
|
489
528
|
*/
|
|
490
|
-
private fun pixels(reader: Reader, format: Int, type: Int): Pixels {
|
|
529
|
+
private fun pixels(reader: Reader, format: Int, type: Int, width: Int, height: Int): Pixels {
|
|
491
530
|
return when (reader.peekType()) {
|
|
492
531
|
ReadableType.Array -> Pixels(bytesFromWords(reader.array()), 0, false)
|
|
493
532
|
ReadableType.Map -> {
|
|
494
533
|
val source = reader.map()
|
|
495
|
-
val
|
|
496
|
-
|
|
534
|
+
val canvasId = if (source.hasKey("canvas") && source.getType("canvas") == ReadableType.String) {
|
|
535
|
+
source.getString("canvas")
|
|
536
|
+
} else {
|
|
537
|
+
null
|
|
538
|
+
}
|
|
539
|
+
val image = if (canvasId != null) {
|
|
540
|
+
// A canvas's pixels, which its context reads now: a 2D
|
|
541
|
+
// canvas's bitmap, or a WebGL canvas's drawing buffer
|
|
542
|
+
// (that context makes itself current and puts this one
|
|
543
|
+
// back). A canvas with no pixels to read, one the app
|
|
544
|
+
// never drew on, is transparent black, as in a browser,
|
|
545
|
+
// already the size the upload names.
|
|
546
|
+
val snapshot = if (canvasId == this.canvasId) snapshot() else CanvasRegistry.context(canvasId)?.snapshot()
|
|
547
|
+
if (snapshot == null) {
|
|
548
|
+
DecodedImage(
|
|
549
|
+
ByteBuffer.allocateDirect(width * height * 4).order(ByteOrder.nativeOrder()),
|
|
550
|
+
width,
|
|
551
|
+
height,
|
|
552
|
+
true,
|
|
553
|
+
)
|
|
554
|
+
} else {
|
|
555
|
+
cropped(snapshot, width, height, source.bool("flipY")) ?: return Pixels(null, 0, false)
|
|
556
|
+
}
|
|
557
|
+
} else {
|
|
558
|
+
val decoded = DecodedImages.get(source.getDouble("image").toInt()) ?: return Pixels(null, 0, false)
|
|
559
|
+
cropped(decoded, width, height, source.bool("flipY")) ?: return Pixels(null, 0, false)
|
|
560
|
+
}
|
|
497
561
|
Pixels(
|
|
498
|
-
convertImage(image, format, type, source.bool("flipY"), source.bool("premultiply")),
|
|
562
|
+
convertImage(image, format, type, source.bool("flipY"), source.bool("premultiply"), canvasId != null),
|
|
499
563
|
0,
|
|
500
564
|
true,
|
|
501
565
|
)
|
|
@@ -508,6 +572,40 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
508
572
|
}
|
|
509
573
|
}
|
|
510
574
|
|
|
575
|
+
/**
|
|
576
|
+
* The part of an image an upload of `width` by `height` takes: from
|
|
577
|
+
* UNPACK_SKIP_PIXELS and UNPACK_SKIP_ROWS, counted in the image as
|
|
578
|
+
* UNPACK_FLIP_Y_WEBGL leaves it, as WebGL2 reads a sub-rectangle of an
|
|
579
|
+
* image source. The whole image for a plain upload; null for a rectangle
|
|
580
|
+
* outside it.
|
|
581
|
+
*/
|
|
582
|
+
private fun cropped(image: DecodedImage, width: Int, height: Int, flipY: Boolean): DecodedImage? {
|
|
583
|
+
val skip = IntArray(2)
|
|
584
|
+
GLES30.glGetIntegerv(GLES30.GL_UNPACK_SKIP_PIXELS, skip, 0)
|
|
585
|
+
GLES30.glGetIntegerv(GLES30.GL_UNPACK_SKIP_ROWS, skip, 1)
|
|
586
|
+
val x = skip[0]
|
|
587
|
+
if (x == 0 && skip[1] == 0 && width == image.width && height == image.height) return image
|
|
588
|
+
// In Long, so a skip near Int.MAX_VALUE can't wrap round past the check.
|
|
589
|
+
if (width <= 0 || height <= 0 || x < 0 || skip[1] < 0 ||
|
|
590
|
+
x.toLong() + width > image.width || skip[1].toLong() + height > image.height
|
|
591
|
+
) {
|
|
592
|
+
return null
|
|
593
|
+
}
|
|
594
|
+
// Rows counted from the top of the flipped image are counted from the
|
|
595
|
+
// bottom of the image as it is, which convertImage then flips.
|
|
596
|
+
val y = if (flipY) image.height - skip[1] - height else skip[1]
|
|
597
|
+
val out = ByteBuffer.allocateDirect(width * height * 4).order(ByteOrder.nativeOrder())
|
|
598
|
+
val row = ByteArray(width * 4)
|
|
599
|
+
for (r in 0 until height) {
|
|
600
|
+
val from = image.pixels.duplicate()
|
|
601
|
+
from.position(((y + r) * image.width + x) * 4)
|
|
602
|
+
from.get(row)
|
|
603
|
+
out.put(row)
|
|
604
|
+
}
|
|
605
|
+
out.rewind()
|
|
606
|
+
return DecodedImage(out, width, height, image.premultiplied)
|
|
607
|
+
}
|
|
608
|
+
|
|
511
609
|
private fun ReadableMap.bool(key: String): Boolean =
|
|
512
610
|
hasKey(key) && when (getType(key)) {
|
|
513
611
|
ReadableType.Boolean -> getBoolean(key)
|
|
@@ -515,8 +613,20 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
515
613
|
else -> false
|
|
516
614
|
}
|
|
517
615
|
|
|
518
|
-
/**
|
|
519
|
-
|
|
616
|
+
/**
|
|
617
|
+
* A decoded image's RGBA bytes as the format and type an upload names,
|
|
618
|
+
* tightly packed, flipped and premultiplied as asked. A canvas's pixels,
|
|
619
|
+
* premultiplied, are divided back when the upload doesn't premultiply, as
|
|
620
|
+
* WebGL uploads a canvas; an ImageBitmap's are uploaded as it was decoded.
|
|
621
|
+
*/
|
|
622
|
+
private fun convertImage(
|
|
623
|
+
image: DecodedImage,
|
|
624
|
+
format: Int,
|
|
625
|
+
type: Int,
|
|
626
|
+
flipY: Boolean,
|
|
627
|
+
premultiply: Boolean,
|
|
628
|
+
fromCanvas: Boolean = false,
|
|
629
|
+
): ByteBuffer {
|
|
520
630
|
val components = when (format) {
|
|
521
631
|
GLES30.GL_RGBA, GLES30.GL_RGBA_INTEGER -> 4
|
|
522
632
|
GLES30.GL_RGB, GLES30.GL_RGB_INTEGER -> 3
|
|
@@ -534,6 +644,7 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
534
644
|
val out = ByteBuffer.allocateDirect(image.width * image.height * pixelSize).order(ByteOrder.nativeOrder())
|
|
535
645
|
val rgba = image.pixels
|
|
536
646
|
val multiply = premultiply && !image.premultiplied
|
|
647
|
+
val divide = fromCanvas && !premultiply && image.premultiplied
|
|
537
648
|
val channels = FloatArray(4)
|
|
538
649
|
for (y in 0 until image.height) {
|
|
539
650
|
val row = (if (flipY) image.height - 1 - y else y) * image.width * 4
|
|
@@ -547,6 +658,10 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
547
658
|
r = r * a / 255
|
|
548
659
|
g = g * a / 255
|
|
549
660
|
b = b * a / 255
|
|
661
|
+
} else if (divide && a > 0 && a < 255) {
|
|
662
|
+
r = minOf(255f, r * 255 / a)
|
|
663
|
+
g = minOf(255f, g * 255 / a)
|
|
664
|
+
b = minOf(255f, b * 255 / a)
|
|
550
665
|
}
|
|
551
666
|
when (format) {
|
|
552
667
|
GLES30.GL_LUMINANCE -> channels[0] = r
|
|
@@ -1008,7 +1123,7 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
1008
1123
|
val target = r.int(); val level = r.int(); val internalformat = r.int()
|
|
1009
1124
|
val width = r.int(); val height = r.int(); val border = r.int()
|
|
1010
1125
|
val format = r.int(); val type = r.int()
|
|
1011
|
-
val pixels = pixels(r, format, type)
|
|
1126
|
+
val pixels = pixels(r, format, type, width, height)
|
|
1012
1127
|
withTightUnpacking(pixels.isImage) {
|
|
1013
1128
|
if (pixels.buffer == null && pixels.offset != 0) {
|
|
1014
1129
|
Log.w(TAG, "texImage2D from a PIXEL_UNPACK_BUFFER is not supported on Android")
|
|
@@ -1021,7 +1136,7 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
1021
1136
|
val target = r.int(); val level = r.int(); val internalformat = r.int()
|
|
1022
1137
|
val width = r.int(); val height = r.int(); val depth = r.int(); val border = r.int()
|
|
1023
1138
|
val format = r.int(); val type = r.int()
|
|
1024
|
-
val pixels = pixels(r, format, type)
|
|
1139
|
+
val pixels = pixels(r, format, type, width, height)
|
|
1025
1140
|
withTightUnpacking(pixels.isImage) {
|
|
1026
1141
|
if (pixels.buffer == null && pixels.offset != 0) {
|
|
1027
1142
|
GLES30.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels.offset)
|
|
@@ -1037,7 +1152,7 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
1037
1152
|
WebGLOps.TEX_SUB_IMAGE2D -> {
|
|
1038
1153
|
val target = r.int(); val level = r.int(); val x = r.int(); val y = r.int()
|
|
1039
1154
|
val width = r.int(); val height = r.int(); val format = r.int(); val type = r.int()
|
|
1040
|
-
val pixels = pixels(r, format, type)
|
|
1155
|
+
val pixels = pixels(r, format, type, width, height)
|
|
1041
1156
|
withTightUnpacking(pixels.isImage) {
|
|
1042
1157
|
if (pixels.buffer == null) {
|
|
1043
1158
|
Log.w(TAG, "texSubImage2D from a PIXEL_UNPACK_BUFFER is not supported on Android")
|
|
@@ -1049,7 +1164,7 @@ class WebGLContext(val canvasId: String, attributes: ReadableMap?) {
|
|
|
1049
1164
|
WebGLOps.TEX_SUB_IMAGE3D -> {
|
|
1050
1165
|
val target = r.int(); val level = r.int(); val x = r.int(); val y = r.int(); val z = r.int()
|
|
1051
1166
|
val width = r.int(); val height = r.int(); val depth = r.int(); val format = r.int(); val type = r.int()
|
|
1052
|
-
val pixels = pixels(r, format, type)
|
|
1167
|
+
val pixels = pixels(r, format, type, width, height)
|
|
1053
1168
|
withTightUnpacking(pixels.isImage) {
|
|
1054
1169
|
if (pixels.buffer == null) {
|
|
1055
1170
|
GLES30.glTexSubImage3D(target, level, x, y, z, width, height, depth, format, type, pixels.offset)
|