fix(android): scale about the view pivot when capturing TextureView/SurfaceView content - #676
Open
Nodonisko wants to merge 1 commit into
Open
fix(android): scale about the view pivot when capturing TextureView/SurfaceView content#676Nodonisko wants to merge 1 commit into
Nodonisko wants to merge 1 commit into
Conversation
…urfaceView content Canvas.scale was applied about the canvas origin while rotation already uses the view's pivot, so captures of scaled TextureView/SurfaceView content came out anchored at the top-left corner instead of where they appear on screen. Pass the pivot to scale, matching how Android renders view scale. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018o7Mf9BAF9qMStB698ab1L
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Capturing a scaled TextureView/SurfaceView produces content at the correct size but anchored to the view's top-left corner instead of where it appears on screen. Cause: in
applyTransformationsthe canvas scale is applied about the canvas origin, while Android renders view scale about the view's pivot (default: center) and the rotation call one line above already passes the pivot. Fix: pass the pivot toCanvas.scale(and the mirroredMatrix.postScale). Verified on a device against a scaled TextureView.Minimal repro:
On screen the video appears scaled about its center; in the captured image it is scaled about the top-left corner.
Co-Authored-By: Claude noreply@anthropic.com
https://claude.ai/code/session_018o7Mf9BAF9qMStB698ab1L