MCPcopy Create free account
hub / github.com/TeXworks/texworks / Page

Method Page

modules/QtPDF/src/PDFBackend.cpp:305–334  ·  view source on GitHub ↗

Page Class ---------- This class is thread-safe. Data access is governed by the QReadWriteLock _pageLock. When accessing the parent document directly (i.e., not via public member functions), the QSharedPointer _docLock must also be acquired. Note that if _docLock and _pageLock are to be acquired, _docLock must be acquired first. Note that the Page may exist in a detached state, i.

Source from the content-addressed store, hash-verified

303// is typically the case when the document discarded the page object but some
304// other object (typically in another thread) still holds a QSharedPointer to it.
305Page::Page(Document *parent, size_type at, QSharedPointer<QReadWriteLock> docLock):
306 _parent(parent),
307 _n(at),
308 _docLock(docLock)
309{
310#ifdef DEBUG
311// qDebug() << "Page::Page(" << parent << ", " << at << ")";
312#endif
313
314 if (!pageDummyBrush) {
315 pageDummyBrush = new QBrush();
316
317 // Make a texture brush which can be used to print "rendering page" all over
318 // the dummy tiles that are shown while the rendering thread is doing its
319 // work
320 QImage brushTex(1024, 1024, QImage::Format_ARGB32);
321 QRectF textRect;
322 QPainter p;
323 p.begin(&brushTex);
324 p.fillRect(brushTex.rect(), Qt::white);
325 p.setPen(Qt::lightGray);
326 p.drawText(brushTex.rect(), Qt::AlignCenter | Qt::AlignVCenter | Qt::TextSingleLine, QCoreApplication::translate("QtPDF::PDFDocumentScene", "rendering page"), &textRect);
327 p.end();
328 textRect.adjust(-textRect.width() * .05, -textRect.height() * .1, textRect.width() * .05, textRect.height() * .1);
329 brushTex = brushTex.copy(textRect.toAlignedRect());
330
331 pageDummyBrush->setTextureImage(brushTex);
332 pageDummyBrush->setTransform(QTransform().rotate(-45));
333 }
334}
335
336Page::size_type Page::pageNum() const { QReadLocker pageLocker(&_pageLock); return _n; }
337

Callers

nothing calls this directly

Calls 1

rectMethod · 0.45

Tested by

no test coverage detected