summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2017-01-23 06:51:39 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2017-01-23 06:51:39 +0200
commit0b709d9f39c4600f0e8947d8341dd264aee21e16 (patch)
treea47ab220793d94790f92b2a7c8795b2dfd36f15f
parentf51490356f70804c7cfb51e439312ec8aabc4330 (diff)
Unneccessary scoping
We don't have any temporary variables here.
-rw-r--r--glcapture.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/glcapture.c b/glcapture.c
index a1e2bf1..5717979 100644
--- a/glcapture.c
+++ b/glcapture.c
@@ -345,29 +345,27 @@ alsa_writei(snd_pcm_t *pcm, const void *buffer, const snd_pcm_uframes_t size, co
static void
capture_frame_pbo(struct gl *gl, const GLint view[4], const uint64_t ts)
{
- {
- if (!glIsBuffer(gl->pbo[gl->active].obj)) {
- WARNX("create pbo %u", gl->active);
- glGenBuffers(1, &gl->pbo[gl->active].obj);
- }
-
- glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo[gl->active].obj);
- glBufferData(GL_PIXEL_PACK_BUFFER, view[2] * view[3] * 3, NULL, GL_STREAM_READ);
-
- glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
- glPixelStorei(GL_PACK_ALIGNMENT, 1);
- glPixelStorei(GL_PACK_ROW_LENGTH, 0);
- glPixelStorei(GL_PACK_IMAGE_HEIGHT, 0);
- glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
- glReadPixels(view[0], view[1], view[2], view[3], GL_RGB, GL_UNSIGNED_BYTE, NULL);
- glPopClientAttrib();
-
- gl->pbo[gl->active].ts = ts;
- gl->pbo[gl->active].width = view[2];
- gl->pbo[gl->active].height = view[3];
- gl->pbo[gl->active].written = true;
+ if (!glIsBuffer(gl->pbo[gl->active].obj)) {
+ WARNX("create pbo %u", gl->active);
+ glGenBuffers(1, &gl->pbo[gl->active].obj);
}
+ glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo[gl->active].obj);
+ glBufferData(GL_PIXEL_PACK_BUFFER, view[2] * view[3] * 3, NULL, GL_STREAM_READ);
+
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
+ glPixelStorei(GL_PACK_ALIGNMENT, 1);
+ glPixelStorei(GL_PACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_PACK_IMAGE_HEIGHT, 0);
+ glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
+ glReadPixels(view[0], view[1], view[2], view[3], GL_RGB, GL_UNSIGNED_BYTE, NULL);
+ glPopClientAttrib();
+
+ gl->pbo[gl->active].ts = ts;
+ gl->pbo[gl->active].width = view[2];
+ gl->pbo[gl->active].height = view[3];
+ gl->pbo[gl->active].written = true;
+
gl->active = (gl->active + 1) % NUM_PBOS;
if (glIsBuffer(gl->pbo[gl->active].obj) && gl->pbo[gl->active].written) {