Commit c7e27e43 by Ludmány Balázs

Fix RGB byte order

parent 6d0e2fbc
......@@ -31,7 +31,7 @@ void Dispatcher::GotBitmap(rfbClient *client, const uint8_t *buffer, int x, int
{
Dispatcher *dispatcher = (Dispatcher *) rfbClientGetClientData(client, 0);
// We have to make a deep copy because libvnc might free the buffer as soon as this function returns
dispatcher->uploader()->gotBitmap(QByteArray((const char *) buffer, w * h * (dispatcher->bitsPerPixel() / 8)), x, y, w, h, GL_BGRA_EXT, GL_UNSIGNED_BYTE);
dispatcher->uploader()->gotBitmap(QByteArray((const char *) buffer, w * h * (dispatcher->bitsPerPixel() / 8)), x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE);
}
rfbBool Dispatcher::GotJpeg(rfbClient *client, const uint8_t *buffer, int length, int x, int y, int w, int h)
......@@ -77,7 +77,7 @@ QVector3D Dispatcher::colorMax() const
return QVector3D(m_client->format.redMax, m_client->format.greenMax, m_client->format.blueMax);
}
ConcurrentQueue<Jpeg *, 64u> *Dispatcher::queue()
ConcurrentQueue<Jpeg *, 256u> *Dispatcher::queue()
{
return &m_queue;
}
......
......@@ -39,12 +39,12 @@ public:
QVector3D colorMax() const;
// getters
ConcurrentQueue<Jpeg *, 64>* queue();
ConcurrentQueue<Jpeg *, 256u>* queue();
Uploader *uploader() const;
private:
rfbClient *m_client;
Uploader *m_uploader;
ConcurrentQueue<Jpeg*, 64> m_queue;
ConcurrentQueue<Jpeg*, 256u> m_queue;
signals:
// libvnc events
void gotCopy(const int src_x, const int src_y, const int width, const int height, const int dest_x, const int dest_y);
......
......@@ -2,7 +2,7 @@
JpegDecoder::JpegDecoder(ConcurrentQueue<Jpeg *, 64u> *queue, QObject *parent) :
JpegDecoder::JpegDecoder(ConcurrentQueue<Jpeg *, 256u> *queue, QObject *parent) :
QObject(parent), m_queue(queue)
{
}
......@@ -19,7 +19,6 @@ void JpegDecoder::operate()
jerr.mgr.error_exit = error_exit;
if (setjmp(jerr.setjmp_buffer)) {
jpeg_destroy_decompress(&cinfo);
return;
}
jpeg_create_decompress(&cinfo);
cinfo.do_fancy_upsampling = TRUE;
......
......@@ -37,8 +37,8 @@ class JpegDecoder : public QObject
{
Q_OBJECT
public:
JpegDecoder(ConcurrentQueue<Jpeg*, 64u> *queue, QObject *parent = 0);
ConcurrentQueue<Jpeg*, 64u> *m_queue;
JpegDecoder(ConcurrentQueue<Jpeg*, 256u> *queue, QObject *parent = 0);
ConcurrentQueue<Jpeg*, 256u> *m_queue;
signals:
void finished(const unsigned char *image, const int width, const int height, const int index);
public slots:
......
......@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
format.setMajorVersion(2);
format.setMinorVersion(0);
format.setRenderableType(QSurfaceFormat::OpenGLES);
format.setSwapBehavior(QSurfaceFormat::SingleBuffer);
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
format.setSwapInterval(0);
QSurfaceFormat::setDefaultFormat(format);
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES, true);
......
#ifndef VNC_H
#define VNC_H
#define DECODER_COUNT 64
#define DECODER_COUNT 16
#include <QQuickWindow>
#include <QObject>
......
......@@ -223,7 +223,14 @@ int Uploader::gotJpeg(const quint32 x, const quint32 y, const quint32 width, con
GLuint id;
m_functions->glGenTextures(1, &id);
m_functions->glBindTexture(GL_TEXTURE_2D, id);
#ifdef GL_RGB8
m_functions->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, real_width, real_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
#elif GL_RGB8_OES
m_functions->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8_OES, real_width, real_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
#else
m_functions->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, real_width, real_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
#endif
m_textures->append(id);
float bottom = (float) height / (float) real_height;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment