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 ...@@ -31,7 +31,7 @@ void Dispatcher::GotBitmap(rfbClient *client, const uint8_t *buffer, int x, int
{ {
Dispatcher *dispatcher = (Dispatcher *) rfbClientGetClientData(client, 0); 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 // 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) 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 ...@@ -77,7 +77,7 @@ QVector3D Dispatcher::colorMax() const
return QVector3D(m_client->format.redMax, m_client->format.greenMax, m_client->format.blueMax); 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; return &m_queue;
} }
......
...@@ -39,12 +39,12 @@ public: ...@@ -39,12 +39,12 @@ public:
QVector3D colorMax() const; QVector3D colorMax() const;
// getters // getters
ConcurrentQueue<Jpeg *, 64>* queue(); ConcurrentQueue<Jpeg *, 256u>* queue();
Uploader *uploader() const; Uploader *uploader() const;
private: private:
rfbClient *m_client; rfbClient *m_client;
Uploader *m_uploader; Uploader *m_uploader;
ConcurrentQueue<Jpeg*, 64> m_queue; ConcurrentQueue<Jpeg*, 256u> m_queue;
signals: signals:
// libvnc events // 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); 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 @@ ...@@ -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) QObject(parent), m_queue(queue)
{ {
} }
...@@ -19,7 +19,6 @@ void JpegDecoder::operate() ...@@ -19,7 +19,6 @@ void JpegDecoder::operate()
jerr.mgr.error_exit = error_exit; jerr.mgr.error_exit = error_exit;
if (setjmp(jerr.setjmp_buffer)) { if (setjmp(jerr.setjmp_buffer)) {
jpeg_destroy_decompress(&cinfo); jpeg_destroy_decompress(&cinfo);
return;
} }
jpeg_create_decompress(&cinfo); jpeg_create_decompress(&cinfo);
cinfo.do_fancy_upsampling = TRUE; cinfo.do_fancy_upsampling = TRUE;
......
...@@ -37,8 +37,8 @@ class JpegDecoder : public QObject ...@@ -37,8 +37,8 @@ class JpegDecoder : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
JpegDecoder(ConcurrentQueue<Jpeg*, 64u> *queue, QObject *parent = 0); JpegDecoder(ConcurrentQueue<Jpeg*, 256u> *queue, QObject *parent = 0);
ConcurrentQueue<Jpeg*, 64u> *m_queue; ConcurrentQueue<Jpeg*, 256u> *m_queue;
signals: signals:
void finished(const unsigned char *image, const int width, const int height, const int index); void finished(const unsigned char *image, const int width, const int height, const int index);
public slots: public slots:
......
...@@ -16,7 +16,7 @@ int main(int argc, char *argv[]) ...@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
format.setMajorVersion(2); format.setMajorVersion(2);
format.setMinorVersion(0); format.setMinorVersion(0);
format.setRenderableType(QSurfaceFormat::OpenGLES); format.setRenderableType(QSurfaceFormat::OpenGLES);
format.setSwapBehavior(QSurfaceFormat::SingleBuffer); format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
format.setSwapInterval(0); format.setSwapInterval(0);
QSurfaceFormat::setDefaultFormat(format); QSurfaceFormat::setDefaultFormat(format);
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES, true); QGuiApplication::setAttribute(Qt::AA_UseOpenGLES, true);
......
#ifndef VNC_H #ifndef VNC_H
#define VNC_H #define VNC_H
#define DECODER_COUNT 64 #define DECODER_COUNT 16
#include <QQuickWindow> #include <QQuickWindow>
#include <QObject> #include <QObject>
......
...@@ -223,7 +223,14 @@ int Uploader::gotJpeg(const quint32 x, const quint32 y, const quint32 width, con ...@@ -223,7 +223,14 @@ int Uploader::gotJpeg(const quint32 x, const quint32 y, const quint32 width, con
GLuint id; GLuint id;
m_functions->glGenTextures(1, &id); m_functions->glGenTextures(1, &id);
m_functions->glBindTexture(GL_TEXTURE_2D, 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); 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); m_textures->append(id);
float bottom = (float) height / (float) real_height; 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