change: change code style to Linux style except indent.

This commit is contained in:
Mike Solar
2025-08-03 03:09:40 +08:00
parent 65ab76edc8
commit 74f73ab3be
789 changed files with 77113 additions and 68888 deletions
File diff suppressed because it is too large Load Diff
+62 -52
View File
@@ -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 &params, const void* data, int linesize) override;
virtual void UploadToTexture(const QVariant &handle,
const VideoParams &params, const void *data,
int linesize) override;
virtual void DownloadFromTexture(const QVariant &handle, const VideoParams &params, void* data, int linesize) override;
virtual void DownloadFromTexture(const QVariant &handle,
const VideoParams &params, 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;
};
}