further progress on better blending
This commit is contained in:
+23
-17
@@ -660,10 +660,6 @@ void Effect::open() {
|
||||
} else {
|
||||
isOpen = true;
|
||||
}
|
||||
|
||||
if (enable_superimpose) {
|
||||
texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
|
||||
}
|
||||
}
|
||||
|
||||
void Effect::close() {
|
||||
@@ -747,30 +743,40 @@ void Effect::process_shader(double timecode, GLTextureCoords&) {
|
||||
void Effect::process_coords(double, GLTextureCoords&, int) {}
|
||||
|
||||
GLuint Effect::process_superimpose(double timecode) {
|
||||
bool recreate_texture = false;
|
||||
bool dimensions_changed = false;
|
||||
bool redrew_image = false;
|
||||
|
||||
int width = parent_clip->getWidth();
|
||||
int height = parent_clip->getHeight();
|
||||
|
||||
if (width != img.width() || height != img.height()) {
|
||||
img = QImage(width, height, QImage::Format_RGBA8888_Premultiplied);
|
||||
recreate_texture = true;
|
||||
dimensions_changed = true;
|
||||
}
|
||||
|
||||
if (valueHasChanged(timecode) || recreate_texture || enable_always_update) {
|
||||
if (valueHasChanged(timecode) || dimensions_changed || enable_always_update) {
|
||||
redraw(timecode);
|
||||
redrew_image = true;
|
||||
}
|
||||
|
||||
if (texture != nullptr) {
|
||||
if (recreate_texture || texture->width() != img.width() || texture->height() != img.height()) {
|
||||
delete_texture();
|
||||
texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
|
||||
texture->setData(img);
|
||||
} else {
|
||||
texture->setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, img.constBits());
|
||||
}
|
||||
return texture->textureId();
|
||||
if (texture == nullptr || texture->width() != img.width() || texture->height() != img.height()) {
|
||||
delete_texture();
|
||||
|
||||
texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
|
||||
texture->setSize(img.width(), img.height());
|
||||
texture->setFormat(QOpenGLTexture::RGBA8_UNorm);
|
||||
texture->setMipLevels(texture->maximumMipLevels());
|
||||
texture->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Linear);
|
||||
texture->allocateStorage(QOpenGLTexture::RGBA, QOpenGLTexture::UInt8);
|
||||
|
||||
redrew_image = true;
|
||||
}
|
||||
return 0;
|
||||
|
||||
if (redrew_image) {
|
||||
texture->setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, img.constBits());
|
||||
}
|
||||
|
||||
return texture->textureId();
|
||||
}
|
||||
|
||||
void Effect::process_audio(double, double, quint8*, int, int) {}
|
||||
|
||||
Reference in New Issue
Block a user