change: change code style to Linux style except indent.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -31,94 +31,104 @@
|
||||
|
||||
#include "render/renderer.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class OpenGLRenderer : public Renderer
|
||||
namespace olive
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
class OpenGLRenderer : public Renderer {
|
||||
Q_OBJECT
|
||||
public:
|
||||
OpenGLRenderer(QObject* parent = nullptr);
|
||||
OpenGLRenderer(QObject *parent = nullptr);
|
||||
|
||||
virtual ~OpenGLRenderer() override;
|
||||
virtual ~OpenGLRenderer() override;
|
||||
|
||||
void Init(QOpenGLContext* existing_ctx);
|
||||
void Init(QOpenGLContext *existing_ctx);
|
||||
|
||||
virtual bool Init() override;
|
||||
virtual bool Init() override;
|
||||
|
||||
virtual void PostDestroy() override;
|
||||
virtual void PostDestroy() override;
|
||||
|
||||
virtual void PostInit() override;
|
||||
virtual void PostInit() override;
|
||||
|
||||
virtual void ClearDestination(olive::Texture *texture = nullptr, double r = 0.0, double g = 0.0, double b = 0.0, double a = 0.0) override;
|
||||
virtual void ClearDestination(olive::Texture *texture = nullptr,
|
||||
double r = 0.0, double g = 0.0,
|
||||
double b = 0.0, double a = 0.0) override;
|
||||
|
||||
virtual QVariant CreateNativeShader(olive::ShaderCode code) override;
|
||||
virtual QVariant CreateNativeShader(olive::ShaderCode code) override;
|
||||
|
||||
virtual void DestroyNativeShader(QVariant shader) override;
|
||||
virtual void DestroyNativeShader(QVariant shader) override;
|
||||
|
||||
virtual void UploadToTexture(const QVariant &handle, const VideoParams ¶ms, const void* data, int linesize) override;
|
||||
virtual void UploadToTexture(const QVariant &handle,
|
||||
const VideoParams ¶ms, const void *data,
|
||||
int linesize) override;
|
||||
|
||||
virtual void DownloadFromTexture(const QVariant &handle, const VideoParams ¶ms, void* data, int linesize) override;
|
||||
virtual void DownloadFromTexture(const QVariant &handle,
|
||||
const VideoParams ¶ms, void *data,
|
||||
int linesize) override;
|
||||
|
||||
virtual void Flush() override;
|
||||
virtual void Flush() override;
|
||||
|
||||
virtual Color GetPixelFromTexture(olive::Texture *texture, const QPointF &pt) override;
|
||||
virtual Color GetPixelFromTexture(olive::Texture *texture,
|
||||
const QPointF &pt) override;
|
||||
|
||||
protected:
|
||||
virtual void Blit(QVariant shader,
|
||||
olive::ShaderJob job,
|
||||
olive::Texture* destination,
|
||||
olive::VideoParams destination_params,
|
||||
bool clear_destination) override;
|
||||
virtual void Blit(QVariant shader, olive::ShaderJob job,
|
||||
olive::Texture *destination,
|
||||
olive::VideoParams destination_params,
|
||||
bool clear_destination) override;
|
||||
|
||||
virtual QVariant CreateNativeTexture(int width, int height, int depth, PixelFormat format, int channel_count, const void* data = nullptr, int linesize = 0) override;
|
||||
virtual QVariant CreateNativeTexture(int width, int height, int depth,
|
||||
PixelFormat format, int channel_count,
|
||||
const void *data = nullptr,
|
||||
int linesize = 0) override;
|
||||
|
||||
virtual void DestroyNativeTexture(QVariant texture) override;
|
||||
virtual void DestroyNativeTexture(QVariant texture) override;
|
||||
|
||||
virtual void DestroyInternal() override;
|
||||
virtual void DestroyInternal() override;
|
||||
|
||||
private:
|
||||
static GLint GetInternalFormat(PixelFormat format, int channel_layout);
|
||||
static GLint GetInternalFormat(PixelFormat format, int channel_layout);
|
||||
|
||||
static GLenum GetPixelType(PixelFormat format);
|
||||
static GLenum GetPixelType(PixelFormat format);
|
||||
|
||||
static GLenum GetPixelFormat(int channel_count);
|
||||
static GLenum GetPixelFormat(int channel_count);
|
||||
|
||||
void AttachTextureAsDestination(const QVariant &texture);
|
||||
void AttachTextureAsDestination(const QVariant &texture);
|
||||
|
||||
void DetachTextureAsDestination();
|
||||
void DetachTextureAsDestination();
|
||||
|
||||
void PrepareInputTexture(GLenum target, Texture::Interpolation interp);
|
||||
void PrepareInputTexture(GLenum target, Texture::Interpolation interp);
|
||||
|
||||
void ClearDestinationInternal(double r = 0.0, double g = 0.0, double b = 0.0, double a = 0.0);
|
||||
void ClearDestinationInternal(double r = 0.0, double g = 0.0,
|
||||
double b = 0.0, double a = 0.0);
|
||||
|
||||
GLuint CompileShader(GLenum type, const QString &code);
|
||||
GLuint CompileShader(GLenum type, const QString &code);
|
||||
|
||||
QOpenGLContext* context_;
|
||||
QOpenGLContext *context_;
|
||||
|
||||
QOpenGLFunctions* functions_;
|
||||
QOpenGLFunctions *functions_;
|
||||
|
||||
QOffscreenSurface surface_;
|
||||
QOffscreenSurface surface_;
|
||||
|
||||
GLuint framebuffer_;
|
||||
GLuint framebuffer_;
|
||||
|
||||
struct TextureCacheKey {
|
||||
int width;
|
||||
int height;
|
||||
int depth;
|
||||
PixelFormat format;
|
||||
int channel_count;
|
||||
struct TextureCacheKey {
|
||||
int width;
|
||||
int height;
|
||||
int depth;
|
||||
PixelFormat format;
|
||||
int channel_count;
|
||||
|
||||
bool operator==(const TextureCacheKey &rhs) const
|
||||
{
|
||||
return width == rhs.width && height == rhs.height && depth == rhs.depth
|
||||
&& format == rhs.format && channel_count == rhs.channel_count;
|
||||
}
|
||||
};
|
||||
bool operator==(const TextureCacheKey &rhs) const
|
||||
{
|
||||
return width == rhs.width && height == rhs.height &&
|
||||
depth == rhs.depth && format == rhs.format &&
|
||||
channel_count == rhs.channel_count;
|
||||
}
|
||||
};
|
||||
|
||||
QMap<GLuint, TextureCacheKey> texture_params_;
|
||||
|
||||
static const int kTextureCacheMaxSize;
|
||||
QMap<GLuint, TextureCacheKey> texture_params_;
|
||||
|
||||
static const int kTextureCacheMaxSize;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user