diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gmdocument.c | 3 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 12 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 1e05f438..da369c8c 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -1495,6 +1495,9 @@ void render_GmDocument(const iGmDocument *d, iRangei visRangeY, iGmDocumentRende | |||
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | static iBool isValidRun_GmDocument_(const iGmDocument *d, const iGmRun *run) { | 1497 | static iBool isValidRun_GmDocument_(const iGmDocument *d, const iGmRun *run) { |
1498 | if (isEmpty_Array(&d->layout)) { | ||
1499 | return iFalse; | ||
1500 | } | ||
1498 | return run >= (const iGmRun *) constAt_Array(&d->layout, 0) && | 1501 | return run >= (const iGmRun *) constAt_Array(&d->layout, 0) && |
1499 | run < (const iGmRun *) constEnd_Array(&d->layout); | 1502 | run < (const iGmRun *) constEnd_Array(&d->layout); |
1500 | } | 1503 | } |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index ddca557b..9e322f65 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1769,7 +1769,9 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1769 | if (equal_Rangei(vis, current)) { | 1769 | if (equal_Rangei(vis, current)) { |
1770 | remove_Periodic(periodic_App(), d); | 1770 | remove_Periodic(periodic_App(), d); |
1771 | /* Scrolling has stopped, begin filling up the buffer. */ | 1771 | /* Scrolling has stopped, begin filling up the buffer. */ |
1772 | addTicker_App(prerender_DocumentWidget_, d); | 1772 | if (d->visBuf->buffers[0].texture) { |
1773 | addTicker_App(prerender_DocumentWidget_, d); | ||
1774 | } | ||
1773 | } | 1775 | } |
1774 | return iTrue; | 1776 | return iTrue; |
1775 | } | 1777 | } |
@@ -3837,9 +3839,11 @@ static void prerender_DocumentWidget_(iAny *context) { | |||
3837 | .showLinkNumbers = (d->flags & showLinkNumbers_DocumentWidgetFlag) != 0 | 3839 | .showLinkNumbers = (d->flags & showLinkNumbers_DocumentWidgetFlag) != 0 |
3838 | }; | 3840 | }; |
3839 | // printf("%u prerendering\n", SDL_GetTicks()); | 3841 | // printf("%u prerendering\n", SDL_GetTicks()); |
3840 | if (render_DocumentWidget_(d, &ctx, iTrue /* just fill up progressively */)) { | 3842 | if (d->visBuf->buffers[0].texture) { |
3841 | /* Something was drawn, should check if there is still more to do. */ | 3843 | if (render_DocumentWidget_(d, &ctx, iTrue /* just fill up progressively */)) { |
3842 | addTicker_App(prerender_DocumentWidget_, context); | 3844 | /* Something was drawn, should check if there is still more to do. */ |
3845 | addTicker_App(prerender_DocumentWidget_, context); | ||
3846 | } | ||
3843 | } | 3847 | } |
3844 | } | 3848 | } |
3845 | 3849 | ||