mirror of
https://github.com/xdsopl/robot36.git
synced 2025-12-06 07:12:07 +01:00
update scope view immediately on orientation change
This commit is contained in:
parent
06d189ed15
commit
467d071712
|
|
@ -382,11 +382,14 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createScope(Configuration config) {
|
private void createScope(Configuration config) {
|
||||||
int scopeWidth = scopeBuffer.width;
|
int width = scopeBuffer.width;
|
||||||
int scopeHeight = scopeBuffer.height / 2;
|
int height = scopeBuffer.height / 2;
|
||||||
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE)
|
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE)
|
||||||
scopeHeight /= 2;
|
height /= 2;
|
||||||
scopeBitmap = Bitmap.createBitmap(scopeWidth, scopeHeight, Bitmap.Config.ARGB_8888);
|
scopeBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||||
|
int stride = scopeBuffer.width;
|
||||||
|
int offset = stride * (scopeBuffer.line + scopeBuffer.height / 2 - height);
|
||||||
|
scopeBitmap.setPixels(scopeBuffer.pixels, offset, stride, 0, 0, width, height);
|
||||||
scopeView.setImageBitmap(scopeBitmap);
|
scopeView.setImageBitmap(scopeBitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue