r21175 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Sat Apr 9 14:18:32 UTC 2016


Author: jghali
Date: Sat Apr  9 14:18:32 2016
New Revision: 21175

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21175
Log:
#10990 (part of): Object page reference incorrect at 0.000 on facing page

This fix the case when page interior bleed is 0. Cases where page interior bleed is not null or page horizontal spacing is > 0 are still to be worked on.

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21175&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Sat Apr  9 14:18:32 2016
@@ -2628,12 +2628,12 @@
 				double y  = pag->yOffset() - bTop;
 				double w  = pag->width() + bLeft + bRight;
 				double h1 = pag->height() + bBottom + bTop;
-				double ilw= ite->lineWidth();
+				double ilw= ite->visualLineWidth();
 				double x2 = ite->BoundingX - ilw / 2.0;
 				double y2 = ite->BoundingY - ilw / 2.0;
 				double w2 = ite->BoundingW + ilw;
 				double h2 = ite->BoundingH + ilw;
-				if (!( qMax( x, x2 ) <= qMin( x+w, x2+w2 ) && qMax( y, y2 ) <= qMin( y+h1, y2+h2 )))
+				if (!QRectF(x2, y2, w2, h2).intersects(QRectF(x, y, w, h1)))
 					continue;
 				if (ite->ChangedMasterItem)
 					continue;
@@ -4280,21 +4280,21 @@
 	ite->setRedrawBounding();
 	double bLeft, bRight, bBottom, bTop;
 	getBleeds(pag, bLeft, bRight, bBottom, bTop);
