diff --git a/src/board/UBDrawingController.h b/src/board/UBDrawingController.h index 0ce1527b..e2f822cf 100644 --- a/src/board/UBDrawingController.h +++ b/src/board/UBDrawingController.h @@ -65,6 +65,10 @@ class UBDrawingController : public QObject mIsDesktopMode = mode; } + bool isInDesktopMode(){ + return mIsDesktopMode; + } + public slots: void setStylusTool(int tool); diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index dec6530f..bfd97da3 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -779,7 +779,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth) if (mShouldUseOMP) { - //#pragma omp parallel for + #pragma omp parallel for for (int i = 0; i < collidItemsSize; i++) { UBGraphicsPolygonItem *collidingPolygonItem = qgraphicsitem_cast(collidItems.at(i)); @@ -789,7 +789,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth) if(eraserInnerRect.contains(collidingPolygonItem->boundingRect())) { - //#pragma omp critical + #pragma omp critical // Put the entire polygon into the remove list toBeRemovedItems << collidingPolygonItem; } @@ -826,7 +826,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth) } else */if (croppedPathSimplified.isEmpty()) { - //#pragma omp critical + #pragma omp critical // Put the entire polygon into the remove list if the eraser removes all its visible content toBeRemovedItems << collidingPolygonItem; } @@ -837,7 +837,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth) foreach(const QPolygonF &pol, croppedPathSimplified.toFillPolygons()) { UBGraphicsPolygonItem* croppedPolygonItem = collidingPolygonItem->deepCopy(pol); - //#pragma omp critical + #pragma omp critical if(NULL != pGroup){ croppedPolygonItem->setStrokesGroup(pGroup); //pGroup->addToGroup(croppedPolygonItem); @@ -845,7 +845,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth) // Add this new polygon to the 'added' list toBeAddedItems << croppedPolygonItem; } - //#pragma omp critical + #pragma omp critical // Remove the original polygonitem because it has been replaced by many smaller polygons toBeRemovedItems << collidingPolygonItem; } @@ -902,7 +902,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth) } } - if(eDrawingMode_Vector == UBDrawingController::drawingController()->drawingMode()){ + if(eDrawingMode_Vector == DRAWING_MODE && !UBDrawingController::drawingController()->isInDesktopMode()){ foreach(QGraphicsItem* item, toBeRemovedItems){ UBGraphicsPolygonItem* poly = dynamic_cast(item); if(NULL != poly){ @@ -920,7 +920,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth) mRemovedItems += toBeRemovedItems; } - if(eDrawingMode_Vector == UBDrawingController::drawingController()->drawingMode()){ + if(eDrawingMode_Vector == DRAWING_MODE && !UBDrawingController::drawingController()->isInDesktopMode()){ foreach(QGraphicsItem* item, toBeAddedItems){ UBGraphicsPolygonItem* poly = dynamic_cast(item); if(NULL != poly && NULL != poly->strokesGroup()){