尝试修复粉紫屏未果
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "config/config.h"
|
||||
#include "core.h"
|
||||
#include "node/block/subtitle/subtitle.h"
|
||||
#include "codec/frame.h"
|
||||
#include "node/gizmo/path.h"
|
||||
#include "node/gizmo/point.h"
|
||||
#include "node/gizmo/polygon.h"
|
||||
@@ -401,8 +402,35 @@ void ViewerDisplayWidget::OnPaint()
|
||||
texture_->Upload(frame->data(), frame->linesize_pixels());
|
||||
}
|
||||
} else if (TexturePtr texture = load_frame_.value<TexturePtr>()) {
|
||||
// This is a GPU texture, switch to it directly
|
||||
texture_ = texture;
|
||||
// This is a GPU texture, switch to it directly when possible.
|
||||
if (texture && texture->renderer() &&
|
||||
texture->renderer() != renderer()) {
|
||||
bool copied = false;
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
if (ctx) {
|
||||
QOpenGLFunctions *funcs = ctx->functions();
|
||||
GLuint tex_id = texture->id().value<GLuint>();
|
||||
if (funcs && tex_id && funcs->glIsTexture(tex_id)) {
|
||||
FramePtr frame = Frame::Create();
|
||||
frame->set_video_params(texture->params());
|
||||
if (frame->allocate()) {
|
||||
renderer()->DownloadFromTexture(
|
||||
texture->id(), texture->params(),
|
||||
frame->data(), frame->linesize_pixels());
|
||||
texture_ = renderer()->CreateTexture(
|
||||
frame->video_params(), frame->data(),
|
||||
frame->linesize_pixels());
|
||||
copied = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!copied) {
|
||||
texture_ = texture;
|
||||
}
|
||||
} else {
|
||||
texture_ = texture;
|
||||
}
|
||||
} else {
|
||||
texture_ = LoadCustomTextureFromFrame(load_frame_);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user