fixed linesize regression when exporting, fixes #447
This commit is contained in:
+17
-3
@@ -193,9 +193,22 @@ void RenderThread::paint() {
|
||||
}
|
||||
|
||||
if (pixel_buffer != nullptr) {
|
||||
ctx->functions()->glBindFramebuffer(GL_READ_FRAMEBUFFER, front_buffer);
|
||||
glReadPixels(0, 0, tex_width, tex_height, GL_RGBA, GL_UNSIGNED_BYTE, pixel_buffer);
|
||||
|
||||
// set main framebuffer to the current read buffer
|
||||
ctx->functions()->glBindFramebuffer(GL_READ_FRAMEBUFFER, front_buffer);
|
||||
|
||||
// store pixels in buffer
|
||||
glReadPixels(0,
|
||||
0,
|
||||
pixel_buffer_linesize == 0 ? tex_width : pixel_buffer_linesize,
|
||||
tex_height,
|
||||
GL_RGBA,
|
||||
GL_UNSIGNED_BYTE,
|
||||
pixel_buffer);
|
||||
|
||||
// release current read buffer
|
||||
ctx->functions()->glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
|
||||
pixel_buffer = nullptr;
|
||||
}
|
||||
|
||||
@@ -204,7 +217,7 @@ void RenderThread::paint() {
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void RenderThread::start_render(QOpenGLContext *share, Sequence *s, const QString& save, GLvoid* pixels, int idivider) {
|
||||
void RenderThread::start_render(QOpenGLContext *share, Sequence *s, const QString& save, GLvoid* pixels, int pixel_linesize, int idivider) {
|
||||
seq = s;
|
||||
|
||||
// stall any dependent actions
|
||||
@@ -222,6 +235,7 @@ void RenderThread::start_render(QOpenGLContext *share, Sequence *s, const QStrin
|
||||
|
||||
save_fn = save;
|
||||
pixel_buffer = pixels;
|
||||
pixel_buffer_linesize = pixel_linesize;
|
||||
|
||||
queued = true;
|
||||
|
||||
|
||||
+2
-1
@@ -23,7 +23,7 @@ public:
|
||||
GLuint front_texture;
|
||||
Effect* gizmos;
|
||||
void paint();
|
||||
void start_render(QOpenGLContext* share, Sequence* s, const QString &save = nullptr, GLvoid *pixels = nullptr, int idivider = 0);
|
||||
void start_render(QOpenGLContext* share, Sequence* s, const QString &save = nullptr, GLvoid *pixels = nullptr, int pixel_linesize = 0, int idivider = 0);
|
||||
bool did_texture_fail();
|
||||
void cancel();
|
||||
|
||||
@@ -59,6 +59,7 @@ private:
|
||||
bool running;
|
||||
QString save_fn;
|
||||
GLvoid *pixel_buffer;
|
||||
int pixel_buffer_linesize;
|
||||
};
|
||||
|
||||
#endif // RENDERTHREAD_H
|
||||
|
||||
Reference in New Issue
Block a user