mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
Merge pull request #4717 from Bnyro/master
fix: crash when scrubbing timebar on certain videos
This commit is contained in:
commit
1d7fce91fb
@ -21,13 +21,12 @@ class OnlineTimeFrameReceiver(
|
|||||||
* Cut off a new bitmap from the image that contains multiple preview thumbnails
|
* Cut off a new bitmap from the image that contains multiple preview thumbnails
|
||||||
*/
|
*/
|
||||||
private fun cutBitmapFromPreviewFrame(bitmap: Bitmap, previewFrame: PreviewFrame): Bitmap {
|
private fun cutBitmapFromPreviewFrame(bitmap: Bitmap, previewFrame: PreviewFrame): Bitmap {
|
||||||
return Bitmap.createBitmap(
|
val positionX = previewFrame.positionX * previewFrame.frameWidth
|
||||||
bitmap,
|
val positionY = previewFrame.positionY * previewFrame.frameHeight
|
||||||
previewFrame.positionX * previewFrame.frameWidth,
|
val width = minOf(previewFrame.frameWidth, bitmap.width - positionX)
|
||||||
previewFrame.positionY * previewFrame.frameHeight,
|
val height = minOf(previewFrame.frameHeight, bitmap.height - positionY)
|
||||||
previewFrame.frameWidth,
|
|
||||||
previewFrame.frameHeight
|
return Bitmap.createBitmap(bitmap, positionX, positionY, width, height)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user