Fix hasPixmap setting size of TilesManager

remotes/origin/work/nico/fancypdfsignatures
Max Mueggler 3 years ago committed by Oliver Sander
parent 0136eddb12
commit aa0386dccd
  1. 3
      core/document.cpp
  2. 13
      core/page.cpp
  3. 5
      core/page.h

@ -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();

@ -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;

@ -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).
*/

Loading…
Cancel
Save