diff --git a/src/control/tools/StrokeHandler.cpp b/src/control/tools/StrokeHandler.cpp index d77e4aec..589ed714 100644 --- a/src/control/tools/StrokeHandler.cpp +++ b/src/control/tools/StrokeHandler.cpp @@ -42,7 +42,7 @@ void StrokeHandler::draw(cairo_t* cr) view.applyColor(cr, stroke); cairo_set_operator(cr, CAIRO_OPERATOR_OVER); - cairo_mask_surface(cr, surfMask, visRect.x, visRect.y); + cairo_mask_surface(cr, surfMask, 0, 0); } bool StrokeHandler::onMotionNotifyEvent(const PositionInputData& pos) @@ -216,22 +216,12 @@ void StrokeHandler::onButtonPressEvent(const PositionInputData& pos) destroySurface(); - const double width = redrawable->getDisplayWidth(); - const double height = redrawable->getDisplayHeight(); const double zoom = xournal->getZoom(); + PageRef page = redrawable->getPage(); - Rectangle *rectPtr = redrawable->getVisibleRect(); - - if (!rectPtr) - { - g_warning("Attempting to draw on an invisible surface"); - return; - } - - visRect = *(rectPtr); - delete rectPtr; - - surfMask = cairo_image_surface_create(CAIRO_FORMAT_A8, visRect.width, visRect.height); + double width = page->getWidth() * zoom; + double height = page->getHeight() * zoom; + surfMask = cairo_image_surface_create(CAIRO_FORMAT_A8, width, height); crMask = cairo_create(surfMask); @@ -242,7 +232,6 @@ void StrokeHandler::onButtonPressEvent(const PositionInputData& pos) cairo_fill(crMask); - cairo_translate(crMask, -visRect.x, -visRect.y); cairo_scale(crMask, zoom, zoom); if (!stroke) diff --git a/src/control/tools/StrokeHandler.h b/src/control/tools/StrokeHandler.h index 0a8c2666..2856f73b 100644 --- a/src/control/tools/StrokeHandler.h +++ b/src/control/tools/StrokeHandler.h @@ -62,7 +62,6 @@ private: cairo_t* crMask; DocumentView view; - Rectangle visRect; ShapeRecognizer* reco; }; diff --git a/src/gui/PageView.cpp b/src/gui/PageView.cpp index 3b39f153..54b63313 100644 --- a/src/gui/PageView.cpp +++ b/src/gui/PageView.cpp @@ -995,24 +995,6 @@ Text* XojPageView::getSelectedText() return NULL; } -Rectangle* XojPageView::getVisibleRect() -{ - XOJ_CHECK_TYPE(XojPageView); - - Rectangle* rect = xournal->getVisibleRect(this); - - if (!rect) - { - return NULL; - } - - (*rect) *= xournal->getZoom(); - - (*rect) = rect->translated(-getX(), -getY()); - - return rect; -} - Rectangle XojPageView::getRect() { XOJ_CHECK_TYPE(XojPageView); diff --git a/src/gui/PageView.h b/src/gui/PageView.h index e2437aec..54d1a08f 100644 --- a/src/gui/PageView.h +++ b/src/gui/PageView.h @@ -133,7 +133,6 @@ public: TexImage* getSelectedTex(); Text* getSelectedText(); - Rectangle* getVisibleRect(); Rectangle getRect(); public: // event handler diff --git a/src/gui/RepaintHandler.cpp b/src/gui/RepaintHandler.cpp index ef48d51b..dbd3d5bb 100644 --- a/src/gui/RepaintHandler.cpp +++ b/src/gui/RepaintHandler.cpp @@ -25,30 +25,20 @@ void RepaintHandler::repaintPage(XojPageView* view) { XOJ_CHECK_TYPE(RepaintHandler); -// int x1 = view->getX(); -// int y1 = view->getY(); -// int x2 = x1 + view->getDisplayWidth(); -// int y2 = y1 + view->getDisplayHeight(); -// gtk_xournal_repaint_area(this->xournal->getWidget(), x1, y1, x2, y2); - - // Repainting is really fast, and there are painting issues from time to time - // Therefore do always a full repaint. The stroken are cached anyway. - // Tested on a 1.8GHz Core2Duo - gtk_widget_queue_draw(this->xournal->getWidget()); + int x1 = view->getX(); + int y1 = view->getY(); + int x2 = x1 + view->getDisplayWidth(); + int y2 = y1 + view->getDisplayHeight(); + gtk_xournal_repaint_area(this->xournal->getWidget(), x1, y1, x2, y2); } void RepaintHandler::repaintPageArea(XojPageView* view, int x1, int y1, int x2, int y2) { XOJ_CHECK_TYPE(RepaintHandler); -// int x = view->getX(); -// int y = view->getY(); -// gtk_xournal_repaint_area(this->xournal->getWidget(), x + x1, y + y1, x + x2, y + y2); - - // Repainting is really fast, and there are painting issues from time to time - // Therefore do always a full repaint. The stroken are cached anyway. - // Tested on a 1.8GHz Core2Duo - gtk_widget_queue_draw(this->xournal->getWidget()); + int x = view->getX(); + int y = view->getY(); + gtk_xournal_repaint_area(this->xournal->getWidget(), x + x1, y + y1, x + x2, y + y2); } void RepaintHandler::repaintPageBorder(XojPageView* view)