| 125 | } |
| 126 | |
| 127 | void PAGPlayTask::initOpenGLEnvironment() { |
| 128 | if (surface != nullptr) { |
| 129 | return; |
| 130 | } |
| 131 | pagPlayer = std::make_unique<PAGPlayer>(); |
| 132 | context = std::make_unique<QOpenGLContext>(); |
| 133 | context->create(); |
| 134 | offscreenSurface = std::make_unique<QOffscreenSurface>(); |
| 135 | offscreenSurface->setFormat(context->format()); |
| 136 | offscreenSurface->create(); |
| 137 | context->makeCurrent(offscreenSurface.get()); |
| 138 | frameBuffer = std::make_unique<QOpenGLFramebufferObject>( |
| 139 | QSize(pagFile->width(), pagFile->height()), GL_TEXTURE_2D); |
| 140 | GLFrameBufferInfo frameBufferInfo; |
| 141 | frameBufferInfo.id = frameBuffer->handle(); |
| 142 | BackendRenderTarget renderTarget = |
| 143 | BackendRenderTarget(frameBufferInfo, frameBuffer->width(), frameBuffer->height()); |
| 144 | surface = pag::PAGSurface::MakeFrom(renderTarget, pag::ImageOrigin::TopLeft); |
| 145 | pagPlayer->setSurface(surface); |
| 146 | pagPlayer->setComposition(pagFile); |
| 147 | context->doneCurrent(); |
| 148 | context->moveToThread(&workerThread); |
| 149 | offscreenSurface->moveToThread(&workerThread); |
| 150 | } |
| 151 | |
| 152 | } // namespace pag |
nothing calls this directly
no test coverage detected