various: pixel optimizations

Several things are accomplished in this commit, including:

- Use OIIO instead of our own functions for pixel format conversions
  (cleaner code/less for us to maintain)

- Fold all PixelService functions into the PixelFormat class
  (cleaner code)

- Moved OpenGL pixel definitions to OpenGL classes and out of the
  global classes.

- Add support for RGB buffers as well as RGBA (optimization)
This commit is contained in:
itsmattkc
2020-02-27 13:54:38 +11:00
parent 0624184b18
commit 02ce48d0c6
27 changed files with 491 additions and 564 deletions
+4 -2
View File
@@ -27,9 +27,10 @@
#include <QOpenGLFunctions>
#include <QOpenGLTexture>
#include "common/define.h"
#include "render/backend/opengl/openglrenderfunctions.h"
#include "render/backend/opengl/openglshader.h"
#include "render/pixelservice.h"
#include "render/pixelformat.h"
#ifdef Q_OS_LINUX
bool ViewerGLWidget::nouveau_check_done_ = false;
@@ -83,7 +84,8 @@ void ViewerGLWidget::SetImage(const QString &fn)
if (input) {
PixelFormat::Format image_format = PixelService::OIIOFormatToOliveFormat(input->spec().format);
PixelFormat::Format image_format = PixelFormat::OIIOFormatToOliveFormat(input->spec().format,
input->spec().nchannels == kRGBAChannels);
// Ensure the following texture operations are done in our context (in case we're in a separate window for instance)
makeCurrent();