diff --git a/core/document.cpp b/core/document.cpp index 33ff1182b..65bce3b1d 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -1366,6 +1366,9 @@ void DocumentPrivate::sendGeneratorPixmapRequest() } const long screenSize = screen->devicePixelRatio() * screen->size().width() * screen->devicePixelRatio() * screen->size().height(); + // Make sure the page is the right size to receive the pixmap + r->page()->setPageSize(r->observer(), r->width(), r->height()); + // If it's a preload but the generator is not threaded no point in trying to preload if (r->preload() && !m_generator->hasFeature(Generator::Threaded)) { m_pixmapRequestsStack.pop_back(); diff --git a/core/page.cpp b/core/page.cpp index 70f9c5463..00dde949c 100644 --- a/core/page.cpp +++ b/core/page.cpp @@ -221,11 +221,6 @@ bool Page::hasPixmap(DocumentObserver *observer, int width, int height, const No TilesManager *tm = d->tilesManager(observer); if (tm) { if (width != tm->width() || height != tm->height()) { - // FIXME hasPixmap should not be calling setSize on the TilesManager this is not very "const" - // as this function claims to be - if (width != -1 && height != -1) { - tm->setSize(width, height); - } return false; } @@ -250,6 +245,14 @@ bool Page::hasPixmap(DocumentObserver *observer, int width, int height, const No return (pixmap->width() == width && pixmap->height() == height); } +void Page::setPageSize(DocumentObserver *observer, int width, int height) +{ + TilesManager *tm = d->tilesManager(observer); + if (tm) { + tm->setSize(width, height); + } +} + bool Page::hasTextPage() const { return d->m_text != nullptr; diff --git a/core/page.h b/core/page.h index dd065073d..11bebd5da 100644 --- a/core/page.h +++ b/core/page.h @@ -141,6 +141,11 @@ public: */ bool hasPixmap(DocumentObserver *observer, int width = -1, int height = -1, const NormalizedRect &rect = NormalizedRect()) const; + /** + * Sets the size of the page (in screen pixels) if there is a TilesManager. + */ + void setPageSize(DocumentObserver *observer, int width, int height); + /** * Returns whether the page provides a text page (@ref TextPage). */