-	double x  = pag->xOffset() - bLeft;
-	double y  = pag->yOffset() - bTop;
-	double w  = pag->width() + bLeft + bRight;
-	double h1 = pag->height()+ bBottom + bTop;
-	double ilw=ite->lineWidth();
-	double x2 = ite->BoundingX - ilw / 2.0;
-	double y2 = ite->BoundingY - ilw / 2.0;
-	double w2 = qMax(ite->BoundingW + ilw, 1.0);
-	double h2 = qMax(ite->BoundingH + ilw, 1.0);
 	output.resize(0);
 	if (!pattern)
 	{
+		double x1 = pag->xOffset() - bLeft;
+		double y1 = pag->yOffset() - bTop;
+		double w1 = pag->width()   + bLeft + bRight;
+		double h1 = pag->height()  + bBottom + bTop;
+		double lw = ite->visualLineWidth();
+		double x2 = ite->BoundingX - lw / 2.0;
+		double y2 = ite->BoundingY - lw / 2.0;
+		double w2 = qMax(ite->BoundingW + lw, 1.0);
+		double h2 = qMax(ite->BoundingH + lw, 1.0);
 //		qDebug() << QString("pdflib process item: pagename=%1 ownpage=%2 pagenr=%3 changedMP=%4").arg(pag->pageName()).arg(ite->OwnPage).arg(pag->pageNr()).arg(ite->ChangedMasterItem);
-//		qDebug() << QString("pdflib process item: x=%1 x2=%2 y=%3 y2=%4 w=%5 w2=%6 h1=%7 h2=%8 ilw=%9").arg(x).arg(x2).arg(y).arg(y2).arg(w).arg(w2).arg(h1).arg(h2).arg(ilw);
-		if (!( qMax( x, x2 ) <= qMin( x+w, x2+w2 ) && qMax( y, y2 ) <= qMin( y+h1, y2+h2 )) && !embedded)
+//		qDebug() << QString("pdflib process item: x1=%1 x2=%2 y1=%3 y2=%4 w1=%5 w2=%6 h1=%7 h2=%8 lw=%9").arg(x1).arg(x2).arg(y1).arg(y2).arg(w1).arg(w2).arg(h1).arg(h2).arg(lw);
+		if (!(QRectF(x2, y2, w2, h2).intersects(QRectF(x1, y1, w1, h1))) && !embedded)
 		{
 			output = tmp;
 			return true;

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21175&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp	(original)
+++ trunk/Scribus/scribus/pslib.cpp	Sat Apr  9 14:18:32 2016
@@ -1690,16 +1690,16 @@
 							continue;
 						double bLeft, bRight, bBottom, bTop;
 						GetBleeds(Doc->MasterPages.at(ap), bLeft, bRight, bBottom, bTop);
-						double x  = Doc->MasterPages.at(ap)->xOffset() - bLeft;
-						double y  = Doc->MasterPages.at(ap)->yOffset() - bTop;
-						double w  = Doc->MasterPages.at(ap)->width() + bLeft + bRight;
+						double x1 = Doc->MasterPages.at(ap)->xOffset() - bLeft;
+						double y1 = Doc->MasterPages.at(ap)->yOffset() - bTop;
+						double w1 = Doc->MasterPages.at(ap)->width() + bLeft + bRight;
 						double h1 = Doc->MasterPages.at(ap)->height()+ bBottom + bTop;
-						double ilw = it->lineWidth();
-						double x2 = it->BoundingX - ilw / 2.0;
-						double y2 = it->BoundingY - ilw / 2.0;
-						double w2 = qMax(it->BoundingW + ilw, 1.0);
-						double h2 = qMax(it->BoundingH + ilw, 1.0);
-						if (!( qMax( x, x2 ) <= qMin( x+w, x2+w2 ) && qMax( y, y2 ) <= qMin( y+h1, y2+h2 )))
+						double lw = it->visualLineWidth();
+						double x2 = it->BoundingX - lw / 2.0;
+						double y2 = it->BoundingY - lw / 2.0;
+						double w2 = qMax(it->BoundingW + lw, 1.0);
+						double h2 = qMax(it->BoundingH + lw, 1.0);
+						if (!QRectF(x2, y2, w2, h2).intersects(QRectF(x1, y1, w1, h1)))
 							continue;
 						if ((it->OwnPage != static_cast<int>(Doc->MasterPages.at(ap)->pageNr())) && (it->OwnPage != -1))
 							continue;
@@ -2634,16 +2634,16 @@
 					continue;
 				double bLeft, bRight, bBottom, bTop;
 				GetBleeds(a, bLeft, bRight, bBottom, bTop);
-				double x  = a->xOffset() - bLeft;
-				double y  = a->yOffset() - bTop;
-				double w  = a->width() + bLeft + bRight;
+				double x1 = a->xOffset() - bLeft;
+				double y1 = a->yOffset() - bTop;
+				double w1 = a->width() + bLeft + bRight;
 				double h1 = a->height() + bBottom + bTop;
-				double ilw = c->lineWidth();
-				double x2 = c->BoundingX - ilw / 2.0;
-				double y2 = c->BoundingY - ilw / 2.0;
-				double w2 = qMax(c->BoundingW + ilw, 1.0);
-				double h2 = qMax(c->BoundingH + ilw, 1.0);
-				if (!( qMax( x, x2 ) <= qMin( x+w, x2+w2 ) && qMax( y, y2 ) <= qMin( y+h1, y2+h2 )))
+				double lw = c->visualLineWidth();
+				double x2 = c->BoundingX - lw / 2.0;
+				double y2 = c->BoundingY - lw / 2.0;
+				double w2 = qMax(c->BoundingW + lw, 1.0);
+				double h2 = qMax(c->BoundingH + lw, 1.0);
+				if (!QRectF(x2, y2, w2, h2).intersects(QRectF(x1, y1, w1, h1)))
 					continue;
 				if (c->ChangedMasterItem)
 					continue;
@@ -3057,16 +3057,16 @@
 				continue;
 			double bLeft, bRight, bBottom, bTop;
 			GetBleeds(page, bLeft, bRight, bBottom, bTop);
-			double x  = page->xOffset() - bLeft;
-			double y  = page->yOffset() - bTop;
-			double w  = page->width() + bLeft + bRight;
+			double x1 = page->xOffset() - bLeft;
+			double y1 = page->yOffset() - bTop;
+			double w1 = page->width() + bLeft + bRight;
 			double h1 = page->height() + bBottom + bTop;
-			double ilw = item->lineWidth();
-			double x2 = item->BoundingX - ilw / 2.0;
-			double y2 = item->BoundingY - ilw / 2.0;
-			double w2 = qMax(item->BoundingW + ilw, 1.0);
-			double h2 = qMax(item->BoundingH + ilw, 1.0);
-			if (!( qMax( x, x2 ) <= qMin( x+w, x2+w2 ) && qMax( y, y2 ) <= qMin( y+h1, y2+h2 )))
+			double lw = item->visualLineWidth();
+			double x2 = item->BoundingX - lw / 2.0;
+			double y2 = item->BoundingY - lw / 2.0;
+			double w2 = qMax(item->BoundingW + lw, 1.0);
+			double h2 = qMax(item->BoundingH + lw, 1.0);
+			if (!QRectF(x2, y2, w2, h2).intersects(QRectF(x1, y1, w1, h1)))
 				continue;
 			if (item->ChangedMasterItem)
 				continue;

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21175&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Sat Apr  9 14:18:32 2016
@@ -5829,20 +5829,22 @@
 int ScribusDoc::OnPage(PageItem *currItem)
 {
 	int retw = -1;
+
+	double w2 = currItem->visualWidth();
+	double h2 = currItem->visualHeight();
+	double x2 = -currItem->visualLineWidth() / 2.0;
+	double y2 = -currItem->visualLineWidth() / 2.0;
+	QTransform t = currItem->getTransform();
+	QRectF itemRect = t.mapRect(QRectF(x2, y2, w2, h2));
+
 	if (masterPageMode())
 	{
-		double x = currentPage()->xOffset() - m_docPrefsData.docSetupPrefs.bleeds.left();
-		double y = currentPage()->yOffset() - m_docPrefsData.docSetupPrefs.bleeds.top();
-		double w = currentPage()->width() + m_docPrefsData.docSetupPrefs.bleeds.left() + m_docPrefsData.docSetupPrefs.bleeds.right();
+		double x1 = currentPage()->xOffset() - m_docPrefsData.docSetupPrefs.bleeds.left();
+		double y1 = currentPage()->yOffset() - m_docPrefsData.docSetupPrefs.bleeds.top();
+		double w1 = currentPage()->width() + m_docPrefsData.docSetupPrefs.bleeds.left() + m_docPrefsData.docSetupPrefs.bleeds.right();
 		double h1 = currentPage()->height() + m_docPrefsData.docSetupPrefs.bleeds.bottom() + m_docPrefsData.docSetupPrefs.bleeds.top();
-		QTransform t = currItem->getTransform();
-		double w2 = currItem->visualWidth();
-		double h2 = currItem->visualHeight();
-		double x2 = -currItem->visualLineWidth() / 2.0;
-		double y2 = -currItem->visualLineWidth() / 2.0;
-		QRectF ret = t.mapRect(QRectF(x2, y2, w2, h2));
-		ret.getCoords(&x2, &y2, &w2, &h2);
-		if (( qMax( x, x2 ) <= qMin( x+w, x2+w2 ) && qMax( y, y2 ) <= qMin( y+h1, y2+h2 )))
+		QRectF pageRect(x1, y1, w1, h1);
+		if (itemRect.intersects(pageRect))
 			retw = currentPage()->pageNr();
 	}
 	else
@@ -5852,19 +5854,12 @@
 		for (uint a = 0; a < docPageCount; ++a)
 		{
 			getBleeds(a, pageBleeds);
-			double x = Pages->at(a)->xOffset() - pageBleeds.left();
-			double y = Pages->at(a)->yOffset() - pageBleeds.top();
-			double w = Pages->at(a)->width() + pageBleeds.left() + pageBleeds.right();
+			double x1 = Pages->at(a)->xOffset() - pageBleeds.left();
+			double y1 = Pages->at(a)->yOffset() - pageBleeds.top();
+			double w1 = Pages->at(a)->width() + pageBleeds.left() + pageBleeds.right();
 			double h1 = Pages->at(a)->height() + pageBleeds.bottom() + pageBleeds.top();
-			QTransform t = currItem->getTransform();
-			double w2 = currItem->visualWidth();
-			double h2 = currItem->visualHeight();
-			double x2 = -currItem->visualLineWidth() / 2.0;
-			double y2 = -currItem->visualLineWidth() / 2.0;
-			QRectF ret = t.mapRect(QRectF(x2, y2, w2, h2));
-
-			ret.getCoords(&x2, &y2, &w2, &h2);
-			if (( qMax( x, x2 ) <= qMin( x+w, x2+w2 ) && qMax( y, y2 ) <= qMin( y+h1, y2+h2 )))
+			QRectF pageRect(x1, y1, w1, h1);
+			if (itemRect.intersects(pageRect))
 			{
 				retw = static_cast<int>(a);
 				break;
@@ -5936,12 +5931,11 @@
 			double h2 = currItem->visualHeight();
 			double x2 = -currItem->visualLineWidth() / 2.0;
 			double y2 = -currItem->visualLineWidth() / 2.0;
-			QRectF ret = t.mapRect(QRectF(x2, y2, w2, h2));
-			ret.getCoords(&x2, &y2, &w2, &h2);
-			if (( qMax(x1, x2) <= qMin(x1 + w1, x2 + w2) && qMax(y1, y2) <= qMin(y1 + h1, y2 + h2)))
-			{
+			
+			QRectF pageRect(x1, y1, w1, h1);
+			QRectF itemRect = t.mapRect(QRectF(x2, y2, w2, h2));
+			if (itemRect.intersects(pageRect))
 				continue;
-			}
 		}
 
 		// If no or page owner is incorrect, recompute page owner




More information about the scribus-commit mailing list