本文整理汇总了C++中DocumentView::limitArea方法的典型用法代码示例。如果您正苦于以下问题:C++ DocumentView::limitArea方法的具体用法?C++ DocumentView::limitArea怎么用?C++ DocumentView::limitArea使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentView
的用法示例。
在下文中一共展示了DocumentView::limitArea方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rerenderRectangle
void RenderJob::rerenderRectangle(RenderJob * renderJob, Rectangle * rect) {
XOJ_CHECK_TYPE_OBJ(renderJob, RenderJob);
PageView * view = renderJob->view;
double zoom = view->xournal->getZoom();
Document * doc = view->xournal->getDocument();
doc->lock();
double pageWidth = view->page.getWidth();
double pageHeight = view->page.getHeight();
doc->unlock();
int x = rect->x * zoom;
int y = rect->y * zoom;
int width = rect->width * zoom;
int height = rect->height * zoom;
cairo_surface_t * rectBuffer = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
cairo_t * crRect = cairo_create(rectBuffer);
cairo_translate(crRect, -x, -y);
cairo_scale(crRect, zoom, zoom);
DocumentView v;
v.limitArea(rect->x, rect->y, rect->width, rect->height);
if (view->page.getBackgroundType() == BACKGROUND_TYPE_PDF) {
int pgNo = view->page.getPdfPageNr();
XojPopplerPage * popplerPage = doc->getPdfPage(pgNo);
PdfCache * cache = view->xournal->getCache();
PdfView::drawPage(cache, popplerPage, crRect, zoom, pageWidth, pageHeight);
}
doc->lock();
v.drawPage(view->page, crRect, false);
doc->unlock();
cairo_destroy(crRect);
g_mutex_lock(view->drawingMutex);
cairo_t * crPageBuffer = cairo_create(view->crBuffer);
cairo_set_operator(crPageBuffer, CAIRO_OPERATOR_SOURCE);
cairo_set_source_surface(crPageBuffer, rectBuffer, x, y);
cairo_rectangle(crPageBuffer, x, y, width, height);
cairo_fill(crPageBuffer);
cairo_destroy(crPageBuffer);
cairo_surface_destroy(rectBuffer);
g_mutex_unlock(view->drawingMutex);
}