Skip to content

Commit 2ad4492

Browse files
committed
refactor: remove unnecessary .toInt() conversions in Uri and VideoPlayerState classes
Simplified code by removing redundant `.toInt()` calls for `rowBytes` and `path`, ensuring consistency and clarity across macOS and Linux platform implementations.
1 parent 1af5039 commit 2ad4492

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

mediaplayer/src/jvmMain/kotlin/io/github/kdroidfilter/composemediaplayer/linux/LinuxVideoPlayerState.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ class LinuxVideoPlayerState : VideoPlayerState {
505505

506506
// Native-to-native copy: frame buffer -> Skia bitmap pixels
507507
srcBuf.rewind()
508-
val destRowBytes = pixmap.rowBytes.toInt()
508+
val destRowBytes = pixmap.rowBytes
509509
val destSizeBytes = destRowBytes.toLong() * height.toLong()
510510
val destBuf =
511511
LinuxNativeBridge.nWrapPointer(pixelsAddr, destSizeBytes)

mediaplayer/src/jvmMain/kotlin/io/github/kdroidfilter/composemediaplayer/mac/MacVideoPlayerState.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ class MacVideoPlayerState : VideoPlayerState {
605605

606606
// Single copy: CVPixelBuffer → Skia bitmap pixels (no intermediate buffer)
607607
srcBuf.rewind()
608-
val dstRowBytes = pixmap.rowBytes.toInt()
608+
val dstRowBytes = pixmap.rowBytes
609609
val dstSizeBytes = dstRowBytes.toLong() * height.toLong()
610610
val destBuf =
611611
MacNativeBridge.nWrapPointer(pixelsAddr, dstSizeBytes)

mediaplayer/src/jvmMain/kotlin/io/github/kdroidfilter/composemediaplayer/util/Uri.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ package io.github.kdroidfilter.composemediaplayer.util
33
import io.github.vinceglb.filekit.PlatformFile
44
import io.github.vinceglb.filekit.path
55

6-
actual fun PlatformFile.getUri(): String = this.path.toString()
6+
actual fun PlatformFile.getUri(): String = this.path

0 commit comments

Comments
 (0)