Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions playground/src/PAGXView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,12 @@ void PAGXView::updateSize() {
if (window == nullptr) {
return;
}
window->invalidSize();
auto device = window->getDevice();
auto context = device->lockContext();
if (context == nullptr) {
return;
Comment thread
OnionsYu marked this conversation as resolved.
}
auto surface = window->getSurface(context);
surface = tgfx::Surface::MakeFrom(context, window);
if (surface == nullptr) {
device->unlock();
return;
Expand Down Expand Up @@ -244,7 +243,9 @@ void PAGXView::draw() {
if (context == nullptr) {
return;
}
auto surface = window->getSurface(context);
if (surface == nullptr) {
surface = tgfx::Surface::MakeFrom(context, window);
}
if (surface == nullptr) {
device->unlock();
return;
Expand All @@ -271,13 +272,11 @@ void PAGXView::draw() {
presentImmediately = false;
if (recording) {
context->submit(std::move(recording));
window->present(context);
}
} else {
std::swap(lastRecording, recording);
if (recording) {
context->submit(std::move(recording));
window->present(context);
}
}
device->unlock();
Expand Down
2 changes: 2 additions & 0 deletions playground/src/PAGXView.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "LayerBuilder.h"
#include "TextLayout.h"
#include "pagx/PAGXDocument.h"
#include "tgfx/core/Surface.h"
#include "tgfx/gpu/Recording.h"
#include "tgfx/gpu/opengl/webgl/WebGLWindow.h"
#include "GridBackground.h"
Expand Down Expand Up @@ -69,6 +70,7 @@ class PAGXView {

std::string canvasID = {};
std::shared_ptr<tgfx::Window> window = nullptr;
std::shared_ptr<tgfx::Surface> surface = nullptr;
tgfx::DisplayList displayList = {};
std::shared_ptr<tgfx::Layer> contentLayer = nullptr;
std::unique_ptr<tgfx::Recording> lastRecording = nullptr;
Expand Down
Loading