diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-09-28 00:29:07 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-09-28 00:29:07 +0400 |
commit | 25509ba8afabddb4ec9be9b4ccb7b5cf89c9d851 (patch) | |
tree | 8baaef1a4c3d074e9862b8d84125f1273671ab36 /source/blender/editors/screen | |
parent | 7c2974411138c1028375693607f5da881125a96c (diff) |
Fix #36826: make screencast with quicktime output gave black flickering areas.
Problem was OpenGL buffer alpha channel, it's not used in most places and so
not set to any meaningful value while drawing.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/screendump.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 584d4cef133..40447a0106a 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -77,6 +77,18 @@ typedef struct ScreenshotData { ImageFormatData im_format; } ScreenshotData; +static void screenshot_read_pixels(int x, int y, int w, int h, unsigned char *rect) +{ + int i; + + glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect); + glFinish(); + + /* clear alpha, it is not set to a meaningful value in opengl */ + for (i = 0, rect += 3; i < w*h; i++, rect += 4) + *rect = 255; +} + /* get shot from frontbuffer */ static unsigned int *screenshot(bContext *C, int *dumpsx, int *dumpsy) { @@ -93,8 +105,7 @@ static unsigned int *screenshot(bContext *C, int *dumpsx, int *dumpsy) dumprect = MEM_mallocN(sizeof(int) * (*dumpsx) * (*dumpsy), "dumprect"); glReadBuffer(GL_FRONT); - glReadPixels(x, y, *dumpsx, *dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect); - glFinish(); + screenshot_read_pixels(x, y, *dumpsx, *dumpsy, (unsigned char*)dumprect); glReadBuffer(GL_BACK); } @@ -316,8 +327,7 @@ static void screenshot_updatejob(void *sjv) if (sj->dumprect == NULL) { dumprect = MEM_mallocN(sizeof(int) * sj->dumpsx * sj->dumpsy, "dumprect"); - glReadPixels(sj->x, sj->y, sj->dumpsx, sj->dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect); - glFinish(); + screenshot_read_pixels(sj->x, sj->y, sj->dumpsx, sj->dumpsy, (unsigned char*)dumprect); sj->dumprect = dumprect; } |