File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -162,13 +162,13 @@ void PAGXView::updateSize() {
162162 if (window == nullptr ) {
163163 return ;
164164 }
165- window-> invalidSize () ;
165+ surface = nullptr ;
166166 auto device = window->getDevice ();
167167 auto context = device->lockContext ();
168168 if (context == nullptr ) {
169169 return ;
170170 }
171- auto surface = window-> getSurface (context);
171+ surface = tgfx::Surface::MakeFrom (context, window );
172172 if (surface == nullptr ) {
173173 device->unlock ();
174174 return ;
@@ -244,7 +244,9 @@ void PAGXView::draw() {
244244 if (context == nullptr ) {
245245 return ;
246246 }
247- auto surface = window->getSurface (context);
247+ if (surface == nullptr ) {
248+ surface = tgfx::Surface::MakeFrom (context, window);
249+ }
248250 if (surface == nullptr ) {
249251 device->unlock ();
250252 return ;
@@ -271,13 +273,11 @@ void PAGXView::draw() {
271273 presentImmediately = false ;
272274 if (recording) {
273275 context->submit (std::move (recording));
274- window->present (context);
275276 }
276277 } else {
277278 std::swap (lastRecording, recording);
278279 if (recording) {
279280 context->submit (std::move (recording));
280- window->present (context);
281281 }
282282 }
283283 device->unlock ();
Original file line number Diff line number Diff line change 2323#include " LayerBuilder.h"
2424#include " TextLayout.h"
2525#include " pagx/PAGXDocument.h"
26+ #include " tgfx/core/Surface.h"
2627#include " tgfx/gpu/Recording.h"
2728#include " tgfx/gpu/opengl/webgl/WebGLWindow.h"
2829#include " GridBackground.h"
@@ -69,6 +70,7 @@ class PAGXView {
6970
7071 std::string canvasID = {};
7172 std::shared_ptr<tgfx::Window> window = nullptr ;
73+ std::shared_ptr<tgfx::Surface> surface = nullptr ;
7274 tgfx::DisplayList displayList = {};
7375 std::shared_ptr<tgfx::Layer> contentLayer = nullptr ;
7476 std::unique_ptr<tgfx::Recording> lastRecording = nullptr ;
You can’t perform that action at this time.
0 commit comments