Render to BGRA instead of RGB format for better performance on most GPUs

This commit is contained in:
Jonas Herzig
2019-03-13 15:27:53 +01:00
parent 27efc3c717
commit 443c1ca2af
11 changed files with 30 additions and 51 deletions

View File

@@ -18,9 +18,9 @@ public class RGBFrame implements Frame {
private final ByteBuffer byteBuffer;
public RGBFrame(int frameId, ReadableDimension size, ByteBuffer byteBuffer) {
Validate.isTrue(size.getWidth() * size.getHeight() * 3 == byteBuffer.remaining(),
Validate.isTrue(size.getWidth() * size.getHeight() * 4 == byteBuffer.remaining(),
"Buffer size is %d (cap: %d) but should be %d",
byteBuffer.remaining(), byteBuffer.capacity(), size.getWidth() * size.getHeight() * 3);
byteBuffer.remaining(), byteBuffer.capacity(), size.getWidth() * size.getHeight() * 4);
this.frameId = frameId;
this.size = size;
this.byteBuffer = byteBuffer;